开发者

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'开发者_StackOverflowm 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...


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜