tesselate
描述
¥Description
Tesselates a polygon or multipolygon into a collection of triangle polygons using earcut.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
poly | 特性<多边形 | MultiPolygon> | 待镶嵌的多边形 |
返回
¥Returns
FeatureCollection<多边形> collection of polygon tesselations
¥FeatureCollection<Polygon> collection of polygon tesselations
示例
¥Examples
const poly = turf.polygon([
[
[11, 0],
[22, 4],
[31, 0],
[31, 11],
[21, 15],
[11, 11],
[11, 0],
],
]);
const triangles = turf.tesselate(poly);
安装
¥Installation
$ npm install @turf/tesselate
import { tesselate } from "@turf/tesselate";
const result = tesselate(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.tesselate(...);