You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
triangulateRaw: expects points in the format [x0, y0, x1, y1, x2, y2, ...]
triangulateFromPoints: expects 'dart:math's Point objects
final triangles =Earcut.triangulateRaw([10,0, 0,50, 60,60, 70,10]);
final triangles =Earcut.triangulateFromPoints([Point(10, 0), Point(0,50), Point(60,60), Point(70,10)]);
// Both return [1,0,3, 3,2,1]
Holes
A list of hole indicies, if any. For example, [5, 8] for a 12-vertice input would mean one hole with vertices 5-7 and another with 8-11. If you pass a single vertice as a hole, Earcut treats it as a Steiner point.
triangulateFromPointsAndHolePoints performs the logic to generate holeIndices when the outline of a polygon and the outline of its holes are available as points seperately.
More dimensions
Expected to be in the format [x0, y0, z0, x1, y1, z1, x2, y2, z2, ...]
The library implements a modified ear slicing algorithm, optimized by z-order curve hashing and extended to handle holes, twisted polygons, degeneracies and self-intersections in a way that doesn't guarantee correctness of triangulation, but attempts to always produce acceptable results for practical data.