Triangulate

C++TriangulateResult Triangulate(const Paths64& subject, Paths64& solution, bool useDelaunay = true);

C++TriangulateResult Triangulate(const PathsD& subject, int decPlaces, PathsD& solution, bool useDelaunay = true);


C# public static TriangulateResult Triangulate(Paths64 subject, Paths64 solution, bool useDelaunay = true);

C# public static TriangulateResult Triangulate(PathsD subject, int decimalPrec, PathsD solution, bool useDelaunay = true);


Delphifunction Intersect(const subjects: TPaths64; out solution: TPaths64; useDelaunay: Boolean = true): TriangulateResult;

Delphifunction Intersect(const subjects: TPathsD; decPrecision: integer; out solution: TPathsD; useDelaunay: Boolean = true): TriangulateResult;

This function Triangulates subject polygons. By default, the algorithm performs Constrained Delaunay Triangulation, but the function can also produce simpler triangles that avoids the overhead of Delaunay compliance.

While polygons in clipping operations may intersect and even self-intersect, subject polygons passed to this function must not intersect, either with other polygons or through self-intersections. If intersections are possible in subject polygons, these must be removed (eg. via a Union operation) before performing Triangulation, otherwise the function will fail.


C++ Example:
 SvgReader sr = SvgReader(folder + "coral3.svg"); 
 PathsD subject = sr.paths; 
 Triangulate(subject, 0, sol, true); 
 DisplaySolution("coral3_t.svg", sol, multicolor);
      

C# Example:
 string TestFile = "coral3.svg"; 
 srcFile = svgFolder + TestFile; 
 SvgReader sr = new(srcFile); 
 PathsD pp = sr.Paths; 
 if (Clipper.Triangulate(pp, 0, out solution) == TriangulateResult.success)  
   Display(solution, tmpFolder + TestFile);
      

  

See Also

Union, TriangulateResult