AddPolygon works only for convex polygons

Anonymous 9 years ago 0
This discussion was imported from CodePlex

baucez wrote at 2012-05-07 14:40:

I tryed to use MeshBuilder.AddPolygon to draw a concave polygon and it does not work as expected. In fact the method uses a TriangleFan in case of more than 4 points. That is ok if the polygon is convex but does not work in the other cases.

I think Delaunay triangulation is something that can be used in this case.

Is it implemented in the toolkit?

Does exists any work around?




objo wrote at 2012-05-07 17:49:

Right, the AddPolygon method only works for convex polygons. A simple polygon triangulation method has been implemented in Geometry\CuttingEarsTriangulator.cs, maybe you can use this?

baucez wrote at 2012-05-08 12:30:

Great! It works perfectly!!

I was wondering why you don't use it in the mesh builder for polygons. I understand that the computational time is higher but it works in every case.