AddPolygon works only for convex polygons

May 7, 2012 at 1:40 PM

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?




May 7, 2012 at 4:49 PM

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?

May 8, 2012 at 11:30 AM

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.