Changed Voronoi generator to be more class-based, added mediocre documentation.

This commit is contained in:
Gabriel 2021-02-02 13:27:34 -05:00
parent 40e5930571
commit 449fded687
3 changed files with 113 additions and 69 deletions

View file

@ -12,7 +12,7 @@ document.title += " v" + version;
// Switches to disable/enable logging features
const INFO = 0;
const TIME = 0;
const TIME = 1;
const WARN = 1;
const ERROR = 1;
@ -611,7 +611,7 @@ function calculateVoronoi(graph, points) {
TIME && console.timeEnd("calculateDelaunay");
TIME && console.time("calculateVoronoi");
const voronoi = Voronoi(delaunay, allPoints, n);
const voronoi = new Voronoi(delaunay, allPoints, n);
graph.cells = voronoi.cells;
graph.cells.i = n < 65535 ? Uint16Array.from(d3.range(n)) : Uint32Array.from(d3.range(n)); // array of indexes
graph.vertices = voronoi.vertices;