triangulate
fun triangulate(path: DoubleArray, holeIndices: IntArray = intArrayOf(), dimensions: Int = 2): List<Int>
Triangulate a polygon with 3d coordinates with optional hole
Return
Each group of three vertex indices in the resulting array forms a triangle. e.g. 1,0,3, 3,2,1
Parameters
path
flat array of vertex coordinates like x0,y0, x1,y1, x2,y2, ....
holeIndices
An array of hole indices if any (e.g. 5, 8 for a 12-vertex input would mean one hole with vertices 5–7 and another with 8–11).
dimensions
is the number of coordinates per vertex in the input array (2 by default). Only two are used for triangulation (x and y), and the rest are ignored.