Hello, I'm having some strange results with my triangulation of a simple shape.
I have my polygon defined by these points:
-25 -73
70 -32
42 81
-84 133
-146 -6
-87 -62
However, when I test my project I have two extra points being added to my triangulation. After doing some searching it seems this can happen when the triangulation fails before the cleanup is complete, and it doesn't remove the extra points it needs to triangulate the polygon properly. What could cause the triangulation to fail, and what can I do to fix it and remove those points sticking out at the top left and right?
The js demo linked above gave proper results, so maybe I'm using the triangulator incorrectly?
Poly2Tri.PolygonPoint[] pp = new Poly2Tri.PolygonPoint[6];
pp[0] = new Poly2Tri.PolygonPoint(-25, -73);
pp[1] = new Poly2Tri.PolygonPoint(70, -32);
pp[2] = new Poly2Tri.PolygonPoint(42, 81);
pp[3] = new Poly2Tri.PolygonPoint(-84, 133);
pp[4] = new Poly2Tri.PolygonPoint(-146, -6);
pp[5] = new Poly2Tri.PolygonPoint(-87, -62);
Poly2Tri.Polygon poly = new Poly2Tri.Polygon(pp);
Poly2Tri.TriangulationContext tcx = new Poly2Tri.DTSweepContext();
tcx.PrepareTriangulation(poly);
Poly2Tri.DTSweep.Triangulate((Poly2Tri.DTSweepContext)tcx);
Debug.Log("Mesh triangulated with: " + tcx.Triangles.Count + " triangles")