@tscircuit/capacity-autorouter 0.0.48 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +44 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -8358,26 +8358,59 @@ var SingleSimplifiedPathSolver5 = class extends SingleSimplifiedPathSolver {
|
|
|
8358
8358
|
return;
|
|
8359
8359
|
}
|
|
8360
8360
|
if (layerChangeBtwHeadAndTail && layerChangeAtDistance > 0) {
|
|
8361
|
-
const
|
|
8361
|
+
const indexAfterLayerChange = this.getNearestIndexForDistance(layerChangeAtDistance) + 1;
|
|
8362
|
+
const pointAfterChange = this.inputRoute.route[indexAfterLayerChange];
|
|
8363
|
+
const viaLocation = { x: pointAfterChange.x, y: pointAfterChange.y };
|
|
8362
8364
|
if (this.lastValidPath) {
|
|
8363
8365
|
this.addPathToResult(this.lastValidPath);
|
|
8364
8366
|
this.lastValidPath = null;
|
|
8365
8367
|
}
|
|
8366
|
-
const
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8368
|
+
const lastPointInNewRoute = this.newRoute[this.newRoute.length - 1];
|
|
8369
|
+
if (lastPointInNewRoute.x !== viaLocation.x || lastPointInNewRoute.y !== viaLocation.y) {
|
|
8370
|
+
this.newRoute.push({
|
|
8371
|
+
x: viaLocation.x,
|
|
8372
|
+
y: viaLocation.y,
|
|
8373
|
+
z: lastPointInNewRoute.z
|
|
8374
|
+
// Use the Z of the layer we are leaving
|
|
8375
|
+
});
|
|
8376
|
+
}
|
|
8377
|
+
this.newVias.push(viaLocation);
|
|
8378
|
+
this.newRoute.push({
|
|
8379
|
+
x: viaLocation.x,
|
|
8380
|
+
y: viaLocation.y,
|
|
8381
|
+
z: pointAfterChange.z
|
|
8382
|
+
// Use the Z of the layer we are entering
|
|
8371
8383
|
});
|
|
8372
|
-
this.newRoute.push(pointAfterChange);
|
|
8373
8384
|
this.currentStepSize = this.maxStepSize;
|
|
8374
|
-
|
|
8375
|
-
|
|
8385
|
+
const segmentIndexAfterChange = this.pathSegments.findIndex(
|
|
8386
|
+
(seg) => seg.start === pointAfterChange
|
|
8387
|
+
);
|
|
8388
|
+
if (segmentIndexAfterChange !== -1) {
|
|
8389
|
+
this.tailDistanceAlongPath = this.pathSegments[segmentIndexAfterChange].startDistance;
|
|
8376
8390
|
this.headDistanceAlongPath = this.tailDistanceAlongPath;
|
|
8391
|
+
this.lastValidPath = null;
|
|
8392
|
+
this.lastValidPathHeadDistance = this.tailDistanceAlongPath;
|
|
8393
|
+
} else if (indexAfterLayerChange < this.inputRoute.route.length) {
|
|
8394
|
+
console.warn(
|
|
8395
|
+
"Fallback used for tailDistanceAlongPath after layer change"
|
|
8396
|
+
);
|
|
8397
|
+
const segment = this.pathSegments.find(
|
|
8398
|
+
(seg) => seg.start === this.inputRoute.route[indexAfterLayerChange]
|
|
8399
|
+
);
|
|
8400
|
+
if (segment) {
|
|
8401
|
+
this.tailDistanceAlongPath = segment.startDistance;
|
|
8402
|
+
this.headDistanceAlongPath = this.tailDistanceAlongPath;
|
|
8403
|
+
this.lastValidPath = null;
|
|
8404
|
+
this.lastValidPathHeadDistance = this.tailDistanceAlongPath;
|
|
8405
|
+
} else {
|
|
8406
|
+
console.error(
|
|
8407
|
+
"Could not find segment start after layer change, path might be incomplete."
|
|
8408
|
+
);
|
|
8409
|
+
this.solved = true;
|
|
8410
|
+
}
|
|
8377
8411
|
} else {
|
|
8378
|
-
console.
|
|
8412
|
+
console.warn("Layer change occurred at the end of the path.");
|
|
8379
8413
|
this.solved = true;
|
|
8380
|
-
return;
|
|
8381
8414
|
}
|
|
8382
8415
|
return;
|
|
8383
8416
|
}
|