mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
feat: routes generation
This commit is contained in:
parent
af927ed345
commit
6776e5b867
19 changed files with 607 additions and 295 deletions
|
|
@ -1,7 +1,9 @@
|
|||
"use strict";
|
||||
// FMG helper functions
|
||||
|
||||
// extracted d3 code to bypass version conflicts
|
||||
// https://github.com/d3/d3-array/blob/main/src/group.js
|
||||
|
||||
export function rollups(values, reduce, ...keys) {
|
||||
function rollups(values, reduce, ...keys) {
|
||||
return nest(values, Array.from, reduce, keys);
|
||||
}
|
||||
|
||||
|
|
@ -23,3 +25,7 @@ function nest(values, map, reduce, keys) {
|
|||
return map(groups);
|
||||
})(values, 0);
|
||||
}
|
||||
|
||||
function dist2([x1, y1], [x2, y2]) {
|
||||
return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue