@tscircuit/schematic-trace-solver 0.0.184 → 0.0.185

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
@@ -12659,6 +12659,7 @@ ${c.status}`
12659
12659
 
12660
12660
  // lib/solvers/UnroutedTraceRecoverySolver/UnroutedTraceRecoverySolver.ts
12661
12661
  import { distance as distance6, doSegmentsIntersect as doSegmentsIntersect3 } from "@tscircuit/math-utils";
12662
+ import { calculateElbow as calculateElbow3 } from "calculate-elbow";
12662
12663
  var ROUTE_CLEARANCE = 0.2;
12663
12664
  var COORDINATE_TOLERANCE = 1e-9;
12664
12665
  var GROUND_NET_ID = "GND";
@@ -12711,7 +12712,7 @@ var getOuterBounds = (obstacles) => {
12711
12712
  maxY: Math.max(...obstacles.map((obstacle) => obstacle.maxY))
12712
12713
  };
12713
12714
  };
12714
- var getPerimeterCandidates = ({
12715
+ var getPinConnectionCandidates = ({
12715
12716
  connectionPair,
12716
12717
  obstacles
12717
12718
  }) => {
@@ -12733,7 +12734,13 @@ var getPerimeterCandidates = ({
12733
12734
  outerBounds.minX - ROUTE_CLEARANCE,
12734
12735
  outerBounds.maxX + ROUTE_CLEARANCE
12735
12736
  ];
12736
- const candidates = [];
12737
+ const candidates = [
12738
+ calculateElbow3(
12739
+ { ...firstPin, facingDirection: firstPin._facingDirection },
12740
+ { ...secondPin, facingDirection: secondPin._facingDirection },
12741
+ { overshoot: ROUTE_CLEARANCE }
12742
+ )
12743
+ ];
12737
12744
  for (const channelY of horizontalChannels) {
12738
12745
  candidates.push(
12739
12746
  removeConsecutiveDuplicatePoints([
@@ -13053,11 +13060,11 @@ var UnroutedTraceRecoverySolver = class extends BaseSolver {
13053
13060
  obstacles,
13054
13061
  maxConnectionDistance: this.maxConnectionDistance
13055
13062
  });
13056
- const perimeterCandidates = getPerimeterCandidates({
13063
+ const pinConnectionCandidates = getPinConnectionCandidates({
13057
13064
  connectionPair,
13058
13065
  obstacles
13059
13066
  });
13060
- const candidates = [...junctionCandidates, ...perimeterCandidates];
13067
+ const candidates = [...junctionCandidates, ...pinConnectionCandidates];
13061
13068
  const rejectComponentBoundaryTravel = hasParallelFailedConnection({
13062
13069
  connectionPair,
13063
13070
  failedConnectionPairs: this.failedConnectionPairs
@@ -1,5 +1,6 @@
1
1
  import type { Point } from "@tscircuit/math-utils"
2
2
  import { distance, doSegmentsIntersect } from "@tscircuit/math-utils"
3
+ import { calculateElbow } from "calculate-elbow"
3
4
  import { BaseSolver } from "lib/solvers/BaseSolver/BaseSolver"
4
5
  import { getConnectivityMapsFromInputProblem } from "lib/solvers/MspConnectionPairSolver/getConnectivityMapFromInputProblem"
5
6
  import {
@@ -86,7 +87,7 @@ const getOuterBounds = (obstacles: ObstacleRect[]) => {
86
87
  }
87
88
  }
88
89
 
89
- const getPerimeterCandidates = ({
90
+ const getPinConnectionCandidates = ({
90
91
  connectionPair,
91
92
  obstacles,
92
93
  }: {
@@ -111,7 +112,14 @@ const getPerimeterCandidates = ({
111
112
  outerBounds.minX - ROUTE_CLEARANCE,
112
113
  outerBounds.maxX + ROUTE_CLEARANCE,
113
114
  ]
114
- const candidates: Point[][] = []
115
+ // Recovery uses actual text bounds, so try local elbows before the perimeter.
116
+ const candidates: Point[][] = [
117
+ calculateElbow(
118
+ { ...firstPin, facingDirection: firstPin._facingDirection! },
119
+ { ...secondPin, facingDirection: secondPin._facingDirection! },
120
+ { overshoot: ROUTE_CLEARANCE },
121
+ ),
122
+ ]
115
123
 
116
124
  for (const channelY of horizontalChannels) {
117
125
  candidates.push(
@@ -526,11 +534,11 @@ export class UnroutedTraceRecoverySolver extends BaseSolver {
526
534
  obstacles,
527
535
  maxConnectionDistance: this.maxConnectionDistance,
528
536
  })
529
- const perimeterCandidates = getPerimeterCandidates({
537
+ const pinConnectionCandidates = getPinConnectionCandidates({
530
538
  connectionPair,
531
539
  obstacles,
532
540
  })
533
- const candidates = [...junctionCandidates, ...perimeterCandidates]
541
+ const candidates = [...junctionCandidates, ...pinConnectionCandidates]
534
542
  const rejectComponentBoundaryTravel = hasParallelFailedConnection({
535
543
  connectionPair,
536
544
  failedConnectionPairs: this.failedConnectionPairs,
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "url": "https://github.com/tscircuit/schematic-trace-solver.git"
6
6
  },
7
7
  "main": "dist/index.js",
8
- "version": "0.0.184",
8
+ "version": "0.0.185",
9
9
  "type": "module",
10
10
  "scripts": {
11
11
  "start": "cosmos",
@@ -0,0 +1,4 @@
1
+ import { PipelineDebugger } from "site/components/PipelineDebugger"
2
+ import inputProblem from "../../tests/bug-reports/bug-report-20260905T041712Z/bug-report-20260905T041712Z.json"
3
+
4
+ export default () => <PipelineDebugger inputProblem={inputProblem as any} />