@tscircuit/schematic-trace-solver 0.0.125 → 0.0.127
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/README.md +28 -0
- package/dist/index.d.ts +159 -2
- package/dist/index.js +739 -36
- package/lib/index.ts +2 -0
- package/lib/solvers/InlineNetLabelSolver/InlineNetLabelSolver.ts +424 -0
- package/lib/solvers/InlineNetLabelSolver/getAxisAlignedSegments.ts +73 -0
- package/lib/solvers/NetLabelTraceCollisionSolver/NetLabelTraceCollisionSolver.ts +15 -0
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +86 -11
- package/lib/solvers/TraceElbowTransitionSimplificationSolver/TraceElbowTransitionSimplificationSolver.ts +216 -0
- package/lib/solvers/TraceElbowTransitionSimplificationSolver/generateElbowTransitionSimplificationCandidates.ts +186 -0
- package/lib/solvers/TraceElbowTransitionSimplificationSolver/types.ts +10 -0
- package/lib/solvers/TraceLabelOverlapAvoidanceSolver/TraceLabelOverlapAvoidanceSolver.ts +3 -0
- package/lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/OverlapAvoidanceStepSolver/OverlapAvoidanceStepSolver.ts +16 -0
- package/lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/SingleOverlapSolver/SingleOverlapSolver.ts +56 -13
- package/lib/types/InputProblem.ts +24 -0
- package/package.json +1 -1
- package/site/bug-reports/bug-report-20260806T093501Z.page.tsx +4 -0
- package/site/examples/inline-net-label01.page.tsx +6 -0
- package/tests/assets/inline-net-label01.json +47 -0
- package/tests/bug-reports/bug-report-20260706T213649Z/__snapshots__/bug-report-20260706T213649Z.snap.svg +3 -3
- package/tests/bug-reports/bug-report-20260706T220324Z/__snapshots__/bug-report-20260706T220324Z.snap.svg +6 -6
- package/tests/bug-reports/bug-report-20260806T093501Z/__snapshots__/bug-report-20260806T093501Z.snap.svg +135 -0
- package/tests/bug-reports/bug-report-20260806T093501Z/bug-report-20260806T093501Z.json +505 -0
- package/tests/bug-reports/bug-report-20260806T093501Z/bug-report-20260806T093501Z.test.ts +66 -0
- package/tests/examples/__snapshots__/example33.snap.svg +1 -1
- package/tests/functions/getAxisAlignedSegments.test.ts +56 -0
- package/tests/solvers/InlineNetLabelSolver/__snapshots__/inline-net-label01.snap.svg +54 -0
- package/tests/solvers/InlineNetLabelSolver/inline-net-label01.test.ts +44 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chips": [
|
|
3
|
+
{
|
|
4
|
+
"chipId": "schematic_component_0",
|
|
5
|
+
"center": {
|
|
6
|
+
"x": -8,
|
|
7
|
+
"y": 0
|
|
8
|
+
},
|
|
9
|
+
"width": 6,
|
|
10
|
+
"height": 6.6,
|
|
11
|
+
"pins": [
|
|
12
|
+
{
|
|
13
|
+
"pinId": "schematic_port_0",
|
|
14
|
+
"x": -8.1,
|
|
15
|
+
"y": 3.3
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"pinId": "schematic_port_1",
|
|
19
|
+
"x": -8.3,
|
|
20
|
+
"y": 3.3
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"pinId": "schematic_port_2",
|
|
24
|
+
"x": -8.5,
|
|
25
|
+
"y": 3.3
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"pinId": "schematic_port_3",
|
|
29
|
+
"x": -8.9,
|
|
30
|
+
"y": 3.3
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"pinId": "schematic_port_4",
|
|
34
|
+
"x": -8.7,
|
|
35
|
+
"y": 3.3
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"pinId": "schematic_port_5",
|
|
39
|
+
"x": -5,
|
|
40
|
+
"y": 0.7999999999999999
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"pinId": "schematic_port_6",
|
|
44
|
+
"x": -5,
|
|
45
|
+
"y": 0.6
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"pinId": "schematic_port_7",
|
|
49
|
+
"x": -5,
|
|
50
|
+
"y": 0.4
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
"pinId": "schematic_port_8",
|
|
54
|
+
"x": -8.6,
|
|
55
|
+
"y": -3.3
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"pinId": "schematic_port_9",
|
|
59
|
+
"x": -8.4,
|
|
60
|
+
"y": -3.3
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"pinId": "schematic_port_10",
|
|
64
|
+
"x": -8,
|
|
65
|
+
"y": -3.3
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"pinId": "schematic_port_11",
|
|
69
|
+
"x": -8.2,
|
|
70
|
+
"y": -3.3
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"pinId": "schematic_port_12",
|
|
74
|
+
"x": -5,
|
|
75
|
+
"y": -0.19999999999999984
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"pinId": "schematic_port_13",
|
|
79
|
+
"x": -5,
|
|
80
|
+
"y": 1.1102230246251565e-16
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"pinId": "schematic_port_14",
|
|
84
|
+
"x": -5,
|
|
85
|
+
"y": 0.20000000000000007
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"pinId": "schematic_port_15",
|
|
89
|
+
"x": -5,
|
|
90
|
+
"y": -0.3999999999999999
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"pinId": "schematic_port_16",
|
|
94
|
+
"x": -5,
|
|
95
|
+
"y": -0.5999999999999999
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"pinId": "schematic_port_17",
|
|
99
|
+
"x": -5,
|
|
100
|
+
"y": -0.7999999999999999
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"pinId": "schematic_port_18",
|
|
104
|
+
"x": -7.8,
|
|
105
|
+
"y": -3.3
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"pinId": "schematic_port_19",
|
|
109
|
+
"x": -7.6,
|
|
110
|
+
"y": -3.3
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"pinId": "schematic_port_20",
|
|
114
|
+
"x": -7,
|
|
115
|
+
"y": -3.3
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"pinId": "schematic_port_21",
|
|
119
|
+
"x": -7.2,
|
|
120
|
+
"y": -3.3
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"pinId": "schematic_port_22",
|
|
124
|
+
"x": -7.4,
|
|
125
|
+
"y": -3.3
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"pinId": "schematic_port_23",
|
|
129
|
+
"x": -6.8,
|
|
130
|
+
"y": -3.3
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"pinId": "schematic_port_24",
|
|
134
|
+
"x": -11,
|
|
135
|
+
"y": -0.7999999999999999
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"pinId": "schematic_port_25",
|
|
139
|
+
"x": -7.7,
|
|
140
|
+
"y": 3.3
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"pinId": "schematic_port_26",
|
|
144
|
+
"x": -7.3,
|
|
145
|
+
"y": 3.3
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
"pinId": "schematic_port_27",
|
|
149
|
+
"x": -7.1,
|
|
150
|
+
"y": 3.3
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"pinId": "schematic_port_28",
|
|
154
|
+
"x": -7.5,
|
|
155
|
+
"y": 3.3
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"pinId": "schematic_port_29",
|
|
159
|
+
"x": -11,
|
|
160
|
+
"y": -0.4
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
"pinId": "schematic_port_30",
|
|
164
|
+
"x": -11,
|
|
165
|
+
"y": -0.6
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
"pinId": "schematic_port_31",
|
|
169
|
+
"x": -8.8,
|
|
170
|
+
"y": -3.3
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"pinId": "schematic_port_32",
|
|
174
|
+
"x": -7.9,
|
|
175
|
+
"y": 3.3
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"pinId": "schematic_port_33",
|
|
179
|
+
"x": -11,
|
|
180
|
+
"y": 0.7999999999999999
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"pinId": "schematic_port_34",
|
|
184
|
+
"x": -11,
|
|
185
|
+
"y": 0.5999999999999999
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"pinId": "schematic_port_35",
|
|
189
|
+
"x": -11,
|
|
190
|
+
"y": 0.3999999999999999
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"pinId": "schematic_port_36",
|
|
194
|
+
"x": -11,
|
|
195
|
+
"y": 0.19999999999999984
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"pinId": "schematic_port_37",
|
|
199
|
+
"x": -11,
|
|
200
|
+
"y": -1.1102230246251565e-16
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"pinId": "schematic_port_38",
|
|
204
|
+
"x": -11,
|
|
205
|
+
"y": -0.20000000000000007
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
"pinId": "schematic_port_39",
|
|
209
|
+
"x": -9.2,
|
|
210
|
+
"y": -3.3
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"pinId": "schematic_port_40",
|
|
214
|
+
"x": -9,
|
|
215
|
+
"y": -3.3
|
|
216
|
+
}
|
|
217
|
+
]
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"chipId": "schematic_component_1",
|
|
221
|
+
"center": {
|
|
222
|
+
"x": -11.6275,
|
|
223
|
+
"y": 6.5
|
|
224
|
+
},
|
|
225
|
+
"width": 1.6449999999999996,
|
|
226
|
+
"height": 0.7599999999999998,
|
|
227
|
+
"pins": [
|
|
228
|
+
{
|
|
229
|
+
"pinId": "schematic_port_41",
|
|
230
|
+
"x": -12,
|
|
231
|
+
"y": 6.88,
|
|
232
|
+
"_facingDirection": "y+"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"pinId": "schematic_port_42",
|
|
236
|
+
"x": -12,
|
|
237
|
+
"y": 6.12,
|
|
238
|
+
"_facingDirection": "y-"
|
|
239
|
+
}
|
|
240
|
+
]
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"chipId": "schematic_component_2",
|
|
244
|
+
"center": {
|
|
245
|
+
"x": -9.8075,
|
|
246
|
+
"y": -6.5
|
|
247
|
+
},
|
|
248
|
+
"width": 1.2850000000000001,
|
|
249
|
+
"height": 0.7599999999999998,
|
|
250
|
+
"pins": [
|
|
251
|
+
{
|
|
252
|
+
"pinId": "schematic_port_43",
|
|
253
|
+
"x": -10,
|
|
254
|
+
"y": -6.12,
|
|
255
|
+
"_facingDirection": "y+"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"pinId": "schematic_port_44",
|
|
259
|
+
"x": -10,
|
|
260
|
+
"y": -6.88,
|
|
261
|
+
"_facingDirection": "y-"
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"chipId": "schematic_component_3",
|
|
267
|
+
"center": {
|
|
268
|
+
"x": -7.927499999999999,
|
|
269
|
+
"y": 6.5
|
|
270
|
+
},
|
|
271
|
+
"width": 1.045,
|
|
272
|
+
"height": 0.7599999999999998,
|
|
273
|
+
"pins": [
|
|
274
|
+
{
|
|
275
|
+
"pinId": "schematic_port_45",
|
|
276
|
+
"x": -8,
|
|
277
|
+
"y": 6.88,
|
|
278
|
+
"_facingDirection": "y+"
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
"pinId": "schematic_port_46",
|
|
282
|
+
"x": -8,
|
|
283
|
+
"y": 6.12,
|
|
284
|
+
"_facingDirection": "y-"
|
|
285
|
+
}
|
|
286
|
+
]
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"chipId": "schematic_component_4",
|
|
290
|
+
"center": {
|
|
291
|
+
"x": -3.8674999999999997,
|
|
292
|
+
"y": 6.5
|
|
293
|
+
},
|
|
294
|
+
"width": 1.1650000000000005,
|
|
295
|
+
"height": 0.7599999999999998,
|
|
296
|
+
"pins": [
|
|
297
|
+
{
|
|
298
|
+
"pinId": "schematic_port_47",
|
|
299
|
+
"x": -4,
|
|
300
|
+
"y": 6.88,
|
|
301
|
+
"_facingDirection": "y+"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"pinId": "schematic_port_48",
|
|
305
|
+
"x": -4,
|
|
306
|
+
"y": 6.12,
|
|
307
|
+
"_facingDirection": "y-"
|
|
308
|
+
}
|
|
309
|
+
]
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
"chipId": "schematic_component_5",
|
|
313
|
+
"center": {
|
|
314
|
+
"x": -7.785,
|
|
315
|
+
"y": -8.5
|
|
316
|
+
},
|
|
317
|
+
"width": 1.3299999999999992,
|
|
318
|
+
"height": 0.6000000000000014,
|
|
319
|
+
"pins": [
|
|
320
|
+
{
|
|
321
|
+
"pinId": "schematic_port_49",
|
|
322
|
+
"x": -8,
|
|
323
|
+
"y": -8.2,
|
|
324
|
+
"_facingDirection": "y+"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
"pinId": "schematic_port_50",
|
|
328
|
+
"x": -8,
|
|
329
|
+
"y": -8.8,
|
|
330
|
+
"_facingDirection": "y-"
|
|
331
|
+
}
|
|
332
|
+
]
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"chipId": "schematic_component_6",
|
|
336
|
+
"center": {
|
|
337
|
+
"x": -4.665,
|
|
338
|
+
"y": -8.5
|
|
339
|
+
},
|
|
340
|
+
"width": 1.5700000000000003,
|
|
341
|
+
"height": 0.6000000000000014,
|
|
342
|
+
"pins": [
|
|
343
|
+
{
|
|
344
|
+
"pinId": "schematic_port_51",
|
|
345
|
+
"x": -5,
|
|
346
|
+
"y": -8.2,
|
|
347
|
+
"_facingDirection": "y+"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"pinId": "schematic_port_52",
|
|
351
|
+
"x": -5,
|
|
352
|
+
"y": -8.8,
|
|
353
|
+
"_facingDirection": "y-"
|
|
354
|
+
}
|
|
355
|
+
]
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
"chipId": "schematic_component_7",
|
|
359
|
+
"center": {
|
|
360
|
+
"x": -1.8450000000000002,
|
|
361
|
+
"y": -8.5
|
|
362
|
+
},
|
|
363
|
+
"width": 1.21,
|
|
364
|
+
"height": 0.6000000000000014,
|
|
365
|
+
"pins": [
|
|
366
|
+
{
|
|
367
|
+
"pinId": "schematic_port_53",
|
|
368
|
+
"x": -2,
|
|
369
|
+
"y": -8.2,
|
|
370
|
+
"_facingDirection": "y+"
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
"pinId": "schematic_port_54",
|
|
374
|
+
"x": -2,
|
|
375
|
+
"y": -8.8,
|
|
376
|
+
"_facingDirection": "y-"
|
|
377
|
+
}
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
],
|
|
381
|
+
"directConnections": [
|
|
382
|
+
{
|
|
383
|
+
"netId": ".C_GATE_VM > .pin1 to .U_GATE > .VM",
|
|
384
|
+
"netLabelWidth": 0.36,
|
|
385
|
+
"pinIds": [
|
|
386
|
+
"schematic_port_41",
|
|
387
|
+
"schematic_port_3"
|
|
388
|
+
]
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
"netId": ".C_CP > .pin1 to .U_GATE > .CPH",
|
|
392
|
+
"netLabelWidth": 1.32,
|
|
393
|
+
"pinIds": [
|
|
394
|
+
"schematic_port_45",
|
|
395
|
+
"schematic_port_1"
|
|
396
|
+
]
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"netId": ".C_CP > .pin2 to .U_GATE > .CPL",
|
|
400
|
+
"netLabelWidth": 1.32,
|
|
401
|
+
"pinIds": [
|
|
402
|
+
"schematic_port_46",
|
|
403
|
+
"schematic_port_0"
|
|
404
|
+
]
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
"netId": ".C_VCP > .pin1 to .U_GATE > .VCP",
|
|
408
|
+
"netLabelWidth": 1.32,
|
|
409
|
+
"pinIds": [
|
|
410
|
+
"schematic_port_47",
|
|
411
|
+
"schematic_port_2"
|
|
412
|
+
]
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"netId": ".C_DVDD > .pin1 to .U_GATE > .DVDD",
|
|
416
|
+
"netLabelWidth": 1.44,
|
|
417
|
+
"pinIds": [
|
|
418
|
+
"schematic_port_43",
|
|
419
|
+
"schematic_port_32"
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
"netId": ".U_GATE > .GAIN to .R_GAIN > .pin1",
|
|
424
|
+
"netLabelWidth": 1.44,
|
|
425
|
+
"pinIds": [
|
|
426
|
+
"schematic_port_28",
|
|
427
|
+
"schematic_port_49"
|
|
428
|
+
]
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"netId": ".U_GATE > .IDRIVE to .R_IDRIVE > .pin1",
|
|
432
|
+
"netLabelWidth": 1.68,
|
|
433
|
+
"pinIds": [
|
|
434
|
+
"schematic_port_26",
|
|
435
|
+
"schematic_port_51"
|
|
436
|
+
]
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
"netId": ".U_GATE > .VDS to .R_VDS > .pin1",
|
|
440
|
+
"netLabelWidth": 1.32,
|
|
441
|
+
"pinIds": [
|
|
442
|
+
"schematic_port_27",
|
|
443
|
+
"schematic_port_53"
|
|
444
|
+
]
|
|
445
|
+
}
|
|
446
|
+
],
|
|
447
|
+
"netConnections": [
|
|
448
|
+
{
|
|
449
|
+
"netId": "VM",
|
|
450
|
+
"netLabelWidth": 0.42,
|
|
451
|
+
"netLabelHeight": 0.36,
|
|
452
|
+
"pinIds": [
|
|
453
|
+
"schematic_port_3",
|
|
454
|
+
"schematic_port_4",
|
|
455
|
+
"schematic_port_41",
|
|
456
|
+
"schematic_port_48"
|
|
457
|
+
]
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
"netId": "GND",
|
|
461
|
+
"netLabelWidth": 0.42,
|
|
462
|
+
"netLabelHeight": 0.48,
|
|
463
|
+
"pinIds": [
|
|
464
|
+
"schematic_port_25",
|
|
465
|
+
"schematic_port_42",
|
|
466
|
+
"schematic_port_44",
|
|
467
|
+
"schematic_port_50",
|
|
468
|
+
"schematic_port_52",
|
|
469
|
+
"schematic_port_54"
|
|
470
|
+
]
|
|
471
|
+
}
|
|
472
|
+
],
|
|
473
|
+
"textBoxes": [
|
|
474
|
+
{
|
|
475
|
+
"chipId": "schematic_component_0",
|
|
476
|
+
"center": {
|
|
477
|
+
"x": -4.580000000000001,
|
|
478
|
+
"y": 3.25
|
|
479
|
+
},
|
|
480
|
+
"width": 1.44,
|
|
481
|
+
"height": 0.17999999999999972,
|
|
482
|
+
"text": "DRV8323HRTAR"
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
"chipId": "schematic_component_0",
|
|
486
|
+
"center": {
|
|
487
|
+
"x": -4.940000000000001,
|
|
488
|
+
"y": 3.0149999999999997
|
|
489
|
+
},
|
|
490
|
+
"width": 0.839999999999999,
|
|
491
|
+
"height": 0.24999999999999956,
|
|
492
|
+
"text": "U_GATE"
|
|
493
|
+
}
|
|
494
|
+
],
|
|
495
|
+
"availableNetLabelOrientations": {
|
|
496
|
+
"GND": [
|
|
497
|
+
"y-"
|
|
498
|
+
],
|
|
499
|
+
"VM": [
|
|
500
|
+
"y+"
|
|
501
|
+
]
|
|
502
|
+
},
|
|
503
|
+
"maxMspPairDistance": 2.4,
|
|
504
|
+
"_hideRatsNet": false
|
|
505
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import { detectTraceLabelOverlap } from "lib/solvers/TraceLabelOverlapAvoidanceSolver/detectTraceLabelOverlap"
|
|
4
|
+
import inputProblem from "./bug-report-20260806T093501Z.json"
|
|
5
|
+
import "tests/fixtures/matcher"
|
|
6
|
+
|
|
7
|
+
test("bug-report-20260806T093501Z", () => {
|
|
8
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
9
|
+
|
|
10
|
+
solver.solve()
|
|
11
|
+
|
|
12
|
+
const vmRailTrace = solver
|
|
13
|
+
.sameNetJunctionAlignmentSolver!.getOutput()
|
|
14
|
+
.traces.find(
|
|
15
|
+
(trace) => trace.mspPairId === "schematic_port_41-schematic_port_48",
|
|
16
|
+
)
|
|
17
|
+
expect(vmRailTrace).toBeDefined()
|
|
18
|
+
|
|
19
|
+
const vmRailTraceLength = vmRailTrace!.tracePath.reduce(
|
|
20
|
+
(length, point, pointIndex, tracePath) => {
|
|
21
|
+
if (pointIndex === 0) return length
|
|
22
|
+
const previousPoint = tracePath[pointIndex - 1]!
|
|
23
|
+
return (
|
|
24
|
+
length +
|
|
25
|
+
Math.abs(point.x - previousPoint.x) +
|
|
26
|
+
Math.abs(point.y - previousPoint.y)
|
|
27
|
+
)
|
|
28
|
+
},
|
|
29
|
+
0,
|
|
30
|
+
)
|
|
31
|
+
expect(vmRailTraceLength).toBeCloseTo(12.002)
|
|
32
|
+
expect(vmRailTrace!.tracePath).toEqual([
|
|
33
|
+
{ x: -12, y: 6.88 },
|
|
34
|
+
{ x: -12, y: 8.301 },
|
|
35
|
+
{ x: -5.9, y: 8.301 },
|
|
36
|
+
{ x: -5.9, y: 5.920000000000001 },
|
|
37
|
+
{ x: -4, y: 5.920000000000001 },
|
|
38
|
+
{ x: -4, y: 6.12 },
|
|
39
|
+
])
|
|
40
|
+
|
|
41
|
+
const groundTrace = solver
|
|
42
|
+
.sameNetJunctionAlignmentSolver!.getOutput()
|
|
43
|
+
.traces.find(
|
|
44
|
+
(trace) => trace.mspPairId === "schematic_port_25-schematic_port_42",
|
|
45
|
+
)
|
|
46
|
+
expect(groundTrace?.tracePath).toEqual([
|
|
47
|
+
{ x: -7.7, y: 3.299999999999999 },
|
|
48
|
+
{ x: -7.7, y: 4.840999999999999 },
|
|
49
|
+
{ x: -8.699999999999998, y: 4.840999999999999 },
|
|
50
|
+
{ x: -8.699999999999998, y: 4.71 },
|
|
51
|
+
{ x: -12, y: 4.71 },
|
|
52
|
+
{ x: -12, y: 6.12 },
|
|
53
|
+
])
|
|
54
|
+
|
|
55
|
+
const finalOutput = solver.sameNetJunctionAlignmentSolver!.getOutput()
|
|
56
|
+
expect(
|
|
57
|
+
detectTraceLabelOverlap({
|
|
58
|
+
traces: finalOutput.traces,
|
|
59
|
+
netLabels: finalOutput.netLabelPlacements,
|
|
60
|
+
}).map(({ trace, label }) => `${trace.mspPairId}->${label.netId}`),
|
|
61
|
+
).toEqual([
|
|
62
|
+
"schematic_port_25-schematic_port_42->.C_CP > .pin2 to .U_GATE > .CPL",
|
|
63
|
+
])
|
|
64
|
+
|
|
65
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
66
|
+
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="white"/><g><polyline data-points="-1.95,-6.6 1.5225,-8.5" data-type="line" data-label="" points="102.39751311443555,200.26423159121816 480.2098309694967,406.98659413250437" fill="none" stroke="hsl(154, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-0.8499999999999999,-6.6 -1.5225,-8.700000000000001" data-type="line" data-label="" points="222.07888090149598,200.26423159121816 148.91004468622495,428.7468428210609" fill="none" stroke="hsl(172, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-1.95,-6.6 -2.15,-6.6 -2.15,-7.
|
|
1
|
+
<svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="white"/><g><polyline data-points="-1.95,-6.6 1.5225,-8.5" data-type="line" data-label="" points="102.39751311443555,200.26423159121816 480.2098309694967,406.98659413250437" fill="none" stroke="hsl(154, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-0.8499999999999999,-6.6 -1.5225,-8.700000000000001" data-type="line" data-label="" points="222.07888090149598,200.26423159121816 148.91004468622495,428.7468428210609" fill="none" stroke="hsl(172, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-1.95,-6.6 -2.15,-6.6 -2.15,-7.25 2.6235,-7.25 2.6235,-8.5 1.5225000000000002,-8.5" data-type="line" data-label="" points="102.39751311443555,200.26423159121816 80.63726442587912,200.26423159121816 80.63726442587912,270.9850398290266 600,270.9850398290266 600,406.98659413250437 480.20983096949675,406.98659413250437" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="1.5225,-8.700000000000001 1.6235,-8.700000000000001 1.6235,-8.901" data-type="line" data-label="" points="480.2098309694967,428.7468428210609 491.19875655721773,428.7468428210609 491.19875655721773,450.61589275306005" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="schematic_component_0" data-x="-1.4" data-y="-6.6" x="102.39751311443555" y="179.10724771711682" width="119.68136778706042" height="42.313967748202685" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009191071428571429"/></g><g><rect data-type="rect" data-label="schematic_component_1" data-x="0" data-y="-8.4" x="148.91004468622498" y="341.705848066835" width="331.2997862832717" height="108.80124344278227" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009191071428571429"/></g><g><rect data-type="rect" data-label="netId: V3V3
|
|
2
2
|
globalConnNetId: connectivity_net0" data-x="-2.15" data-y="-6.3999999999999995" x="69.7571400816009" y="156.7437342141053" width="21.76024868855646" height="43.52049737711286" fill="#ef444466" stroke="#ef4444" stroke-width="0.009191071428571429"/></g><g><rect data-type="rect" data-label="netId: QSPI_CS
|
|
3
3
|
globalConnNetId: connectivity_net1" data-x="-0.4989999999999999" data-y="-6.6" x="222.18768214493878" y="189.38410724693995" width="76.1608704099475" height="21.76024868855643" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009191071428571429"/></g><g><rect data-type="rect" data-label="netId: QSPI_CS
|
|
4
4
|
globalConnNetId: connectivity_net1" data-x="-1.8735" data-y="-8.700000000000001" x="72.64037303283462" y="417.86671847678275" width="76.16087040994756" height="21.760248688556317" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009191071428571429"/></g><g><rect data-type="rect" data-label="netId: QSPI_SCK
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { getAxisAlignedSegments } from "lib/solvers/InlineNetLabelSolver/getAxisAlignedSegments"
|
|
3
|
+
|
|
4
|
+
test("getAxisAlignedSegments returns runs longest first", () => {
|
|
5
|
+
const segments = getAxisAlignedSegments([
|
|
6
|
+
{ x: 0, y: 0 },
|
|
7
|
+
{ x: 1, y: 0 },
|
|
8
|
+
{ x: 1, y: 3 },
|
|
9
|
+
{ x: 2, y: 3 },
|
|
10
|
+
])
|
|
11
|
+
|
|
12
|
+
expect(segments.map((s) => [s.axis, s.length])).toEqual([
|
|
13
|
+
["y", 3],
|
|
14
|
+
["x", 1],
|
|
15
|
+
["x", 1],
|
|
16
|
+
])
|
|
17
|
+
expect(segments[0]).toMatchObject({
|
|
18
|
+
start: { x: 1, y: 0 },
|
|
19
|
+
end: { x: 1, y: 3 },
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test("getAxisAlignedSegments merges collinear points", () => {
|
|
24
|
+
const segments = getAxisAlignedSegments([
|
|
25
|
+
{ x: 0, y: 0 },
|
|
26
|
+
{ x: 1, y: 0 },
|
|
27
|
+
{ x: 2, y: 0 },
|
|
28
|
+
{ x: 2, y: 1 },
|
|
29
|
+
])
|
|
30
|
+
|
|
31
|
+
expect(segments.map((s) => [s.axis, s.length])).toEqual([
|
|
32
|
+
["x", 2],
|
|
33
|
+
["y", 1],
|
|
34
|
+
])
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
test("getAxisAlignedSegments splits a run that doubles back", () => {
|
|
38
|
+
const segments = getAxisAlignedSegments([
|
|
39
|
+
{ x: 0, y: 0 },
|
|
40
|
+
{ x: 3, y: 0 },
|
|
41
|
+
{ x: 1, y: 0 },
|
|
42
|
+
])
|
|
43
|
+
|
|
44
|
+
expect(segments.map((s) => s.length)).toEqual([3, 2])
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
test("getAxisAlignedSegments returns nothing for degenerate paths", () => {
|
|
48
|
+
expect(getAxisAlignedSegments([])).toEqual([])
|
|
49
|
+
expect(getAxisAlignedSegments([{ x: 0, y: 0 }])).toEqual([])
|
|
50
|
+
expect(
|
|
51
|
+
getAxisAlignedSegments([
|
|
52
|
+
{ x: 0, y: 0 },
|
|
53
|
+
{ x: 0, y: 0 },
|
|
54
|
+
]),
|
|
55
|
+
).toEqual([])
|
|
56
|
+
})
|