Giter Site home page Giter Site logo

clip2tri's Introduction

clip2tri

Using clipper and poly2tri together for robust triangulation

About

This code originates from the Bitfighter project (http://bitfighter.org).

We needed a way to generate fast and robust robot navigation mesh zones. Triangulation was a part of this and we had originally used the excellent Triangle library (https://www.cs.cmu.edu/~quake/triangle.html). However, we hope to one day get into the Debian repository and so we needed a more-liberally licensed way to do this. We found the fast poly2tri library in hopes that it would do what we need since no other open source library we found performed as well and had as open a license.

We quickly found that poly2tri has some robustness issues which are inherent to the sweep-line algorithm it uses. Sanitizing our input using the amazing clipper library (http://www.angusj.com/delphi/clipper.php) solves most of the issues.

This code ties it all together.

Details

Bitfighter generates bot nav-mesh zones using the following process (more or less) using floating point data as the input:

  1. Aggregate all polygons and holes
  2. Feed data to clipper and have it return a PolyTree structure
  3. Perform some specific sanitization
  4. Feed data into poly2tri
  5. Feed data into a custom 2D version of recastnavigation (https://github.com/memononen/recastnavigation) to generate the bot zones

The code here handles at least steps 2-4, and has been altered to use more standard data types than those used in the Bitfighter code base.

clip2tri's People

Contributors

raptor avatar starseeker avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.