Coder Social home page Coder Social logo

Triangulate polygons? about sharpgltf HOT 4 CLOSED

vpenades avatar vpenades commented on May 20, 2024
Triangulate polygons?

from sharpgltf.

Comments (4)

bertt avatar bertt commented on May 20, 2024 1

update: I think I'll be using ST_DelaunayTriangles function from PostGIS (https://postgis.net/docs/ST_DelaunayTriangles.html), adds a database dependency but thats no problem in my case.

from sharpgltf.

vpenades avatar vpenades commented on May 20, 2024

No, the library only supports points, lines and triangles.

If your polygons are convex, you can just iterate over the vertices; the test library already has that code: ToolkitUtils.cs

For non contex polygons, or polygons with holes etc, more exotic algorythms are required. The most commonly used algorythm I know is the ear clipping algorythm, although most implementations you'll find around only work in 2D Space.

Finding a good, general purpose polygon triangulation algorythm that works in 3D Space is quite difficult, I actually expent some time trying to implement it, but it was taking too much time, and I finally considered it to be beyond the scope of the library.

Let me know if you find something useful, I'm interested too!

from sharpgltf.

bertt avatar bertt commented on May 20, 2024

ok thanks for clearing up, I'll try first the convex way.

from sharpgltf.

vpenades avatar vpenades commented on May 20, 2024

That's another reason why I didn't implement a polygon triangulator, there's more than one algorithm, and there's no algorithm that fits all.

from sharpgltf.

Related Issues (20)

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.