@tscircuit/capacity-autorouter 0.0.91 → 0.0.93

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 CHANGED
@@ -6050,12 +6050,6 @@ var SingleTransitionCrossingRouteSolver = class extends BaseSolver {
6050
6050
  };
6051
6051
  return middle(effectiveA, effectiveB);
6052
6052
  };
6053
- const traceBounds = {
6054
- maxX: this.bounds.maxX - this.obstacleMargin - this.traceThickness / 2,
6055
- maxY: this.bounds.maxY - this.obstacleMargin - this.traceThickness / 2,
6056
- minX: this.bounds.minX + this.obstacleMargin + this.traceThickness / 2,
6057
- minY: this.bounds.minY + this.obstacleMargin + this.traceThickness / 2
6058
- };
6059
6053
  const minDistFromViaToTrace = this.viaDiameter / 2 + this.traceThickness / 2 + this.obstacleMargin;
6060
6054
  const p2 = middleWithMargin(
6061
6055
  via,
@@ -6282,6 +6276,7 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
6282
6276
  currentHead;
6283
6277
  currentConnectionName;
6284
6278
  currentPath;
6279
+ currentViaCount;
6285
6280
  constructor({
6286
6281
  nodeWithPortPoints,
6287
6282
  colorMap,
@@ -6306,8 +6301,6 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
6306
6301
  hyperParameters.SHUFFLE_SEED
6307
6302
  );
6308
6303
  }
6309
- const nodeCenterX = (this.bounds.minX + this.bounds.maxX) / 2;
6310
- const nodeCenterY = (this.bounds.minY + this.bounds.maxY) / 2;
6311
6304
  for (const [connectionName, { start: start2, end }] of this.portPairMap.entries()) {
6312
6305
  if (start2.z === end.z) {
6313
6306
  const isVertical = Math.abs(start2.x - end.x) < 1e-9;
@@ -6349,6 +6342,7 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
6349
6342
  const start = this.portPairMap.get(this.currentConnectionName).start;
6350
6343
  this.currentHead = this._padByNewHeadWallBuffer(start);
6351
6344
  this.currentPath = [start, this.currentHead];
6345
+ this.currentViaCount = 0;
6352
6346
  this.placeholderPaths.delete(this.currentConnectionName);
6353
6347
  }
6354
6348
  _padByNewHeadWallBuffer(point) {
@@ -6420,10 +6414,17 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
6420
6414
  checkIntersectionsWithPathMap(this.completedPaths);
6421
6415
  checkIntersectionsWithPathMap(this.placeholderPaths);
6422
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
+ }
6423
6424
  if (closestIntersection) {
6424
6425
  let viaXY;
6425
6426
  const distToIntersection = closestIntersection.dist;
6426
- if (distToIntersection < this.VIA_INTERSECTION_BUFFER_DISTANCE) {
6427
+ if (distToIntersection <= this.VIA_INTERSECTION_BUFFER_DISTANCE + 1e-6) {
6427
6428
  viaXY = midpoint(this.currentHead, closestIntersection.point);
6428
6429
  } else {
6429
6430
  const intersectionPoint = closestIntersection.point;
@@ -6475,6 +6476,7 @@ var ViaPossibilitiesSolver2 = class extends BaseSolver {
6475
6476
  const { start } = this.portPairMap.get(this.currentConnectionName);
6476
6477
  this.currentHead = this._padByNewHeadWallBuffer(start);
6477
6478
  this.currentPath = [start, this.currentHead];
6479
+ this.currentViaCount = 0;
6478
6480
  this.placeholderPaths.delete(this.currentConnectionName);
6479
6481
  }
6480
6482
  }
@@ -8807,9 +8809,6 @@ var MultiHeadPolyLineIntraNodeSolver3 = class extends MultiHeadPolyLineIntraNode
8807
8809
  });
8808
8810
  viaSolver.solve();
8809
8811
  if (viaSolver.failed || !viaSolver.solved) {
8810
- this.failed = true;
8811
- this.error = viaSolver.error ?? "ViaPossibilitiesSolver2 failed to find a solution.";
8812
- console.error(this.error);
8813
8812
  return null;
8814
8813
  }
8815
8814
  const polyLines = [];
@@ -8977,12 +8976,12 @@ var HyperSingleIntraNodeSolver = class extends HyperParameterSupervisorSolver {
8977
8976
  }
8978
8977
  getCombinationDefs() {
8979
8978
  return [
8980
- // ["closedFormTwoTrace"],
8981
8979
  ["multiHeadPolyLine"],
8982
8980
  ["majorCombinations", "orderings6", "cellSizeFactor"],
8983
8981
  ["noVias"],
8984
8982
  ["orderings50"],
8985
- ["flipTraceAlignmentDirection", "orderings6"]
8983
+ ["flipTraceAlignmentDirection", "orderings6"],
8984
+ ["closedFormTwoTrace"]
8986
8985
  ];
8987
8986
  }
8988
8987
  getHyperParameterDefs() {