mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
Modernize voronoi (#557)
Voronoi.js modernization by @SaltyQuetzals * Changed Voronoi generator to be more class-based, added mediocre documentation. * Added spaces to JSDoc links so text doesn't bleed into URL * Found delaunator docs, very helpful in writing function documentation.
This commit is contained in:
parent
ed33864e07
commit
7b91151179
3 changed files with 123 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;
|
||||
|
||||
|
|
@ -610,7 +610,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