new Diagram(points, bbox, relaxations, improveCorners)
Creates a voronoi diagram of a given point set that is created inside a partiuclar bounding box. The set of points can also be relaxed creating a more "blue" noise effect using loyd relaxation.
The Diagram class is an extenstion of the voronoi Diagram. It turns the
diagram into a more useable format where centers, edges, and corners are
better connected. This allows for many different types of traversal over
the graph. This class uses the rhill-voronoi library for building the
voronoi graph.
| Name | Type | Default | Description |
|---|---|---|---|
points |
Array.<Vector> | The vector location to create the voronoi diagram with | |
bbox |
Rectangle | The bounding box for the creation of the voronoi diagram | |
relaxations |
integer | 0 | optional The number of lloyd relaxations to do. This turns a noisy diagram into a more uniform diagram iteration by iteration. This helps to improve the spacing between points in the diagram. |
improveCorners |
bool | false | optional This improves uniformity among the corners by setting them to the average of their neighbors. This breaks the voronoi properties of the diagram. |