diff --git a/LayoutLink.js b/LayoutLink.js index ece6764..bad5c70 100644 --- a/LayoutLink.js +++ b/LayoutLink.js @@ -27,9 +27,6 @@ class LayoutLink { bfs() { let bestByPos = new StringMap(); - // shortcut to save the lookup - let cheapestCostToGoal = null; - // BFS work queue let queue = new MinHeap((a) => a.cost); queue.push(...[ @@ -132,7 +129,7 @@ class LayoutLink { } else if (taken) { // Traversing nodes has higher cost cost += 5; - }; + } } // Overlapping links have cost, but not if they are from or to the same diff --git a/LayoutNode.js b/LayoutNode.js index 4d3353d..a6f5c54 100644 --- a/LayoutNode.js +++ b/LayoutNode.js @@ -106,7 +106,7 @@ class LayoutNode { for (let i of [0, 1]) { vec[i] = aff.node.pos[i] - this.pos[i]; vecsum += Math.abs(vec[i]); - }; + } // Avoid calling sqrt(), since the results are used relatively let distanceSquared = vec[0] * vec[0] + vec[1] * vec[1]; let weight = aff.distanceToWeight(distanceSquared, vec, aff.node.pos); diff --git a/utils.js b/utils.js index bce00eb..bedf820 100644 --- a/utils.js +++ b/utils.js @@ -7,15 +7,6 @@ function getOrSet(container, key, newValue) { return val; } -function intersects(set1, set2) { - for (let item of set1) { - if (set2.has(item)) { - return true; - } - } - return false; -} - function asymDifference(set1, set2) { let ret = new Set(); for (let item of set1) {