triangulate
fun triangulate(data: DoubleArray, holeIndices: IntArray? = null, dim: Int = 2, out: IntList = IntList()): IntList
Triangulate a polygon. data holds flat vertex coordinates, dim components per vertex (data[i*dim], data[i*dim+1], …). holeIndices gives the vertex index where each hole ring starts; the outer ring is the vertices before the first hole. Triangle vertex indices are appended to out in groups of three (each index is a vertex ordinal i, i.e. into the per-vertex data[i*dim] layout). Rings need not be a particular winding — earcut normalises the outer ring CCW and holes CW. out is cleared first and returned.