Earcut

优质
小牛编辑
118浏览
2023-12-01

切割多边形三角剖分算法的实现。这份代码是mapbox/earcut的一个端口。

方法

.triangulate ( data, holeIndices, dim ) : Array

data -- 一个顶点坐标的平面数组。
holeIndices -- 空洞索引的数组(如果有的话)。
dim -- 输入数组中每个顶点的坐标数。

Triangulates the given shape definition by returning an array of triangles. A triangle is defined by three consecutive integers representing vertex indices.

源代码

src/extras/Earcut.js