tesselate
Description
Tesselates a Feature<Polygon> into a FeatureCollection<Polygon> of triangles using earcut.
Parameters
Name | Type | Description |
---|---|---|
poly | Feature<Polygon> | the polygon to tesselate |
Returns
FeatureCollection<Polygon> a geometrycollection feature
Examples
var poly = turf.polygon([
[
[11, 0],
[22, 4],
[31, 0],
[31, 11],
[21, 15],
[11, 11],
[11, 0],
],
]);
var 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(...);