This commit is contained in:
Azgaar 2020-03-28 23:48:56 +03:00
parent c8f758ab3c
commit d1c795494d
12 changed files with 215 additions and 117 deletions

View file

@ -74,7 +74,7 @@
// directly connect first port with the farthest one on the same island to remove gap
void function() {
if (pack.features[f].type === "lake") return;
if (!pack.features[f] || pack.features[f].type === "lake") return;
const portsOnIsland = ports.filter(b => cells.f[b.cell] === cells.f[first]);
if (portsOnIsland.length < 4) return;
const opposite = ports[d3.scan(portsOnIsland, (a, b) => ((b.y - ports[0].y) ** 2 + (b.x - ports[0].x) ** 2) - ((a.y - ports[0].y) ** 2 + (a.x - ports[0].x) ** 2))].cell;