@tscircuit/capacity-autorouter 0.0.92 → 0.0.94
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 +11 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6276,6 +6276,7 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
6276
6276
|
currentHead;
|
|
6277
6277
|
currentConnectionName;
|
|
6278
6278
|
currentPath;
|
|
6279
|
+
currentViaCount;
|
|
6279
6280
|
constructor({
|
|
6280
6281
|
nodeWithPortPoints,
|
|
6281
6282
|
colorMap,
|
|
@@ -6300,8 +6301,6 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
6300
6301
|
hyperParameters.SHUFFLE_SEED
|
|
6301
6302
|
);
|
|
6302
6303
|
}
|
|
6303
|
-
const nodeCenterX = (this.bounds.minX + this.bounds.maxX) / 2;
|
|
6304
|
-
const nodeCenterY = (this.bounds.minY + this.bounds.maxY) / 2;
|
|
6305
6304
|
for (const [connectionName, { start: start2, end }] of this.portPairMap.entries()) {
|
|
6306
6305
|
if (start2.z === end.z) {
|
|
6307
6306
|
const isVertical = Math.abs(start2.x - end.x) < 1e-9;
|
|
@@ -6343,6 +6342,7 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
6343
6342
|
const start = this.portPairMap.get(this.currentConnectionName).start;
|
|
6344
6343
|
this.currentHead = this._padByNewHeadWallBuffer(start);
|
|
6345
6344
|
this.currentPath = [start, this.currentHead];
|
|
6345
|
+
this.currentViaCount = 0;
|
|
6346
6346
|
this.placeholderPaths.delete(this.currentConnectionName);
|
|
6347
6347
|
}
|
|
6348
6348
|
_padByNewHeadWallBuffer(point) {
|
|
@@ -6414,10 +6414,17 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
6414
6414
|
checkIntersectionsWithPathMap(this.completedPaths);
|
|
6415
6415
|
checkIntersectionsWithPathMap(this.placeholderPaths);
|
|
6416
6416
|
const needsZChange = this.currentHead.z !== targetEnd.z;
|
|
6417
|
+
if (closestIntersection || needsZChange) {
|
|
6418
|
+
this.currentViaCount++;
|
|
6419
|
+
if (this.currentViaCount >= this.maxViaCount) {
|
|
6420
|
+
this.failed = true;
|
|
6421
|
+
return;
|
|
6422
|
+
}
|
|
6423
|
+
}
|
|
6417
6424
|
if (closestIntersection) {
|
|
6418
6425
|
let viaXY;
|
|
6419
6426
|
const distToIntersection = closestIntersection.dist;
|
|
6420
|
-
if (distToIntersection
|
|
6427
|
+
if (distToIntersection <= this.VIA_INTERSECTION_BUFFER_DISTANCE + 1e-6) {
|
|
6421
6428
|
viaXY = midpoint(this.currentHead, closestIntersection.point);
|
|
6422
6429
|
} else {
|
|
6423
6430
|
const intersectionPoint = closestIntersection.point;
|
|
@@ -6469,6 +6476,7 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
|
|
|
6469
6476
|
const { start } = this.portPairMap.get(this.currentConnectionName);
|
|
6470
6477
|
this.currentHead = this._padByNewHeadWallBuffer(start);
|
|
6471
6478
|
this.currentPath = [start, this.currentHead];
|
|
6479
|
+
this.currentViaCount = 0;
|
|
6472
6480
|
this.placeholderPaths.delete(this.currentConnectionName);
|
|
6473
6481
|
}
|
|
6474
6482
|
}
|
|
@@ -8801,9 +8809,6 @@ var MultiHeadPolyLineIntraNodeSolver3 = class extends MultiHeadPolyLineIntraNode
|
|
|
8801
8809
|
});
|
|
8802
8810
|
viaSolver.solve();
|
|
8803
8811
|
if (viaSolver.failed || !viaSolver.solved) {
|
|
8804
|
-
this.failed = true;
|
|
8805
|
-
this.error = viaSolver.error ?? "ViaPossibilitiesSolver2 failed to find a solution.";
|
|
8806
|
-
console.error(this.error);
|
|
8807
8812
|
return null;
|
|
8808
8813
|
}
|
|
8809
8814
|
const polyLines = [];
|