Skip to content

Commit 1568c4d

Browse files
committed
wip improve point debugging
1 parent 252348e commit 1568c4d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/solvers/RouteStitchingSolver/SingleHighDensityRouteStitchSolver.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,16 @@ export class SingleHighDensityRouteStitchSolver extends BaseSolver {
5858
let closestDistance = Infinity
5959
for (let i = 0; i < this.remainingHdRoutes.length; i++) {
6060
const hdRoute = this.remainingHdRoutes[i]
61+
console.log(i, hdRoute.route)
6162
const lastPointInCandidate = hdRoute.route[hdRoute.route.length - 1]
6263
const firstPointInCandidate = hdRoute.route[0]
6364
const distToFirst = distance(lastMergedPoint, firstPointInCandidate)
65+
const distToLast = distance(lastMergedPoint, lastPointInCandidate)
6466
if (distToFirst < closestDistance) {
6567
closestDistance = distToFirst
6668
closestRouteIndex = i
6769
matchedOn = "first"
6870
}
69-
const distToLast = distance(lastMergedPoint, lastPointInCandidate)
7071
if (distToLast < closestDistance) {
7172
closestDistance = distToLast
7273
closestRouteIndex = i
@@ -80,7 +81,7 @@ export class SingleHighDensityRouteStitchSolver extends BaseSolver {
8081
if (matchedOn === "first") {
8182
this.mergedHdRoute.route.push(...hdRouteToMerge.route)
8283
} else {
83-
this.mergedHdRoute.route.push(...hdRouteToMerge.route.reverse())
84+
this.mergedHdRoute.route.push(...[...hdRouteToMerge.route].reverse())
8485
}
8586

8687
this.mergedHdRoute.vias.push(...hdRouteToMerge.vias)
@@ -154,11 +155,13 @@ export class SingleHighDensityRouteStitchSolver extends BaseSolver {
154155
}
155156

156157
// Add points for each route node
157-
for (const point of hdRoute.route) {
158+
for (let pi = 0; pi < hdRoute.route.length; pi++) {
159+
const point = hdRoute.route[pi]
158160
graphics.points?.push({
159-
x: point.x,
160-
y: point.y,
161+
x: point.x + ((i % 2) - 0.5) / 500 + ((pi % 8) - 4) / 1000,
162+
y: point.y + ((i % 2) - 0.5) / 500 + ((pi % 8) - 4) / 1000,
161163
color: colorList[i],
164+
label: `Route ${i} ${point === hdRoute.route[0] ? "First" : point === hdRoute.route[hdRoute.route.length - 1] ? "Last" : ""}`,
162165
})
163166
}
164167

0 commit comments

Comments
 (0)