@tscircuit/schematic-trace-solver 0.0.41 → 0.0.42

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.
Files changed (46) hide show
  1. package/dist/index.d.ts +118 -7
  2. package/dist/index.js +760 -432
  3. package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +30 -17
  4. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/TraceLabelOverlapAvoidanceSolver.ts +94 -192
  5. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/rerouteCollidingTrace.ts +13 -24
  6. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/LabelMergingSolver/LabelMergingSolver.ts +205 -0
  7. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/OverlapAvoidanceStepSolver/OverlapAvoidanceStepSolver.ts +144 -0
  8. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/SingleOverlapSolver/SingleOverlapSolver.ts +117 -0
  9. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/sub-solvers/TraceCleanupSolver/TraceCleanupSolver.ts +132 -0
  10. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{balanceLShapes.ts → sub-solvers/TraceCleanupSolver/balanceLShapes.ts} +12 -10
  11. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{hasCollisions.ts → sub-solvers/TraceCleanupSolver/hasCollisions.ts} +1 -1
  12. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{hasCollisionsWithLabels.ts → sub-solvers/TraceCleanupSolver/hasCollisionsWithLabels.ts} +1 -1
  13. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{minimizeTurnsWithFilteredLabels.ts → sub-solvers/TraceCleanupSolver/minimizeTurnsWithFilteredLabels.ts} +6 -6
  14. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{simplifyPath.ts → sub-solvers/TraceCleanupSolver/simplifyPath.ts} +1 -1
  15. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{turnMinimization.ts → sub-solvers/TraceCleanupSolver/turnMinimization.ts} +0 -2
  16. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/tryFourPointDetour.ts +104 -0
  17. package/lib/solvers/TraceLabelOverlapAvoidanceSolver/trySnipAndReconnect.ts +24 -154
  18. package/package.json +1 -1
  19. package/tests/assets/1.input.json +379 -0
  20. package/tests/assets/2.input.json +330 -0
  21. package/tests/assets/3.input.json +388 -0
  22. package/tests/assets/MergedNetLabelObstacles.test.input.json +154 -0
  23. package/tests/assets/OverlapAvoidanceStepSolver.test.input.json +682 -0
  24. package/tests/assets/SingleOverlapSolver.test.input.json +170 -0
  25. package/tests/assets/TraceCleanupSolver.test.input.json +216 -0
  26. package/tests/assets/TraceLabelOverlapAvoidanceSolver.test.input.json +424 -0
  27. package/tests/examples/__snapshots__/example25.snap.svg +3 -3
  28. package/tests/examples/__snapshots__/example26.snap.svg +3 -3
  29. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/TraceLabelOverlapAvoidanceSolver.test.ts +18 -0
  30. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/__snapshots__/TraceLabelOverlapAvoidanceSolver.snap.svg +243 -0
  31. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/renderComparisonView/__snapshots__/renderComparisonView01.snap.svg +223 -0
  32. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/renderComparisonView/__snapshots__/renderComparisonView02.snap.svg +205 -0
  33. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/renderComparisonView/__snapshots__/renderComparisonView03.snap.svg +184 -0
  34. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/renderComparisonView/renderComparisonView01.test.ts +29 -0
  35. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/renderComparisonView/renderComparisonView02.test.ts +27 -0
  36. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/renderComparisonView/renderComparisonView03.test.ts +39 -0
  37. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/MergedNetLabelObstacles.test.ts +14 -0
  38. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/OverlapAvoidanceStepSolver.test.ts +20 -0
  39. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/SingleOverlapSolver.test.ts +10 -0
  40. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/TraceCleanupSolver.test.ts +19 -0
  41. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/MergedNetLabelObstacles.snap.svg +140 -0
  42. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/OverlapAvoidanceStepSolver.snap.svg +216 -0
  43. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/SingleOverlapSolver.snap.svg +125 -0
  44. package/tests/solvers/TraceLabelOverlapAvoidanceSolver/sub-solver/__snapshots__/TraceCleanupSolver.snap.svg +119 -0
  45. /package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{countTurns.ts → sub-solvers/TraceCleanupSolver/countTurns.ts} +0 -0
  46. /package/lib/solvers/TraceLabelOverlapAvoidanceSolver/{tryConnectPoints.ts → sub-solvers/TraceCleanupSolver/tryConnectPoints.ts} +0 -0
@@ -0,0 +1,424 @@
1
+ {
2
+ "netLabelPlacements": [
3
+ {
4
+ "globalConnNetId": "connectivity_net0",
5
+ "dcConnNetId": "connectivity_net0",
6
+ "netId": ".V1 > .pin1 to .L1 > .pin1",
7
+ "mspConnectionPairIds": ["V1.1-L1.1"],
8
+ "pinIds": ["V1.1", "L1.1"],
9
+ "orientation": "x+",
10
+ "anchorPoint": {
11
+ "x": -5.005,
12
+ "y": 2.7600000000000002
13
+ },
14
+ "width": 0.45,
15
+ "height": 0.2,
16
+ "center": {
17
+ "x": -4.78,
18
+ "y": 2.7600000000000002
19
+ }
20
+ },
21
+ {
22
+ "globalConnNetId": "connectivity_net3",
23
+ "dcConnNetId": "connectivity_net3",
24
+ "netId": "GND",
25
+ "mspConnectionPairIds": ["C1.2-M1.2"],
26
+ "pinIds": ["C1.2", "M1.2"],
27
+ "orientation": "y-",
28
+ "anchorPoint": {
29
+ "x": 3,
30
+ "y": -0.78
31
+ },
32
+ "width": 0.2,
33
+ "height": 0.3,
34
+ "center": {
35
+ "x": 3,
36
+ "y": -0.93
37
+ }
38
+ },
39
+ {
40
+ "globalConnNetId": "connectivity_net3",
41
+ "netId": "GND",
42
+ "mspConnectionPairIds": [],
43
+ "pinIds": ["R1.2"],
44
+ "orientation": "y-",
45
+ "anchorPoint": {
46
+ "x": 6,
47
+ "y": -0.55
48
+ },
49
+ "width": 0.2,
50
+ "height": 0.3,
51
+ "center": {
52
+ "x": 6,
53
+ "y": -0.7010000000000001
54
+ }
55
+ },
56
+ {
57
+ "globalConnNetId": "connectivity_net3",
58
+ "dcConnNetId": "connectivity_net3",
59
+ "netId": "GND",
60
+ "mspConnectionPairIds": ["V1.2-V2.2"],
61
+ "pinIds": ["V1.2", "V2.2"],
62
+ "orientation": "y-",
63
+ "anchorPoint": {
64
+ "x": -4.995,
65
+ "y": -0.6458008
66
+ },
67
+ "width": 0.2,
68
+ "height": 0.3,
69
+ "center": {
70
+ "x": -4.995,
71
+ "y": -0.7958008
72
+ }
73
+ },
74
+ {
75
+ "globalConnNetId": "connectivity_net1",
76
+ "dcConnNetId": "connectivity_net1",
77
+ "netId": ".L1 > .pin2 to .M1 > .drain",
78
+ "mspConnectionPairIds": ["L1.2-D1.1"],
79
+ "pinIds": ["L1.2", "D1.1"],
80
+ "orientation": "y+",
81
+ "anchorPoint": {
82
+ "x": 0.78,
83
+ "y": 2.97
84
+ },
85
+ "width": 0.2,
86
+ "height": 0.45,
87
+ "center": {
88
+ "x": 0.78,
89
+ "y": 3.1950000000000003
90
+ }
91
+ },
92
+ {
93
+ "globalConnNetId": "connectivity_net1",
94
+ "netId": ".L1 > .pin2 to .M1 > .drain",
95
+ "mspConnectionPairIds": [],
96
+ "pinIds": ["M1.1"],
97
+ "orientation": "y+",
98
+ "anchorPoint": {
99
+ "x": 0.3,
100
+ "y": 0.58
101
+ },
102
+ "width": 0.2,
103
+ "height": 0.45,
104
+ "center": {
105
+ "x": 0.3,
106
+ "y": 0.8059999999999999
107
+ }
108
+ },
109
+ {
110
+ "globalConnNetId": "connectivity_net2",
111
+ "dcConnNetId": "connectivity_net2",
112
+ "netId": ".D1 > .cathode to .R1 > .pin1",
113
+ "mspConnectionPairIds": ["D1.2-C1.1"],
114
+ "pinIds": ["D1.2", "C1.1"],
115
+ "orientation": "y+",
116
+ "anchorPoint": {
117
+ "x": 3.7199999999999998,
118
+ "y": 3
119
+ },
120
+ "width": 0.2,
121
+ "height": 0.45,
122
+ "center": {
123
+ "x": 3.7199999999999998,
124
+ "y": 3.225
125
+ }
126
+ },
127
+ {
128
+ "globalConnNetId": "connectivity_net2",
129
+ "netId": ".D1 > .cathode to .R1 > .pin1",
130
+ "mspConnectionPairIds": [],
131
+ "pinIds": ["R1.1"],
132
+ "orientation": "y+",
133
+ "anchorPoint": {
134
+ "x": 6,
135
+ "y": 0.55
136
+ },
137
+ "width": 0.2,
138
+ "height": 0.45,
139
+ "center": {
140
+ "x": 6,
141
+ "y": 0.776
142
+ }
143
+ },
144
+ {
145
+ "globalConnNetId": "connectivity_net4",
146
+ "dcConnNetId": "connectivity_net4",
147
+ "netId": ".M1 > .gate to .V2 > .pin1",
148
+ "mspConnectionPairIds": ["M1.3-V2.1"],
149
+ "pinIds": ["M1.3", "V2.1"],
150
+ "orientation": "y+",
151
+ "anchorPoint": {
152
+ "x": -1.08373445,
153
+ "y": -0.09999999999999987
154
+ },
155
+ "width": 0.2,
156
+ "height": 0.45,
157
+ "center": {
158
+ "x": -1.08373445,
159
+ "y": 0.12500000000000014
160
+ }
161
+ }
162
+ ],
163
+ "traces": [
164
+ {
165
+ "mspPairId": "L1.2-D1.1",
166
+ "dcConnNetId": "connectivity_net1",
167
+ "globalConnNetId": "connectivity_net1",
168
+ "userNetId": ".L1 > .pin2 to .M1 > .drain",
169
+ "pins": [
170
+ {
171
+ "pinId": "L1.2",
172
+ "x": 0.58,
173
+ "y": 2.97,
174
+ "_facingDirection": "x+",
175
+ "chipId": "schematic_component_1"
176
+ },
177
+ {
178
+ "pinId": "D1.1",
179
+ "x": 2.48,
180
+ "y": 3,
181
+ "chipId": "schematic_component_2",
182
+ "_facingDirection": "x-"
183
+ }
184
+ ],
185
+ "tracePath": [
186
+ {
187
+ "x": 0.58,
188
+ "y": 2.97
189
+ },
190
+ {
191
+ "x": 0.78,
192
+ "y": 2.97
193
+ },
194
+ {
195
+ "x": 1.53,
196
+ "y": 2.97
197
+ },
198
+ {
199
+ "x": 1.53,
200
+ "y": 3
201
+ },
202
+ {
203
+ "x": 2.28,
204
+ "y": 3
205
+ },
206
+ {
207
+ "x": 2.48,
208
+ "y": 3
209
+ }
210
+ ],
211
+ "mspConnectionPairIds": ["L1.2-D1.1"],
212
+ "pinIds": ["L1.2", "D1.1"]
213
+ },
214
+ {
215
+ "mspPairId": "V1.1-L1.1",
216
+ "dcConnNetId": "connectivity_net0",
217
+ "globalConnNetId": "connectivity_net0",
218
+ "pins": [
219
+ {
220
+ "pinId": "V1.1",
221
+ "x": -5.005,
222
+ "y": 2.54,
223
+ "chipId": "schematic_component_0",
224
+ "_facingDirection": "y+"
225
+ },
226
+ {
227
+ "pinId": "L1.1",
228
+ "x": -0.58,
229
+ "y": 2.98,
230
+ "_facingDirection": "x-",
231
+ "chipId": "schematic_component_1"
232
+ }
233
+ ],
234
+ "tracePath": [
235
+ {
236
+ "x": -5.005,
237
+ "y": 2.54
238
+ },
239
+ {
240
+ "x": -5.005,
241
+ "y": 2.9800000000000004
242
+ },
243
+ {
244
+ "x": -0.5800000000000001,
245
+ "y": 2.9800000000000004
246
+ }
247
+ ],
248
+ "mspConnectionPairIds": ["V1.1-L1.1"],
249
+ "pinIds": ["V1.1", "L1.1"]
250
+ },
251
+ {
252
+ "mspPairId": "D1.2-C1.1",
253
+ "dcConnNetId": "connectivity_net2",
254
+ "globalConnNetId": "connectivity_net2",
255
+ "pins": [
256
+ {
257
+ "pinId": "D1.2",
258
+ "x": 3.52,
259
+ "y": 3,
260
+ "chipId": "schematic_component_2",
261
+ "_facingDirection": "x+"
262
+ },
263
+ {
264
+ "pinId": "C1.1",
265
+ "x": 3,
266
+ "y": 0.49500000000000005,
267
+ "_facingDirection": "y+",
268
+ "chipId": "schematic_component_3"
269
+ }
270
+ ],
271
+ "tracePath": [
272
+ {
273
+ "x": 3.52,
274
+ "y": 3
275
+ },
276
+ {
277
+ "x": 3.7199999999999998,
278
+ "y": 3
279
+ },
280
+ {
281
+ "x": 3.7199999999999998,
282
+ "y": 1.7474999999999996
283
+ },
284
+ {
285
+ "x": 3,
286
+ "y": 1.7474999999999996
287
+ },
288
+ {
289
+ "x": 3,
290
+ "y": 0.49500000000000005
291
+ }
292
+ ],
293
+ "mspConnectionPairIds": ["D1.2-C1.1"],
294
+ "pinIds": ["D1.2", "C1.1"]
295
+ },
296
+ {
297
+ "mspPairId": "C1.2-M1.2",
298
+ "dcConnNetId": "connectivity_net3",
299
+ "globalConnNetId": "connectivity_net3",
300
+ "pins": [
301
+ {
302
+ "pinId": "C1.2",
303
+ "x": 3,
304
+ "y": -0.49500000000000005,
305
+ "_facingDirection": "y-",
306
+ "chipId": "schematic_component_3"
307
+ },
308
+ {
309
+ "pinId": "M1.2",
310
+ "x": 0.31,
311
+ "y": -0.58,
312
+ "_facingDirection": "y-",
313
+ "chipId": "schematic_component_6"
314
+ }
315
+ ],
316
+ "tracePath": [
317
+ {
318
+ "x": 3,
319
+ "y": -0.4950000000000001
320
+ },
321
+ {
322
+ "x": 3,
323
+ "y": -0.78
324
+ },
325
+ {
326
+ "x": 0.31,
327
+ "y": -0.78
328
+ },
329
+ {
330
+ "x": 0.31,
331
+ "y": -0.58
332
+ }
333
+ ],
334
+ "mspConnectionPairIds": ["C1.2-M1.2"],
335
+ "pinIds": ["C1.2", "M1.2"]
336
+ },
337
+ {
338
+ "mspPairId": "V1.2-V2.2",
339
+ "dcConnNetId": "connectivity_net3",
340
+ "globalConnNetId": "connectivity_net3",
341
+ "pins": [
342
+ {
343
+ "pinId": "V1.2",
344
+ "x": -4.995,
345
+ "y": 1.46,
346
+ "chipId": "schematic_component_0",
347
+ "_facingDirection": "y-"
348
+ },
349
+ {
350
+ "pinId": "V2.2",
351
+ "x": -3.0000622,
352
+ "y": -0.4458008,
353
+ "chipId": "schematic_component_5",
354
+ "_facingDirection": "y-"
355
+ }
356
+ ],
357
+ "tracePath": [
358
+ {
359
+ "x": -4.995,
360
+ "y": 1.46
361
+ },
362
+ {
363
+ "x": -4.995,
364
+ "y": -0.6458008
365
+ },
366
+ {
367
+ "x": -3.0000622,
368
+ "y": -0.6458008
369
+ },
370
+ {
371
+ "x": -3.0000622,
372
+ "y": -0.4458007999999998
373
+ }
374
+ ],
375
+ "mspConnectionPairIds": ["V1.2-V2.2"],
376
+ "pinIds": ["V1.2", "V2.2"]
377
+ },
378
+ {
379
+ "mspPairId": "M1.3-V2.1",
380
+ "dcConnNetId": "connectivity_net4",
381
+ "globalConnNetId": "connectivity_net4",
382
+ "pins": [
383
+ {
384
+ "pinId": "M1.3",
385
+ "x": -0.445,
386
+ "y": -0.1,
387
+ "_facingDirection": "x-",
388
+ "chipId": "schematic_component_6"
389
+ },
390
+ {
391
+ "pinId": "V2.1",
392
+ "x": -2.9999378,
393
+ "y": 0.4458008,
394
+ "chipId": "schematic_component_5",
395
+ "_facingDirection": "y+"
396
+ }
397
+ ],
398
+ "tracePath": [
399
+ {
400
+ "x": -0.44499999999999984,
401
+ "y": -0.09999999999999987
402
+ },
403
+ {
404
+ "x": -1.7224689,
405
+ "y": -0.09999999999999987
406
+ },
407
+ {
408
+ "x": -1.7224689,
409
+ "y": 0.6458008000000002
410
+ },
411
+ {
412
+ "x": -2.9999378,
413
+ "y": 0.6458008000000002
414
+ },
415
+ {
416
+ "x": -2.9999378,
417
+ "y": 0.4458008
418
+ }
419
+ ],
420
+ "mspConnectionPairIds": ["M1.3-V2.1"],
421
+ "pinIds": ["M1.3", "V2.1"]
422
+ }
423
+ ]
424
+ }
@@ -64,7 +64,7 @@ x+" data-x="0.6" data-y="-2.8" cx="363.855421686747" cy="416.14457831325296" r="
64
64
  <circle data-type="point" data-label="" data-x="-1.2" data-y="-0.30000000000000004" cx="242.40963855421688" cy="247.46987951807228" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
65
65
  </g>
66
66
  <g>
67
- <circle data-type="point" data-label="" data-x="-0.8749999999999999" data-y="0.30000000000000004" cx="264.33734939759034" cy="206.9879518072289" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
67
+ <circle data-type="point" data-label="" data-x="-1.5999999999999999" data-y="0.30000000000000004" cx="215.42168674698797" cy="206.9879518072289" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
68
68
  </g>
69
69
  <g>
70
70
  <circle data-type="point" data-label="" data-x="-0.4" data-y="-0.5" cx="296.3855421686747" cy="260.96385542168673" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
@@ -82,7 +82,7 @@ x+" data-x="0.6" data-y="-2.8" cx="363.855421686747" cy="416.14457831325296" r="
82
82
  <polyline data-points="-1.7999999999999998,-0.30000000000000004 -0.6,-0.30000000000000004 -0.6,0.05099999999999996 0.6,0.05099999999999996 0.6,-0.2 1.9,-0.2" data-type="line" data-label="" points="201.92771084337352,247.46987951807228 282.89156626506025,247.46987951807228 282.89156626506025,223.78795180722892 363.855421686747,223.78795180722892 363.855421686747,240.72289156626505 451.566265060241,240.72289156626505" fill="none" stroke="purple" stroke-width="1" />
83
83
  </g>
84
84
  <g>
85
- <polyline data-points="-1.7999999999999998,0.30000000000000004 0.050000000000000044,0.30000000000000004 0.050000000000000044,0.2 1.9,0.2" data-type="line" data-label="" points="201.92771084337352,206.9879518072289 326.7469879518072,206.9879518072289 326.7469879518072,213.73493975903614 451.566265060241,213.73493975903614" fill="none" stroke="purple" stroke-width="1" />
85
+ <polyline data-points="-1.7999999999999998,0.30000000000000004 -1.5999999999999999,0.30000000000000004 0.050000000000000044,0.30000000000000004 0.050000000000000044,0.2 1.7,0.2 1.9,0.2" data-type="line" data-label="" points="201.92771084337352,206.9879518072289 215.42168674698797,206.9879518072289 326.7469879518072,206.9879518072289 326.7469879518072,213.73493975903614 438.0722891566265,213.73493975903614 451.566265060241,213.73493975903614" fill="none" stroke="purple" stroke-width="1" />
86
86
  </g>
87
87
  <g>
88
88
  <rect data-type="rect" data-label="schematic_component_0" data-x="-3" data-y="0" x="40" y="193.49397590361446" width="161.92771084337352" height="67.46987951807228" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01482142857142857" />
@@ -97,7 +97,7 @@ x+" data-x="0.6" data-y="-2.8" cx="363.855421686747" cy="416.14457831325296" r="
97
97
  <rect data-type="rect" data-label="" data-x="-1.2" data-y="-0.07500000000000004" x="235.66265060240963" y="217.10843373493975" width="13.493975903614484" height="30.361445783132524" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01482142857142857" />
98
98
  </g>
99
99
  <g>
100
- <rect data-type="rect" data-label="" data-x="-0.8749999999999999" data-y="0.525" x="257.5903614457832" y="176.6265060240964" width="13.493975903614398" height="30.361445783132524" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01482142857142857" />
100
+ <rect data-type="rect" data-label="" data-x="-1.5999999999999999" data-y="0.525" x="208.67469879518075" y="176.6265060240964" width="13.493975903614455" height="30.361445783132524" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01482142857142857" />
101
101
  </g>
102
102
  <g>
103
103
  <rect data-type="rect" data-label="" data-x="-0.4" data-y="-0.274" x="289.6385542168675" y="230.53493975903615" width="13.493975903614455" height="30.361445783132524" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01482142857142857" />
@@ -53,7 +53,7 @@ y-" data-x="-0.4" data-y="0.5" cx="296.3855421686747" cy="311.566265060241" r="3
53
53
  y-" data-x="0.4" data-y="0.5" cx="350.3614457831325" cy="311.566265060241" r="3" fill="hsl(203, 100%, 50%, 0.8)" />
54
54
  </g>
55
55
  <g>
56
- <circle data-type="point" data-label="" data-x="-0.8749999999999999" data-y="-0.30000000000000004" cx="264.33734939759034" cy="365.5421686746988" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
56
+ <circle data-type="point" data-label="" data-x="-1.5999999999999999" data-y="-0.30000000000000004" cx="215.42168674698797" cy="365.5421686746988" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
57
57
  </g>
58
58
  <g>
59
59
  <circle data-type="point" data-label="" data-x="1.25" data-y="0.2" cx="407.71084337349396" cy="331.8072289156627" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
@@ -71,7 +71,7 @@ y-" data-x="0.4" data-y="0.5" cx="350.3614457831325" cy="311.566265060241" r="3"
71
71
  <polyline data-points="1.9,0.2 -1.7999999999999998,0.09999999999999998" data-type="line" data-label="" points="451.566265060241,331.8072289156627 201.92771084337352,338.5542168674699" fill="none" stroke="hsl(210, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
72
72
  </g>
73
73
  <g>
74
- <polyline data-points="-1.7999999999999998,-0.30000000000000004 0.050000000000000044,-0.30000000000000004 0.050000000000000044,-0.2 1.9,-0.2" data-type="line" data-label="" points="201.92771084337352,365.5421686746988 326.7469879518072,365.5421686746988 326.7469879518072,358.7951807228916 451.566265060241,358.7951807228916" fill="none" stroke="purple" stroke-width="1" />
74
+ <polyline data-points="-1.7999999999999998,-0.30000000000000004 -1.5999999999999999,-0.30000000000000004 0.050000000000000044,-0.30000000000000004 0.050000000000000044,-0.2 1.7,-0.2 1.9,-0.2" data-type="line" data-label="" points="201.92771084337352,365.5421686746988 215.42168674698797,365.5421686746988 326.7469879518072,365.5421686746988 326.7469879518072,358.7951807228916 438.0722891566265,358.7951807228916 451.566265060241,358.7951807228916" fill="none" stroke="purple" stroke-width="1" />
75
75
  </g>
76
76
  <g>
77
77
  <polyline data-points="1.9,0.2 0.6,0.2 0.6,-0.05099999999999996 -0.6,-0.05099999999999996 -0.6,0.09999999999999998 -1.7999999999999998,0.09999999999999998" data-type="line" data-label="" points="451.566265060241,331.8072289156627 363.855421686747,331.8072289156627 363.855421686747,348.7421686746988 282.89156626506025,348.7421686746988 282.89156626506025,338.5542168674699 201.92771084337352,338.5542168674699" fill="none" stroke="purple" stroke-width="1" />
@@ -86,7 +86,7 @@ y-" data-x="0.4" data-y="0.5" cx="350.3614457831325" cy="311.566265060241" r="3"
86
86
  <rect data-type="rect" data-label="schematic_component_2" data-x="0" data-y="1" x="289.6385542168675" y="244.0963855421687" width="67.46987951807228" height="67.4698795180723" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.01482142857142857" />
87
87
  </g>
88
88
  <g>
89
- <rect data-type="rect" data-label="" data-x="-0.8749999999999999" data-y="-0.525" x="257.5903614457832" y="365.5421686746988" width="13.493975903614398" height="30.361445783132524" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01482142857142857" />
89
+ <rect data-type="rect" data-label="" data-x="-1.5999999999999999" data-y="-0.525" x="208.67469879518075" y="365.5421686746988" width="13.493975903614455" height="30.361445783132524" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01482142857142857" />
90
90
  </g>
91
91
  <g>
92
92
  <rect data-type="rect" data-label="" data-x="1.25" data-y="0.42500000000000004" x="400.96385542168673" y="301.44578313253015" width="13.493975903614455" height="30.361445783132524" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.01482142857142857" />
@@ -0,0 +1,18 @@
1
+ import { expect } from "bun:test"
2
+ import { test } from "bun:test"
3
+ import { TraceLabelOverlapAvoidanceSolver } from "lib/solvers/TraceLabelOverlapAvoidanceSolver/TraceLabelOverlapAvoidanceSolver"
4
+ import inputProblem from "tests/assets/example25.json"
5
+ import "tests/fixtures/matcher"
6
+ import testInput from "tests/assets/TraceLabelOverlapAvoidanceSolver.test.input.json"
7
+
8
+ test("TraceLabelOverlapAvoidanceSolver snapshot", () => {
9
+ const solver = new TraceLabelOverlapAvoidanceSolver({
10
+ inputProblem: inputProblem as any,
11
+ netLabelPlacements: testInput.netLabelPlacements as any,
12
+ traces: testInput.traces as any,
13
+ })
14
+
15
+ solver.solve()
16
+
17
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
18
+ })