mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 01:41:22 +01:00
refactor - create types array to have named attributes
This commit is contained in:
parent
0c2ec8d97e
commit
1a3ebe5b99
5 changed files with 24 additions and 18 deletions
|
|
@ -43,11 +43,10 @@ function calculateVoronoi(points, boundary) {
|
|||
TIME && console.timeEnd("calculateDelaunay");
|
||||
|
||||
TIME && console.time("calculateVoronoi");
|
||||
const n = points.length;
|
||||
const voronoi = new Voronoi(delaunay, allPoints, n);
|
||||
const voronoi = new Voronoi(delaunay, allPoints, points.length);
|
||||
|
||||
const cells = voronoi.cells;
|
||||
cells.i = getTypedArray(n).from(d3.range(n)); // array of indexes
|
||||
cells.i = createTypedArray({maxValue: points.length, length: points.length}).map((_, i) => i); // array of indexes
|
||||
const vertices = voronoi.vertices;
|
||||
TIME && console.timeEnd("calculateVoronoi");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue