# tesselate
Tesselates a Feature into a FeatureCollection of triangles using earcut.
使用 earcut (opens new window) 算法将Feature
细分为FeatureCollection
三角形。
参数
参数 | 类型 | 描述 |
---|---|---|
poly | Feature <Polygon> | the polygon to tesselate |
返回
FeatureCollection <Polygon> - a geometrycollection feature
示例
var poly = turf.polygon([[
[11, 0], // 注意:polygon首尾坐标要一致
[22, 4],
[31, 0],
[31, 11],
[21, 15],
[11, 11],
[11, 0]]
]);
var triangles = turf.tesselate(poly);