Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Polygon Partitioning vs Triangulation

I recently asked this question about how to cut down a concave polygon to convex ones, and I was suggested to do Triangulation or Polygon Partitioning.

The library I'm using (SFML\Box2D) only takes convex shapes.

This is what I want to know:

  1. Is Polygon Partitioning, or Triangulation of Polygons faster?

  2. How does Polygon Partitioning work/ How do you do it?


Don't forget Triangulation doesn't require convex shapes to be made either...

like image 611
Griffin Avatar asked Jul 15 '11 02:07

Griffin


People also ask

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 any polygon be triangulated?

Every simple polygon admits a triangulation. 2. Every triangulation of an n-gon has exactly n − 2 triangles.

How can a polygon be split into triangles?

The most remarkable and important property of triangles is that any polygon can be split up into triangles simply by drawing diagonals of the polygon. This fact forms the basis for understanding why the interior angles of polygons add up to 180(n-2) degrees.

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

Not a full answer to your question, but if you have a general polygon (concave, convex, whatever) and you are looking to triangulate it (for subsequent openGL style rendering perhaps) you could look into "constrained Delaunay triangulation" packages. One such example is the Triangle package, which is reputed to be fast and robust.

As I understand it, the algorithms used in Triangle exhibit O(nlogn) runtime complexity.

like image 154
Darren Engwirda Avatar answered Sep 29 '22 09:09

Darren Engwirda


Polygon partitioning splits your polygon into convex polygons.
Triangulation splits it into triangles. As far as I understand, partitioning into triangles requires that you first perform polygon partitioning, since partitioning convex polygon into triangles is relatively trivial.
Splitting polyon into convex polygons is the hard part. I have written a program that does both for a class and if you want I can dig it up.

Here's my code: https://github.com/meshko/triangulator/tree/master/som

I haven't touched in 10 years so beware of.

like image 42
MK. Avatar answered Sep 29 '22 08:09

MK.