@tscircuit/schematic-trace-solver 0.0.88 → 0.0.89
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 +30 -22
- package/lib/solvers/Example28Solver/reroute.ts +10 -0
- package/package.json +1 -1
- package/tests/bug-reports/bug-report-20260706T213649Z/__snapshots__/bug-report-20260706T213649Z.snap.svg +386 -0
- package/tests/bug-reports/bug-report-20260706T213649Z/bug-report-20260706T213649Z.json +1471 -0
- package/tests/bug-reports/bug-report-20260706T213649Z/bug-report-20260706T213649Z.test.ts +12 -0
- package/tests/bug-reports/bug-report-20260707T092615Z/__snapshots__/bug-report-20260707T092615Z.snap.svg +251 -2097
- package/tests/bug-reports/bug-report-20260707T134549Z/__snapshots__/bug-report-20260707T134549Z.snap.svg +123 -856
- package/tests/bug-reports/bug-report-20260707T134722Z/__snapshots__/bug-report-20260707T134722Z.snap.svg +72 -274
- package/tests/bug-reports/bug-report-20260707T140410Z/__snapshots__/bug-report-20260707T140410Z.snap.svg +153 -949
- package/tests/bug-reports/bug-report-20260707T141025Z/__snapshots__/bug-report-20260707T141025Z.snap.svg +66 -217
- package/tests/bug-reports/bug-report-20260707T141421Z/__snapshots__/bug-report-20260707T141421Z.snap.svg +113 -612
- package/tests/bug-reports/bug-report-20260707T141421Z/bug-report-20260707T141421Z.test.ts +11 -0
- package/tests/examples/__snapshots__/example03.snap.svg +44 -44
- package/tests/examples/__snapshots__/example32.snap.svg +3 -3
- package/tests/repros/__snapshots__/repro-atmega328p-fault-pullup.snap.svg +87 -283
- package/tests/repros/__snapshots__/repro-atmega328p-missing-gnd-netlabel.snap.svg +117 -469
package/dist/index.js
CHANGED
|
@@ -5419,6 +5419,28 @@ var moveAttachedLabelsToReroutedTrace = ({
|
|
|
5419
5419
|
};
|
|
5420
5420
|
});
|
|
5421
5421
|
|
|
5422
|
+
// lib/solvers/Example28Solver/doesPathRunAlongChipBoundary.ts
|
|
5423
|
+
var doesPathRunAlongChipBoundary = (path, chipObstacles) => {
|
|
5424
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
5425
|
+
const start = path[i];
|
|
5426
|
+
const end = path[i + 1];
|
|
5427
|
+
for (const obstacle of chipObstacles) {
|
|
5428
|
+
if (!segmentRunsAlongRectBoundary(start, end, obstacle)) continue;
|
|
5429
|
+
if (getSegmentOverlapWithRectSpan(start, end, obstacle) > EPS7) {
|
|
5430
|
+
return true;
|
|
5431
|
+
}
|
|
5432
|
+
}
|
|
5433
|
+
}
|
|
5434
|
+
return false;
|
|
5435
|
+
};
|
|
5436
|
+
var getSegmentOverlapWithRectSpan = (start, end, rect) => {
|
|
5437
|
+
const isVertical4 = Math.abs(start.x - end.x) < EPS7;
|
|
5438
|
+
if (isVertical4) {
|
|
5439
|
+
return Math.min(Math.max(start.y, end.y), rect.maxY) - Math.max(Math.min(start.y, end.y), rect.minY);
|
|
5440
|
+
}
|
|
5441
|
+
return Math.min(Math.max(start.x, end.x), rect.maxX) - Math.max(Math.min(start.x, end.x), rect.minX);
|
|
5442
|
+
};
|
|
5443
|
+
|
|
5422
5444
|
// lib/solvers/Example28Solver/reroute.ts
|
|
5423
5445
|
var LABEL_CLEARANCE = 0.1;
|
|
5424
5446
|
var findBestReroutePath = ({
|
|
@@ -5529,6 +5551,14 @@ var createCandidateResult = ({
|
|
|
5529
5551
|
selected: false
|
|
5530
5552
|
};
|
|
5531
5553
|
}
|
|
5554
|
+
if (doesPathRunAlongChipBoundary(path, chipObstacles)) {
|
|
5555
|
+
return {
|
|
5556
|
+
path,
|
|
5557
|
+
status: "chip-collision",
|
|
5558
|
+
usesHorizontalSegmentPush,
|
|
5559
|
+
selected: false
|
|
5560
|
+
};
|
|
5561
|
+
}
|
|
5532
5562
|
return {
|
|
5533
5563
|
path,
|
|
5534
5564
|
score: scoreTracePath({
|
|
@@ -5792,28 +5822,6 @@ var countCrossingsWithOtherTraces = (params) => {
|
|
|
5792
5822
|
return crossingCount;
|
|
5793
5823
|
};
|
|
5794
5824
|
|
|
5795
|
-
// lib/solvers/Example28Solver/doesPathRunAlongChipBoundary.ts
|
|
5796
|
-
var doesPathRunAlongChipBoundary = (path, chipObstacles) => {
|
|
5797
|
-
for (let i = 0; i < path.length - 1; i++) {
|
|
5798
|
-
const start = path[i];
|
|
5799
|
-
const end = path[i + 1];
|
|
5800
|
-
for (const obstacle of chipObstacles) {
|
|
5801
|
-
if (!segmentRunsAlongRectBoundary(start, end, obstacle)) continue;
|
|
5802
|
-
if (getSegmentOverlapWithRectSpan(start, end, obstacle) > EPS7) {
|
|
5803
|
-
return true;
|
|
5804
|
-
}
|
|
5805
|
-
}
|
|
5806
|
-
}
|
|
5807
|
-
return false;
|
|
5808
|
-
};
|
|
5809
|
-
var getSegmentOverlapWithRectSpan = (start, end, rect) => {
|
|
5810
|
-
const isVertical4 = Math.abs(start.x - end.x) < EPS7;
|
|
5811
|
-
if (isVertical4) {
|
|
5812
|
-
return Math.min(Math.max(start.y, end.y), rect.maxY) - Math.max(Math.min(start.y, end.y), rect.minY);
|
|
5813
|
-
}
|
|
5814
|
-
return Math.min(Math.max(start.x, end.x), rect.maxX) - Math.max(Math.min(start.x, end.x), rect.minX);
|
|
5815
|
-
};
|
|
5816
|
-
|
|
5817
5825
|
// lib/solvers/Example28Solver/scoreSolutionTracePath.ts
|
|
5818
5826
|
var scoreSolutionTracePath = (params) => {
|
|
5819
5827
|
const { traces, outputTraces, chipObstacles } = params;
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
getPathLength,
|
|
15
15
|
isPathCollidingWithChipInterior,
|
|
16
16
|
} from "./geometry"
|
|
17
|
+
import { doesPathRunAlongChipBoundary } from "./doesPathRunAlongChipBoundary"
|
|
17
18
|
import type {
|
|
18
19
|
ChipObstacle,
|
|
19
20
|
RerouteCandidateResult,
|
|
@@ -165,6 +166,15 @@ const createCandidateResult = ({
|
|
|
165
166
|
}
|
|
166
167
|
}
|
|
167
168
|
|
|
169
|
+
if (doesPathRunAlongChipBoundary(path, chipObstacles)) {
|
|
170
|
+
return {
|
|
171
|
+
path,
|
|
172
|
+
status: "chip-collision",
|
|
173
|
+
usesHorizontalSegmentPush,
|
|
174
|
+
selected: false,
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
168
178
|
return {
|
|
169
179
|
path,
|
|
170
180
|
score: scoreTracePath({
|