Constructs the weighted Delaunay triangulation of a set of points. This is equivalent to constructing a Delaunay triangulation of a set of spheres whose radii are the same as the weights for each point.
var wdt = require('weighted-delaunay')
var points = new Array(10)
var weights = new Array(10)
for(var i=0; i<10; ++i) {
points[i] = [ Math.random(), Math.random() ]
weights[i] = Math.random()
}
var cells = wdt(points, weights)
console.log(cells)
Example output:
[ [ 1, 0, 5 ],
[ 1, 4, 6 ],
[ 0, 7, 5 ],
[ 1, 7, 4 ],
[ 7, 1, 5 ],
[ 7, 0, 8 ] ]
npm i weighted-delaunay
Constructs a weighted Delaunay triangulation.
points
- the points of the weighted delaunay triangulationweights
the weights for each pointspointAtInfinity
an optional flag, which if set totrue
adds the point at infinity to the triangulation. (Defaultfalse
)
Returns The cells of the resulting weighted Delaunay triangulation.
(c) 2015 Mikola Lysenko. MIT License