Package org.maplibre.earcut4j
Class Earcut
java.lang.Object
org.maplibre.earcut4j.Earcut
-
Method Summary
-
Method Details
-
earcut
Triangulates the given polygon- Parameters:
data- is a flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...].- Returns:
- List containing groups of three vertice indices in the resulting array forms a triangle.
-
earcut
Triangulates the given polygon- Parameters:
data- is a flat array of vertice coordinates like [x0,y0, x1,y1, x2,y2, ...].holeIndices- is an array of hole indices if any (e.g. [5, 8] for a 12-vertice input would mean one hole with vertices 5-7 and another with 8-11).dim- is the number of coordinates per vertice in the input array- Returns:
- List containing groups of three vertice indices in the resulting array forms a triangle.
-
deviation
Calculates the relative difference between the total area of triangles and the area of the input polygon. 0 means the triangulation is fully correct.- Parameters:
data- is a flat array of vertex coordinates like [x0,y0, x1,y1, x2,y2, ...].holeIndices- is an array of hole indices if any.dim- is the number of coordinates per vertex in the input array.triangles- is the triangulation result from earcut.- Returns:
- the relative difference between triangle area and polygon area.
-