Skip to main content
Version: 7.3.0

tesselate

描述

🌐 Description

使用 earcut 将多边形或多多边形镶嵌成一系列三角形多边形。

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

参数

🌐 Parameters

名称类型描述
polyFeature<Polygon | MultiPolygon>要镶嵌的多边形

返回

🌐 Returns

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

示例

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