Skip to content

editorGlobalsPolygonTriangulator

Class: PolygonTriangulator

Abstract class that defines the interface for polygon triangulators and contains helper points

Hierarchy

  • PolygonTriangulator

DelaunayPolygonTriangulator

EarcutPolygonTriangulator

Index

Properties

Methods

Properties

Protected steinerPointDistanceLevels

steinerPointDistanceLevels: number[] = [256, 128, 32, 16, 8, 4, 2]

Defined in src/util/polygon/triangulatingClipper/Triangulator/PolygonTriangulator.ts:22

Methods

Protected _generateSteinerPoints

_generateSteinerPoints(polygon: Polygon | MultiPolygon, options: ISteinerPointOptions): Array‹object›

Defined in src/util/polygon/triangulatingClipper/Triangulator/PolygonTriangulator.ts:46

Steiner points are additional triangulation points inside the polygon that are triangulated to optimize the quality of the triangulation solution. we add regularly spaced steiner points in order to prevent long (and degenerated) triangles.

Parameters:

Name Type Default
polygon Polygon | MultiPolygon -
options ISteinerPointOptions {}

Returns: Array‹object›


Private _reconstructTriangles

_reconstructTriangles(pointsAsVectors: Vector3[], trianglesAsIndices: Array‹[number, number, number]›): Triangle[]

Defined in src/util/polygon/triangulatingClipper/Triangulator/PolygonTriangulator.ts:161

Parameters:

Name Type Description
pointsAsVectors Vector3[] -
trianglesAsIndices Array‹[number, number, number]› indices into the pointsAsVectors array

Returns: Triangle[]


Abstract triangulate

triangulate(polygon: Polygon, candidates: Array‹Polygon | MultiPolygon›, addSteinerPoints: boolean): Triangle[]

Defined in src/util/polygon/triangulatingClipper/Triangulator/PolygonTriangulator.ts:35

Triangulate the given polygon. Note: If the polygon is self touching (a point is used multiple time in the outline), these points must be deduplicated (only one point instance per position) by the triangulation implementation

Parameters:

Name Type Description
polygon Polygon the polygon to be triangulated
candidates Array‹Polygon | MultiPolygon - optional: other polygons that will be intersected/unioned/differenced with this polygon. Can be used by the implementation to optimize the triangulation result
addSteinerPoints boolean -

Returns: Triangle[]

array of triangles