Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polygon Triangulation c#

I need to calculate triangles of a polygon. Polygon can contain holes. And Req an efficient way. So I think I need Constrained Delaunay Triangulation.

I must do that in c#, only need calculation not drawing or something.

poly2tri seems good but idk its not working for me :S

Anyway I need help. How can I calculate that triangles? (If your best offer is poly2tri, i can explain my problem on it)

like image 772
user1708062 Avatar asked Oct 08 '12 16:10

user1708062


People also ask

How do you triangulate a polygon?

One way to triangulate a simple polygon is based on the two ears theorem, as the fact that any simple polygon with at least 4 vertices without holes has at least two 'ears', which are triangles with two sides being the edges of the polygon and the third one completely inside it.

What is polygon triangulation used for?

Computing the triangulation of a polygon is a fundamental algorithm in computational geometry. In computer graphics, polygon triangulation algorithms are widely used for tessellating curved geometries, as are described by splines [Kumar and Manocha 1994].

Can every polygon be triangulated?

Theorem: Every polygon has a triangulation. Proof by Induction. Base case n = 3. Pick a convex corner p.

What is optimal polygon triangulation?

A triangulation of a polygon can be thought of as a set of chords that divide the polygon into triangles such that no two chords intersect (except possibly at a vertex). This is a triangulation of the same polygon: An optimal triangulation is one that minimizes some cost function of the triangles.


2 Answers

Delaunay was not designed for this, use Ear Clipping instead.

like image 51
abenci Avatar answered Sep 18 '22 02:09

abenci


I suppose my simple solution on github:gist (but it's rather old and probably not optimal).

like image 42
Ivan Kochurkin Avatar answered Sep 17 '22 02:09

Ivan Kochurkin