public Triangle2Ex[] ToTriangles() { Polygon2Ex[] simple_pols = ToSimplePolygons(); List <Triangle2Ex> tri_list = new List <Triangle2Ex> (); foreach (Polygon2Ex pol in simple_pols) { int[] points = Triangulates.Points(pol.Vertices.ToList()); for (int idx = 0; idx < points.Length; idx += 3) { int idx0 = idx; int idx1 = idx + 1; int idx2 = idx + 2; tri_list.Add(new Triangle2Ex(pol.Vertices [points [idx0]], pol.Vertices [points [idx1]], pol.Vertices [points [idx2]])); } } return(tri_list.ToArray()); }
public int[] ToTrianglesVertice() { return(Triangulates.Points(this.Vertices.ToList())); }