JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4604739
  • Score
    100M100P100Q204250F
  • License ISC

The fastest JavaScript library for Delaunay triangulation of 2D points

Package Exports

  • delaunator

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (delaunator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

delaunator

The fastest JavaScript library for Delaunay triangulation of 2D points. Implements a variation of the Sweep-hull algorithm.

Build Status

Demo

Example

var points = [[168, 180], [168, 178], [168, 179], [168, 181], [168, 183], ...];

var delaunay = new Delaunator(points);
console.log(delaunay.triangles);
// [623, 636, 619,  636, 444, 619, ...]

API Reference

new Delaunator(points[, getX, getY])

Constructs a delaunay triangulation object given an array of points ([x, y] by default). getX and getY are optional functions of the form (point) => value for custom point formats. Duplicate points are skipped.

delaunay.triangles

A flat array of triangle indices (each group of three numbers forms a triangle).

To do

  • Implement the algorithm.
  • Add a simple demo.
  • Add proper tests.
  • Clean up and document the API.
  • Release the first version to NPM.
  • Add a benchmark against similar libraries.