1.0.1 • Published 11 years ago
voronoi-diagram v1.0.1
voronoi-diagram
Construct a voronoi diagram for a collection of points. Works in any dimension in both node.js and in a web browser
Example
var voronoi = require("voronoi-diagram")
var points = [
[1, 0],
[0, 1],
[0, 0]
]
console.log(voronoi(points))Install
npm install voronoi-diagramAPI
require("voronoi-diagram")(points)
Constructs a voronoi diagram for a collection of points.
pointsis an array of points inn-dimensional space
Returns An object with two properties
positionsan array of points representing the location of the voronoi sitescellsan array of indices with the same length aspointsrepresenting the voronoi sites.-1indicates a point at infinity. In 2D the cells are oriented clockwise, while in 3D they are sorted lexicographically.
Credits
(c) 2013 Mikola Lysenko. MIT License

