Skip to content

KBE3D / KBCore / turf / tesselate

函数: tesselate()

tesselate(poly: Feature<Polygon | MultiPolygon>): FeatureCollection<Polygon>

Function

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

.

参数

poly

Feature<Polygon | MultiPolygon>

the polygon to tesselate

返回

FeatureCollection<Polygon>

collection of polygon tesselations

示例

ts
const poly = turf.polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]);
const triangles = turf.tesselate(poly);

//addToMap
const addToMap = [poly, triangles]

KBE3D @3.0.0 Copyright © 2024-present KBE3D