poly-partition
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

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:

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

const triangles = triangulate(merged, true);

const convexes = convexPartition(merged, true);

Dependents (2)

Package Sidebar

Install

npm i poly-partition

Weekly Downloads

474

Version

1.0.2

License

MIT

Unpacked Size

51.8 kB

Total Files

13

Last publish

Collaborators

  • pngx