Skip to main content
Version: Next

tesselate

Description

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

Parameters

NameTypeDescription
polyFeature<Polygon | MultiPolygon>the polygon to tesselate

Returns

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