@tscircuit/schematic-trace-solver 0.0.105 → 0.0.107
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 +403 -166
- package/lib/solvers/TraceCleanupSolver/minimizeTurnsWithFilteredLabels.ts +78 -27
- package/lib/solvers/TraceCleanupSolver/sameNetRailAlignment/geometry.ts +40 -20
- package/lib/solvers/TraceCleanupSolver/sub-solver/UntangleTraceSubsolver.ts +178 -9
- package/lib/solvers/TraceCleanupSolver/sub-solver/findIntersectionsWithObstacles.ts +59 -0
- package/lib/solvers/TraceCleanupSolver/sub-solver/generateLShapeRerouteCandidates.ts +64 -1
- package/package.json +1 -1
- package/tests/bug-reports/bug-report-20260707T140410Z/__snapshots__/bug-report-20260707T140410Z.snap.svg +3 -3
- package/tests/bug-reports/bug-report-20260721T221026Z/__snapshots__/bug-report-20260721T221026Z.snap.svg +1 -1
- package/tests/examples/__snapshots__/example13.snap.svg +3 -3
- package/tests/examples/__snapshots__/example29.snap.svg +23 -23
- package/tests/examples/example19.test.ts +4 -0
- package/tests/repros/__snapshots__/repro-example35-minimize-trace-crossing.snap.svg +256 -0
- package/tests/repros/__snapshots__/repro-tps61222-trace-intersection.snap.svg +221 -0
- package/tests/repros/__snapshots__/repro47-endpoint-obstacle-detour.snap.svg +1 -1
- package/tests/repros/assets/repro-example35-minimize-trace-crossing.input.json +1561 -0
- package/tests/repros/assets/repro-tps61222-trace-intersection.input.json +200 -0
- package/tests/repros/repro-example35-minimize-trace-crossing.test.ts +22 -0
- package/tests/repros/repro-tps61222-trace-intersection.test.ts +14 -0
- package/tests/repros/repro47-endpoint-obstacle-detour.test.ts +6 -0
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chips": [
|
|
3
|
+
{
|
|
4
|
+
"chipId": "schematic_component_0",
|
|
5
|
+
"center": {
|
|
6
|
+
"x": 0,
|
|
7
|
+
"y": 0
|
|
8
|
+
},
|
|
9
|
+
"width": 2.5,
|
|
10
|
+
"height": 1,
|
|
11
|
+
"pins": [
|
|
12
|
+
{
|
|
13
|
+
"pinId": "U2.1",
|
|
14
|
+
"x": 1.65,
|
|
15
|
+
"y": 0.09999999999999998,
|
|
16
|
+
"_facingDirection": "x+"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
"pinId": "U2.2",
|
|
20
|
+
"x": -1.65,
|
|
21
|
+
"y": -0.1,
|
|
22
|
+
"_facingDirection": "x-"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"pinId": "U2.3",
|
|
26
|
+
"x": 1.65,
|
|
27
|
+
"y": -0.30000000000000004,
|
|
28
|
+
"_facingDirection": "x+"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"pinId": "U2.4",
|
|
32
|
+
"x": -1.65,
|
|
33
|
+
"y": 0.1,
|
|
34
|
+
"_facingDirection": "x-"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"pinId": "U2.5",
|
|
38
|
+
"x": 1.65,
|
|
39
|
+
"y": 0.30000000000000004,
|
|
40
|
+
"_facingDirection": "x+"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"pinId": "U2.6",
|
|
44
|
+
"x": 1.65,
|
|
45
|
+
"y": -0.10000000000000003,
|
|
46
|
+
"_facingDirection": "x+"
|
|
47
|
+
}
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"chipId": "schematic_component_1",
|
|
52
|
+
"center": {
|
|
53
|
+
"x": 4.1,
|
|
54
|
+
"y": 1.3
|
|
55
|
+
},
|
|
56
|
+
"width": 1.0555194999999995,
|
|
57
|
+
"height": 0.8677407000000001,
|
|
58
|
+
"pins": [
|
|
59
|
+
{
|
|
60
|
+
"pinId": "L4.1",
|
|
61
|
+
"x": 3.5720874999999994,
|
|
62
|
+
"y": 1.3026245499999998,
|
|
63
|
+
"_facingDirection": "x-"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"pinId": "L4.2",
|
|
67
|
+
"x": 4.6279125,
|
|
68
|
+
"y": 1.2973754500000003,
|
|
69
|
+
"_facingDirection": "x+"
|
|
70
|
+
}
|
|
71
|
+
]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"chipId": "schematic_component_2",
|
|
75
|
+
"center": {
|
|
76
|
+
"x": -4.327500000000001,
|
|
77
|
+
"y": 0
|
|
78
|
+
},
|
|
79
|
+
"width": 1.0450000000000004,
|
|
80
|
+
"height": 0.76,
|
|
81
|
+
"pins": [
|
|
82
|
+
{
|
|
83
|
+
"pinId": "C25.1",
|
|
84
|
+
"x": -4.4,
|
|
85
|
+
"y": 0.3,
|
|
86
|
+
"_facingDirection": "y+"
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"pinId": "C25.2",
|
|
90
|
+
"x": -4.4,
|
|
91
|
+
"y": -0.3,
|
|
92
|
+
"_facingDirection": "y-"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"chipId": "schematic_component_3",
|
|
98
|
+
"center": {
|
|
99
|
+
"x": 6.0725,
|
|
100
|
+
"y": 0
|
|
101
|
+
},
|
|
102
|
+
"width": 1.0450000000000008,
|
|
103
|
+
"height": 0.76,
|
|
104
|
+
"pins": [
|
|
105
|
+
{
|
|
106
|
+
"pinId": "C26.1",
|
|
107
|
+
"x": 6,
|
|
108
|
+
"y": 0.3,
|
|
109
|
+
"_facingDirection": "y+"
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"pinId": "C26.2",
|
|
113
|
+
"x": 6,
|
|
114
|
+
"y": -0.3,
|
|
115
|
+
"_facingDirection": "y-"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
],
|
|
120
|
+
"directConnections": [],
|
|
121
|
+
"netConnections": [
|
|
122
|
+
{
|
|
123
|
+
"netId": "VIN_3V3",
|
|
124
|
+
"pinIds": [
|
|
125
|
+
"U2.1",
|
|
126
|
+
"U2.6",
|
|
127
|
+
"L4.2",
|
|
128
|
+
"C26.1"
|
|
129
|
+
],
|
|
130
|
+
"netLabelWidth": 0.42,
|
|
131
|
+
"netLabelHeight": 0.96
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"netId": "VIN_5V",
|
|
135
|
+
"pinIds": [
|
|
136
|
+
"U2.2",
|
|
137
|
+
"U2.4",
|
|
138
|
+
"C25.1"
|
|
139
|
+
],
|
|
140
|
+
"netLabelWidth": 0.42,
|
|
141
|
+
"netLabelHeight": 0.84
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"netId": "GND",
|
|
145
|
+
"pinIds": [
|
|
146
|
+
"U2.3",
|
|
147
|
+
"C25.2",
|
|
148
|
+
"C26.2"
|
|
149
|
+
],
|
|
150
|
+
"netLabelWidth": 0.42,
|
|
151
|
+
"netLabelHeight": 0.48
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
"netId": "BOOST_SW",
|
|
155
|
+
"pinIds": [
|
|
156
|
+
"U2.5",
|
|
157
|
+
"L4.1"
|
|
158
|
+
],
|
|
159
|
+
"netLabelWidth": 1.08
|
|
160
|
+
}
|
|
161
|
+
],
|
|
162
|
+
"textBoxes": [
|
|
163
|
+
{
|
|
164
|
+
"chipId": "schematic_component_0",
|
|
165
|
+
"center": {
|
|
166
|
+
"x": -0.53,
|
|
167
|
+
"y": -0.63
|
|
168
|
+
},
|
|
169
|
+
"width": 1.44,
|
|
170
|
+
"height": 0.17999999999999994,
|
|
171
|
+
"text": "TPS61222DCKT"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"chipId": "schematic_component_0",
|
|
175
|
+
"center": {
|
|
176
|
+
"x": -1.13,
|
|
177
|
+
"y": 0.615
|
|
178
|
+
},
|
|
179
|
+
"width": 0.3600000000000001,
|
|
180
|
+
"height": 0.25,
|
|
181
|
+
"text": "U2"
|
|
182
|
+
}
|
|
183
|
+
],
|
|
184
|
+
"availableNetLabelOrientations": {
|
|
185
|
+
"VIN_3V3": [
|
|
186
|
+
"y+"
|
|
187
|
+
],
|
|
188
|
+
"VIN_5V": [
|
|
189
|
+
"y+"
|
|
190
|
+
],
|
|
191
|
+
"GND": [
|
|
192
|
+
"y-"
|
|
193
|
+
],
|
|
194
|
+
"BOOST_SW": [
|
|
195
|
+
"x-",
|
|
196
|
+
"x+"
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"maxMspPairDistance": 20
|
|
200
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import inputProblem from "./assets/repro-example35-minimize-trace-crossing.input.json"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
|
|
6
|
+
test("example35 keeps capacitor-chain zig-zags aligned with same-net branches", () => {
|
|
7
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
8
|
+
|
|
9
|
+
solver.solve()
|
|
10
|
+
|
|
11
|
+
const trace = solver
|
|
12
|
+
.netLabelTraceCollisionSolver!.getOutput()
|
|
13
|
+
.traces.find((candidate) => candidate.mspPairId === "C5.1-C4.2")
|
|
14
|
+
|
|
15
|
+
expect(trace?.tracePath).toEqual([
|
|
16
|
+
{ x: -4, y: -2.6199999999999997 },
|
|
17
|
+
{ x: -4, y: -1.9999999999999996 },
|
|
18
|
+
{ x: -3, y: -1.9999999999999996 },
|
|
19
|
+
{ x: -3, y: -1.38 },
|
|
20
|
+
])
|
|
21
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
22
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import "tests/fixtures/matcher"
|
|
4
|
+
import inputProblem from "./assets/repro-tps61222-trace-intersection.input.json"
|
|
5
|
+
|
|
6
|
+
// Extracted from https://github.com/tscircuit/core/pull/2785 with
|
|
7
|
+
// DEBUG=Group_doInitialSchematicTraceRender.
|
|
8
|
+
test("repro TPS61222 schematic trace intersection", () => {
|
|
9
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
10
|
+
|
|
11
|
+
solver.solve()
|
|
12
|
+
|
|
13
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
14
|
+
})
|
|
@@ -44,6 +44,12 @@ test("repro47: endpoint obstacle detours route around nearby components", () =>
|
|
|
44
44
|
traceById.get("R2.1-R3.2")!.tracePath,
|
|
45
45
|
),
|
|
46
46
|
).toBe(0)
|
|
47
|
+
expect(
|
|
48
|
+
countPathIntersections(
|
|
49
|
+
traceById.get("R2.1-R3.2")!.tracePath,
|
|
50
|
+
traceById.get("R2.2-R3.1")!.tracePath,
|
|
51
|
+
),
|
|
52
|
+
).toBe(0)
|
|
47
53
|
|
|
48
54
|
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
49
55
|
})
|