简体   繁体   中英

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...

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM