mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 18:11:24 +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
|
|
@ -394,7 +394,7 @@
|
|||
const hull = getHull(start, s.i, s.cells / 10);
|
||||
const points = [...hull].map(v => pack.vertices.p[v]);
|
||||
const delaunay = Delaunator.from(points);
|
||||
const voronoi = Voronoi(delaunay, points, points.length);
|
||||
const voronoi = new Voronoi(delaunay, points, points.length);
|
||||
const chain = connectCenters(voronoi.vertices, s.pole[1]);
|
||||
const relaxed = chain.map(i => voronoi.vertices.p[i]).filter((p, i) => i%15 === 0 || i+1 === chain.length);
|
||||
paths.push([s.i, relaxed]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue