Skip to main content
Version: 7.2.0

tesselate

描述

¥Description

使用 earcut 将一个多边形或多多边形细分为一组三角形。

¥Tesselates a polygon or multipolygon into a collection of triangle polygons using earcut.

参数

¥Parameters

名称类型描述
poly特性<多边形 | MultiPolygon>待镶嵌的多边形

返回

¥Returns

FeatureCollection<多边形> 多边形镶嵌集合

¥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(...);