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:
Gabriel Britain 2021-02-04 08:51:29 -05:00 committed by GitHub
parent ed33864e07
commit 7b91151179
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 123 additions and 69 deletions

View file

@ -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]);