1.0.2 • Published 2 years ago

poly-partition v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

poly-partition-js

Modified from PolyPartition.

Functions

  • removeHoles(polygon: Contour, holes: Contour[], doNotCheckOrdering?: boolean): Contour
  • triangulate(polygon: Contour, doNotCheckOrdering?: boolean): Contour[]
  • convexPartition(polygon: Contour, doNotCheckOrdering?: boolean): Contour[]

Contour is { x: number, y: number }[], counterclockwise for non-holes, clockwise for holes.

Example

Inputs:

npm.io

const merged = removeHoles(polygon, [hole1, hole2], true);

npm.io

const triangles = triangulate(merged, true);

npm.io

const convexes = convexPartition(merged, true);

npm.io