mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
Changed Voronoi generator to be more class-based, added mediocre documentation.
This commit is contained in:
parent
40e5930571
commit
449fded687
3 changed files with 113 additions and 69 deletions
4
main.js
4
main.js
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue