@tscircuit/schematic-trace-solver 0.0.107 → 0.0.108
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.d.ts +2 -2
- package/dist/index.js +285 -212
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +58 -27
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/generateEndpointCollisionDetours.ts +1 -10
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/generateInternalSegmentCollisionDetours.ts +94 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/pathOps.ts +10 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/rect.ts +5 -1
- package/package.json +1 -1
- package/tests/bug-reports/bug-report-20260708T095725Z/__snapshots__/bug-report-20260708T095725Z.snap.svg +5 -5
- package/tests/bug-reports/bug-report-20260708T095725Z/bug-report-20260708T095725Z.test.ts +15 -0
- package/tests/repros/__snapshots__/repro-tps61222-trace-intersection.snap.svg +63 -220
- package/tests/repros/repro-tps61222-trace-intersection.test.ts +27 -0
- package/tests/solvers/SchematicTraceSingleLineSolver2/generate-internal-segment-collision-detours.test.ts +49 -0
|
@@ -1,221 +1,64 @@
|
|
|
1
|
-
<svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
x-" data-x="-1.65" data-y="
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
x+" data-x="
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
x+" data-x="
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
y-" data-x="-4.4" data-y="-0.38" cx="62.0183486238532" cy="356.5472868501529" r="3" fill="hsl(266, 100%, 50%, 0.8)" />
|
|
42
|
-
</g>
|
|
43
|
-
<g>
|
|
44
|
-
<circle data-type="point" data-label="C26.1
|
|
45
|
-
y+" data-x="6" data-y="0.38" cx="570.8868501529053" cy="319.3607425076452" r="3" fill="hsl(146, 100%, 50%, 0.8)" />
|
|
46
|
-
</g>
|
|
47
|
-
<g>
|
|
48
|
-
<circle data-type="point" data-label="C26.2
|
|
49
|
-
y-" data-x="6" data-y="-0.38" cx="570.8868501529053" cy="356.5472868501529" r="3" fill="hsl(147, 100%, 50%, 0.8)" />
|
|
50
|
-
</g>
|
|
51
|
-
<g>
|
|
52
|
-
<circle data-type="point" data-label="anchorPoint
|
|
53
|
-
orientation: y+" data-x="6" data-y="1.2973754500000003" cx="570.8868501529053" cy="274.47387033639137" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
54
|
-
</g>
|
|
55
|
-
<g>
|
|
56
|
-
<circle data-type="point" data-label="anchorPoint
|
|
57
|
-
orientation: y+" data-x="-4.4" data-y="0.5800000000000002" cx="62.0183486238532" cy="309.5748097859327" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
58
|
-
</g>
|
|
59
|
-
<g>
|
|
60
|
-
<circle data-type="point" data-label="anchorPoint
|
|
61
|
-
orientation: y-" data-x="-4.4" data-y="-0.5800000000000002" cx="62.0183486238532" cy="366.3332195718654" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
62
|
-
</g>
|
|
63
|
-
<g>
|
|
64
|
-
<circle data-type="point" data-label="anchorPoint
|
|
65
|
-
orientation: x+" data-x="2.6110437499999994" data-y="0.30000000000000004" cx="405.06636085626906" cy="323.27511559633024" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
66
|
-
</g>
|
|
67
|
-
<g>
|
|
68
|
-
<polyline data-points="1.65,0.09999999999999998 1.65,-0.10000000000000003" data-type="line" data-label="" points="358.0428134556575,333.06104831804277 358.0428134556575,342.84698103975535" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
69
|
-
</g>
|
|
70
|
-
<g>
|
|
71
|
-
<polyline data-points="1.65,0.09999999999999998 4.6279125,1.2973754500000003" data-type="line" data-label="" points="358.0428134556575,333.06104831804277 503.7510703363914,274.47387033639137" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
72
|
-
</g>
|
|
73
|
-
<g>
|
|
74
|
-
<polyline data-points="1.65,0.09999999999999998 6,0.38" data-type="line" data-label="" points="358.0428134556575,333.06104831804277 570.8868501529053,319.3607425076452" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
75
|
-
</g>
|
|
76
|
-
<g>
|
|
77
|
-
<polyline data-points="1.65,-0.10000000000000003 4.6279125,1.2973754500000003" data-type="line" data-label="" points="358.0428134556575,342.84698103975535 503.7510703363914,274.47387033639137" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
78
|
-
</g>
|
|
79
|
-
<g>
|
|
80
|
-
<polyline data-points="1.65,-0.10000000000000003 6,0.38" data-type="line" data-label="" points="358.0428134556575,342.84698103975535 570.8868501529053,319.3607425076452" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
81
|
-
</g>
|
|
82
|
-
<g>
|
|
83
|
-
<polyline data-points="4.6279125,1.2973754500000003 6,0.38" data-type="line" data-label="" points="503.7510703363914,274.47387033639137 570.8868501529053,319.3607425076452" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
84
|
-
</g>
|
|
85
|
-
<g>
|
|
86
|
-
<polyline data-points="-1.65,-0.1 -1.65,0.1" data-type="line" data-label="" points="196.5749235474006,342.84698103975535 196.5749235474006,333.06104831804277" fill="none" stroke="hsl(261, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
87
|
-
</g>
|
|
88
|
-
<g>
|
|
89
|
-
<polyline data-points="-1.65,-0.1 -4.4,0.38" data-type="line" data-label="" points="196.5749235474006,342.84698103975535 62.0183486238532,319.3607425076452" fill="none" stroke="hsl(261, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
90
|
-
</g>
|
|
91
|
-
<g>
|
|
92
|
-
<polyline data-points="-1.65,0.1 -4.4,0.38" data-type="line" data-label="" points="196.5749235474006,333.06104831804277 62.0183486238532,319.3607425076452" fill="none" stroke="hsl(261, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
93
|
-
</g>
|
|
94
|
-
<g>
|
|
95
|
-
<polyline data-points="1.65,-0.30000000000000004 -4.4,-0.38" data-type="line" data-label="" points="358.0428134556575,352.6329137614679 62.0183486238532,356.5472868501529" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
96
|
-
</g>
|
|
97
|
-
<g>
|
|
98
|
-
<polyline data-points="1.65,-0.30000000000000004 6,-0.38" data-type="line" data-label="" points="358.0428134556575,352.6329137614679 570.8868501529053,356.5472868501529" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
99
|
-
</g>
|
|
100
|
-
<g>
|
|
101
|
-
<polyline data-points="-4.4,-0.38 6,-0.38" data-type="line" data-label="" points="62.0183486238532,356.5472868501529 570.8868501529053,356.5472868501529" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
102
|
-
</g>
|
|
103
|
-
<g>
|
|
104
|
-
<polyline data-points="1.65,0.30000000000000004 3.5720874999999994,1.3026245499999998" data-type="line" data-label="" points="358.0428134556575,323.27511559633024 452.0899082568807,274.2170336391437" fill="none" stroke="hsl(56, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
105
|
-
</g>
|
|
106
|
-
<g>
|
|
107
|
-
<polyline data-points="4.6279125,1.2973754500000003 6,1.2973754500000003 6,0.38" data-type="line" data-label="" points="503.7510703363914,274.47387033639137 570.8868501529053,274.47387033639137 570.8868501529053,319.3607425076452" fill="none" stroke="purple" stroke-width="1" />
|
|
108
|
-
</g>
|
|
109
|
-
<g>
|
|
110
|
-
<polyline data-points="1.65,0.09999999999999998 4.8279125,0.09999999999999998 4.8279125,1.2973754500000003 4.6279125,1.2973754500000003" data-type="line" data-label="" points="358.0428134556575,333.06104831804277 513.537003058104,333.06104831804277 513.537003058104,274.47387033639137 503.7510703363914,274.47387033639137" fill="none" stroke="purple" stroke-width="1" />
|
|
111
|
-
</g>
|
|
112
|
-
<g>
|
|
113
|
-
<polyline data-points="1.65,-0.10000000000000003 1.8499999999999999,-0.10000000000000003 1.8499999999999999,0.09999999999999998 1.65,0.09999999999999998" data-type="line" data-label="" points="358.0428134556575,342.84698103975535 367.82874617737,342.84698103975535 367.82874617737,333.06104831804277 358.0428134556575,333.06104831804277" fill="none" stroke="purple" stroke-width="1" />
|
|
114
|
-
</g>
|
|
115
|
-
<g>
|
|
116
|
-
<polyline data-points="-1.65,0.09999999999999976 -1.8499999999999999,0.09999999999999976 -1.8499999999999999,0.5800000000000002 -4.4,0.5800000000000002 -4.4,0.38" data-type="line" data-label="" points="196.5749235474006,333.0610483180428 186.78899082568807,333.0610483180428 186.78899082568807,309.5748097859327 62.0183486238532,309.5748097859327 62.0183486238532,319.3607425076452" fill="none" stroke="purple" stroke-width="1" />
|
|
117
|
-
</g>
|
|
118
|
-
<g>
|
|
119
|
-
<polyline data-points="-1.65,-0.1 -1.8499999999999999,-0.1 -1.8499999999999999,0.1 -1.65,0.1" data-type="line" data-label="" points="196.5749235474006,342.84698103975535 186.78899082568807,342.84698103975535 186.78899082568807,333.06104831804277 196.5749235474006,333.06104831804277" fill="none" stroke="purple" stroke-width="1" />
|
|
120
|
-
</g>
|
|
121
|
-
<g>
|
|
122
|
-
<polyline data-points="1.6500000000000004,-0.29999999999999993 1.8500000000000005,-0.29999999999999993 1.8500000000000005,-0.5800000000000002 -4.4,-0.5800000000000002 -4.4,-0.38" data-type="line" data-label="" points="358.0428134556575,352.6329137614679 367.82874617737,352.6329137614679 367.82874617737,366.3332195718654 62.0183486238532,366.3332195718654 62.0183486238532,356.5472868501529" fill="none" stroke="purple" stroke-width="1" />
|
|
123
|
-
</g>
|
|
124
|
-
<g>
|
|
125
|
-
<polyline data-points="6,-0.38 6,-0.5800000000000001 3.825,-0.5800000000000001 3.825,-0.30000000000000004 1.65,-0.30000000000000004" data-type="line" data-label="" points="570.8868501529053,356.5472868501529 570.8868501529053,366.3332195718654 464.46483180428135,366.3332195718654 464.46483180428135,352.6329137614679 358.0428134556575,352.6329137614679" fill="none" stroke="purple" stroke-width="1" />
|
|
126
|
-
</g>
|
|
127
|
-
<g>
|
|
128
|
-
<polyline data-points="1.65,0.30000000000000004 2.6110437499999994,0.30000000000000004 2.6110437499999994,1.3026245499999998 3.5720874999999994,1.3026245499999998" data-type="line" data-label="" points="358.0428134556575,323.27511559633024 405.06636085626906,323.27511559633024 405.06636085626906,274.2170336391437 452.0899082568807,274.2170336391437" fill="none" stroke="purple" stroke-width="1" />
|
|
129
|
-
</g>
|
|
130
|
-
<g>
|
|
131
|
-
<rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="196.5749235474006" y="313.4891828746177" width="161.4678899082569" height="48.92966360856269" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375" />
|
|
132
|
-
</g>
|
|
133
|
-
<g>
|
|
134
|
-
<rect data-type="rect" data-label="schematic_component_1" data-x="4.1" data-y="1.3" x="452.0899082568807" y="253.1163217125382" width="51.661162079510746" height="42.458260550458704" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375" />
|
|
135
|
-
</g>
|
|
136
|
-
<g>
|
|
137
|
-
<rect data-type="rect" data-label="schematic_component_2" data-x="-4.327500000000001" data-y="0" x="39.99999999999997" y="319.3607425076452" width="51.131498470948" height="37.18654434250766" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375" />
|
|
138
|
-
</g>
|
|
139
|
-
<g>
|
|
140
|
-
<rect data-type="rect" data-label="schematic_component_3" data-x="6.0725" data-y="0" x="548.8685015290519" y="319.3607425076452" width="51.131498470948145" height="37.18654434250766" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375" />
|
|
141
|
-
</g>
|
|
142
|
-
<g>
|
|
143
|
-
<rect data-type="rect" data-label="TPS61222DCKT" data-x="-0.53" data-y="-0.63" x="216.14678899082568" y="364.3760330275229" width="70.45871559633028" height="8.807339449541303" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.0204375" />
|
|
144
|
-
</g>
|
|
145
|
-
<g>
|
|
146
|
-
<rect data-type="rect" data-label="U2" data-x="-1.13" data-y="0.615" x="213.21100917431193" y="301.7460636085627" width="17.614678899082577" height="12.232415902140644" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.0204375" />
|
|
147
|
-
</g>
|
|
148
|
-
<g>
|
|
149
|
-
<rect data-type="rect" data-label="netId: VIN_3V3
|
|
150
|
-
globalConnNetId: connectivity_net0" data-x="6" data-y="1.5073754500000003" x="547.4006116207951" y="253.92341162079506" width="46.97247706422024" height="20.550458715596307" fill="#ef444466" stroke="#ef4444" stroke-width="0.0204375" />
|
|
151
|
-
</g>
|
|
152
|
-
<g>
|
|
153
|
-
<rect data-type="rect" data-label="netId: VIN_5V
|
|
154
|
-
globalConnNetId: connectivity_net1" data-x="-4.4" data-y="0.7900000000000001" x="41.467889908256865" y="289.02435107033637" width="41.10091743119264" height="20.550458715596335" fill="#ef444466" stroke="#ef4444" stroke-width="0.0204375" />
|
|
155
|
-
</g>
|
|
156
|
-
<g>
|
|
157
|
-
<rect data-type="rect" data-label="netId: GND
|
|
158
|
-
globalConnNetId: connectivity_net2" data-x="-4.4" data-y="-0.7900000000000001" x="50.27522935779814" y="366.3332195718654" width="23.486238532110093" height="20.550458715596335" fill="#00000066" stroke="#000000" stroke-width="0.0204375" />
|
|
159
|
-
</g>
|
|
160
|
-
<g>
|
|
161
|
-
<rect data-type="rect" data-label="netId: BOOST_SW
|
|
162
|
-
globalConnNetId: connectivity_net3" data-x="3.1510437499999995" data-y="0.30000000000000004" x="405.06636085626906" y="318.382149235474" width="52.8440366972477" height="9.785932721712527" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.0204375" />
|
|
163
|
-
</g>
|
|
164
|
-
<g id="crosshair" style="display: none">
|
|
165
|
-
<line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
|
|
166
|
-
<line id="crosshair-v" x1="0" x2="640" stroke="#666" stroke-width="0.5" /><text id="coordinates" font-family="monospace" font-size="12" fill="#666"></text>
|
|
167
|
-
</g>
|
|
168
|
-
<script>
|
|
169
|
-
<![CDATA[
|
|
170
|
-
document.currentScript.parentElement.addEventListener('mousemove', (e) => {
|
|
171
|
-
const svg = e.currentTarget;
|
|
172
|
-
const rect = svg.getBoundingClientRect();
|
|
173
|
-
const x = e.clientX - rect.left;
|
|
174
|
-
const y = e.clientY - rect.top;
|
|
175
|
-
const crosshair = svg.getElementById('crosshair');
|
|
176
|
-
const h = svg.getElementById('crosshair-h');
|
|
177
|
-
const v = svg.getElementById('crosshair-v');
|
|
178
|
-
const coords = svg.getElementById('coordinates');
|
|
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.65,0.09999999999999998 1.65,-0.10000000000000003" data-type="line" data-label="" points="358.0428134556575,324.74300550458713 358.0428134556575,334.5289382262997" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="1.65,0.09999999999999998 4.6279125,1.2973754500000003" data-type="line" data-label="" points="358.0428134556575,324.74300550458713 503.7510703363914,266.15582752293574" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="1.65,0.09999999999999998 6,0.38" data-type="line" data-label="" points="358.0428134556575,324.74300550458713 570.8868501529053,311.0426996941896" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="1.65,-0.10000000000000003 4.6279125,1.2973754500000003" data-type="line" data-label="" points="358.0428134556575,334.5289382262997 503.7510703363914,266.15582752293574" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="1.65,-0.10000000000000003 6,0.38" data-type="line" data-label="" points="358.0428134556575,334.5289382262997 570.8868501529053,311.0426996941896" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="4.6279125,1.2973754500000003 6,0.38" data-type="line" data-label="" points="503.7510703363914,266.15582752293574 570.8868501529053,311.0426996941896" fill="none" stroke="hsl(100, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-1.65,-0.1 -1.65,0.1" data-type="line" data-label="" points="196.5749235474006,334.5289382262997 196.5749235474006,324.74300550458713" fill="none" stroke="hsl(261, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-1.65,-0.1 -4.4,0.38" data-type="line" data-label="" points="196.5749235474006,334.5289382262997 62.0183486238532,311.0426996941896" fill="none" stroke="hsl(261, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-1.65,0.1 -4.4,0.38" data-type="line" data-label="" points="196.5749235474006,324.74300550458713 62.0183486238532,311.0426996941896" fill="none" stroke="hsl(261, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="1.65,-0.30000000000000004 -4.4,-0.38" data-type="line" data-label="" points="358.0428134556575,344.31487094801224 62.0183486238532,348.22924403669725" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="1.65,-0.30000000000000004 6,-0.38" data-type="line" data-label="" points="358.0428134556575,344.31487094801224 570.8868501529053,348.22924403669725" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-4.4,-0.38 6,-0.38" data-type="line" data-label="" points="62.0183486238532,348.22924403669725 570.8868501529053,348.22924403669725" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="1.65,0.30000000000000004 3.5720874999999994,1.3026245499999998" data-type="line" data-label="" points="358.0428134556575,314.9570727828746 452.0899082568807,265.8989908256881" fill="none" stroke="hsl(56, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="4.6279125,1.2973754500000003 6,1.2973754500000003 6,0.38" data-type="line" data-label="" points="503.7510703363914,266.15582752293574 570.8868501529053,266.15582752293574 570.8868501529053,311.0426996941896" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="1.65,0.09999999999999998 4.8279125,0.09999999999999998 4.8279125,1.2973754500000003 4.6279125,1.2973754500000003" data-type="line" data-label="" points="358.0428134556575,324.74300550458713 513.537003058104,324.74300550458713 513.537003058104,266.15582752293574 503.7510703363914,266.15582752293574" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="1.65,-0.10000000000000003 1.8499999999999999,-0.10000000000000003 1.8499999999999999,0.09999999999999998 1.65,0.09999999999999998" data-type="line" data-label="" points="358.0428134556575,334.5289382262997 367.82874617737,334.5289382262997 367.82874617737,324.74300550458713 358.0428134556575,324.74300550458713" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-1.65,0.09999999999999976 -1.8499999999999999,0.09999999999999976 -1.8499999999999999,0.5800000000000002 -4.4,0.5800000000000002 -4.4,0.38" data-type="line" data-label="" points="196.5749235474006,324.7430055045872 186.78899082568807,324.7430055045872 186.78899082568807,301.25676697247707 62.0183486238532,301.25676697247707 62.0183486238532,311.0426996941896" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-1.65,-0.1 -1.8499999999999999,-0.1 -1.8499999999999999,0.1 -1.65,0.1" data-type="line" data-label="" points="196.5749235474006,334.5289382262997 186.78899082568807,334.5289382262997 186.78899082568807,324.74300550458713 196.5749235474006,324.74300550458713" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="1.6500000000000004,-0.29999999999999993 1.8500000000000005,-0.29999999999999993 1.8500000000000005,-0.9199999999999999 -4.4,-0.9199999999999999 -4.4,-0.38" data-type="line" data-label="" points="358.0428134556575,344.31487094801224 367.82874617737,344.31487094801224 367.82874617737,374.6512623853211 62.0183486238532,374.6512623853211 62.0183486238532,348.22924403669725" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="6,-0.38 6,-0.5800000000000001 1.8500000000000005,-0.5800000000000001 1.8500000000000005,-0.30000000000000004 1.65,-0.30000000000000004" data-type="line" data-label="" points="570.8868501529053,348.22924403669725 570.8868501529053,358.0151767584098 367.82874617737,358.0151767584098 367.82874617737,344.31487094801224 358.0428134556575,344.31487094801224" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="1.65,0.30000000000000004 2.6110437499999994,0.30000000000000004 2.6110437499999994,1.3026245499999998 3.5720874999999994,1.3026245499999998" data-type="line" data-label="" points="358.0428134556575,314.9570727828746 405.06636085626906,314.9570727828746 405.06636085626906,265.8989908256881 452.0899082568807,265.8989908256881" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="196.5749235474006" y="305.1711400611621" width="161.4678899082569" height="48.92966360856269" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="schematic_component_1" data-x="4.1" data-y="1.3" x="452.08990825688073" y="244.79827889908256" width="51.661162079510746" height="42.458260550458704" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="schematic_component_2" data-x="-4.327500000000001" data-y="0" x="39.99999999999996" y="311.0426996941896" width="51.131498470948" height="37.18654434250766" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="schematic_component_3" data-x="6.0725" data-y="0" x="548.868501529052" y="311.0426996941896" width="51.131498470948145" height="37.18654434250766" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="TPS61222DCKT" data-x="-0.53" data-y="-0.63" x="216.14678899082566" y="356.0579902140672" width="70.45871559633028" height="8.807339449541303" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="U2" data-x="-1.13" data-y="0.615" x="213.21100917431193" y="293.42802079510705" width="17.614678899082577" height="12.232415902140644" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="netId: VIN_3V3
|
|
2
|
+
globalConnNetId: connectivity_net0" data-x="6" data-y="1.5073754500000003" x="547.4006116207952" y="245.60536880733946" width="46.97247706422024" height="20.550458715596307" fill="#ef444466" stroke="#ef4444" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="netId: VIN_5V
|
|
3
|
+
globalConnNetId: connectivity_net1" data-x="-4.4" data-y="0.7900000000000001" x="41.46788990825688" y="280.7063082568807" width="41.10091743119264" height="20.550458715596335" fill="#ef444466" stroke="#ef4444" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="netId: GND
|
|
4
|
+
globalConnNetId: connectivity_net2" data-x="-4.4" data-y="-1.13" x="50.27522935779815" y="374.65126238532105" width="23.486238532110093" height="20.550458715596335" fill="#00000066" stroke="#000000" stroke-width="0.0204375"/></g><g><rect data-type="rect" data-label="netId: BOOST_SW
|
|
5
|
+
globalConnNetId: connectivity_net3" data-x="3.1510437499999995" data-y="0.30000000000000004" x="405.06636085626906" y="310.0641064220183" width="52.8440366972477" height="9.785932721712527" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.0204375"/></g><g><circle data-type="point" data-label="U2.1
|
|
6
|
+
x+" data-x="1.65" data-y="0.09999999999999998" cx="358.0428134556575" cy="324.74300550458713" r="3" fill="hsl(200, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U2.2
|
|
7
|
+
x-" data-x="-1.65" data-y="-0.1" cx="196.5749235474006" cy="334.5289382262997" r="3" fill="hsl(201, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U2.3
|
|
8
|
+
x+" data-x="1.65" data-y="-0.30000000000000004" cx="358.0428134556575" cy="344.31487094801224" r="3" fill="hsl(202, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U2.4
|
|
9
|
+
x-" data-x="-1.65" data-y="0.1" cx="196.5749235474006" cy="324.74300550458713" r="3" fill="hsl(203, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U2.5
|
|
10
|
+
x+" data-x="1.65" data-y="0.30000000000000004" cx="358.0428134556575" cy="314.9570727828746" r="3" fill="hsl(204, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U2.6
|
|
11
|
+
x+" data-x="1.65" data-y="-0.10000000000000003" cx="358.0428134556575" cy="334.5289382262997" r="3" fill="hsl(205, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="L4.1
|
|
12
|
+
x-" data-x="3.5720874999999994" data-y="1.3026245499999998" cx="452.0899082568807" cy="265.8989908256881" r="3" fill="hsl(43, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="L4.2
|
|
13
|
+
x+" data-x="4.6279125" data-y="1.2973754500000003" cx="503.7510703363914" cy="266.15582752293574" r="3" fill="hsl(44, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C25.1
|
|
14
|
+
y+" data-x="-4.4" data-y="0.38" cx="62.0183486238532" cy="311.0426996941896" r="3" fill="hsl(265, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C25.2
|
|
15
|
+
y-" data-x="-4.4" data-y="-0.38" cx="62.0183486238532" cy="348.22924403669725" r="3" fill="hsl(266, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C26.1
|
|
16
|
+
y+" data-x="6" data-y="0.38" cx="570.8868501529053" cy="311.0426996941896" r="3" fill="hsl(146, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C26.2
|
|
17
|
+
y-" data-x="6" data-y="-0.38" cx="570.8868501529053" cy="348.22924403669725" r="3" fill="hsl(147, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="anchorPoint
|
|
18
|
+
orientation: y+" data-x="6" data-y="1.2973754500000003" cx="570.8868501529053" cy="266.15582752293574" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
|
|
19
|
+
orientation: y+" data-x="-4.4" data-y="0.5800000000000002" cx="62.0183486238532" cy="301.25676697247707" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
|
|
20
|
+
orientation: y-" data-x="-4.4" data-y="-0.9199999999999999" cx="62.0183486238532" cy="374.6512623853211" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
|
|
21
|
+
orientation: x+" data-x="2.6110437499999994" data-y="0.30000000000000004" cx="405.06636085626906" cy="314.9570727828746" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g id="crosshair" style="display: none"><line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5"/><line id="crosshair-v" x1="0" x2="640" stroke="#666" stroke-width="0.5"/><text id="coordinates" font-family="monospace" font-size="12" fill="#666"></text></g><script><![CDATA[
|
|
22
|
+
document.currentScript.parentElement.addEventListener('mousemove', (e) => {
|
|
23
|
+
const svg = e.currentTarget;
|
|
24
|
+
const rect = svg.getBoundingClientRect();
|
|
25
|
+
const x = e.clientX - rect.left;
|
|
26
|
+
const y = e.clientY - rect.top;
|
|
27
|
+
const crosshair = svg.getElementById('crosshair');
|
|
28
|
+
const h = svg.getElementById('crosshair-h');
|
|
29
|
+
const v = svg.getElementById('crosshair-v');
|
|
30
|
+
const coords = svg.getElementById('coordinates');
|
|
31
|
+
|
|
32
|
+
crosshair.style.display = 'block';
|
|
33
|
+
h.setAttribute('x1', '0');
|
|
34
|
+
h.setAttribute('x2', '640');
|
|
35
|
+
h.setAttribute('y1', y);
|
|
36
|
+
h.setAttribute('y2', y);
|
|
37
|
+
v.setAttribute('x1', x);
|
|
38
|
+
v.setAttribute('x2', x);
|
|
39
|
+
v.setAttribute('y1', '0');
|
|
40
|
+
v.setAttribute('y2', '640');
|
|
179
41
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const sx = matrix.a;
|
|
204
|
-
const sy = matrix.d;
|
|
205
|
-
const tx = matrix.e;
|
|
206
|
-
const ty = matrix.f;
|
|
207
|
-
const realPoint = {
|
|
208
|
-
x: (x - tx) / sx,
|
|
209
|
-
y: (y - ty) / sy // Flip y back since we used negative scale
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
|
|
213
|
-
coords.setAttribute('x', (x + 5).toString());
|
|
214
|
-
coords.setAttribute('y', (y - 5).toString());
|
|
215
|
-
});
|
|
216
|
-
document.currentScript.parentElement.addEventListener('mouseleave', () => {
|
|
217
|
-
document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
|
|
218
|
-
});
|
|
219
|
-
]]>
|
|
220
|
-
</script>
|
|
221
|
-
</svg>
|
|
42
|
+
// Calculate real coordinates using inverse transformation
|
|
43
|
+
const matrix = {"a":48.92966360856269,"c":0,"e":277.30886850152905,"b":0,"d":-48.92966360856269,"f":329.6359718654434};
|
|
44
|
+
// Manually invert and apply the affine transform
|
|
45
|
+
// Since we only use translate and scale, we can directly compute:
|
|
46
|
+
// x' = (x - tx) / sx
|
|
47
|
+
// y' = (y - ty) / sy
|
|
48
|
+
const sx = matrix.a;
|
|
49
|
+
const sy = matrix.d;
|
|
50
|
+
const tx = matrix.e;
|
|
51
|
+
const ty = matrix.f;
|
|
52
|
+
const realPoint = {
|
|
53
|
+
x: (x - tx) / sx,
|
|
54
|
+
y: (y - ty) / sy // Flip y back since we used negative scale
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
|
|
58
|
+
coords.setAttribute('x', (x + 5).toString());
|
|
59
|
+
coords.setAttribute('y', (y - 5).toString());
|
|
60
|
+
});
|
|
61
|
+
document.currentScript.parentElement.addEventListener('mouseleave', () => {
|
|
62
|
+
document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
|
|
63
|
+
});
|
|
64
|
+
]]></script></svg>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { expect, test } from "bun:test"
|
|
2
|
+
import { isPathCollidingWithObstacles } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/collisions"
|
|
2
3
|
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
4
|
+
import { getTextBoxBounds } from "lib/utils/textBoxBounds"
|
|
3
5
|
import "tests/fixtures/matcher"
|
|
4
6
|
import inputProblem from "./assets/repro-tps61222-trace-intersection.input.json"
|
|
5
7
|
|
|
@@ -8,7 +10,32 @@ import inputProblem from "./assets/repro-tps61222-trace-intersection.input.json"
|
|
|
8
10
|
test("repro TPS61222 schematic trace intersection", () => {
|
|
9
11
|
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
10
12
|
|
|
13
|
+
const manufacturerPartNumberTextBox = inputProblem.textBoxes.find(
|
|
14
|
+
(textBox) => textBox.text === "TPS61222DCKT",
|
|
15
|
+
)
|
|
16
|
+
expect(manufacturerPartNumberTextBox).toBeDefined()
|
|
17
|
+
|
|
18
|
+
const textBounds = getTextBoxBounds(manufacturerPartNumberTextBox!)
|
|
19
|
+
solver.solveUntilPhase("longDistancePairSolver")
|
|
20
|
+
|
|
21
|
+
const initialGroundTrace =
|
|
22
|
+
solver.schematicTraceLinesSolver!.solvedTracePaths.find(
|
|
23
|
+
(trace) => trace.mspPairId === "U2.3-C25.2",
|
|
24
|
+
)
|
|
25
|
+
expect(initialGroundTrace).toBeDefined()
|
|
26
|
+
expect(
|
|
27
|
+
isPathCollidingWithObstacles(initialGroundTrace!.tracePath, [textBounds]),
|
|
28
|
+
).toBe(false)
|
|
29
|
+
|
|
11
30
|
solver.solve()
|
|
12
31
|
|
|
32
|
+
const crossingTraceIds = solver
|
|
33
|
+
.netLabelTraceCollisionSolver!.getOutput()
|
|
34
|
+
.traces.filter((trace) =>
|
|
35
|
+
isPathCollidingWithObstacles(trace.tracePath, [textBounds]),
|
|
36
|
+
)
|
|
37
|
+
.map((trace) => trace.mspPairId)
|
|
38
|
+
|
|
39
|
+
expect(crossingTraceIds).toEqual([])
|
|
13
40
|
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
14
41
|
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { isPathCollidingWithObstacles } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/collisions"
|
|
3
|
+
import { generateInternalSegmentCollisionDetours } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/generateInternalSegmentCollisionDetours"
|
|
4
|
+
|
|
5
|
+
test("internal segment detours preserve endpoint legs and clear the obstacle", () => {
|
|
6
|
+
const path = [
|
|
7
|
+
{ x: 0, y: 0 },
|
|
8
|
+
{ x: 1, y: 0 },
|
|
9
|
+
{ x: 9, y: 0 },
|
|
10
|
+
{ x: 10, y: 0 },
|
|
11
|
+
]
|
|
12
|
+
const obstacle = { minX: 4, minY: -0.5, maxX: 6, maxY: 0.5 }
|
|
13
|
+
|
|
14
|
+
const detours = generateInternalSegmentCollisionDetours({
|
|
15
|
+
path,
|
|
16
|
+
collidingSegmentIndex: 1,
|
|
17
|
+
obstacle,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
expect(detours).toHaveLength(2)
|
|
21
|
+
for (const detour of detours) {
|
|
22
|
+
expect(detour.slice(0, 2)).toEqual(path.slice(0, 2))
|
|
23
|
+
expect(detour.slice(-2)).toEqual(path.slice(-2))
|
|
24
|
+
expect(isPathCollidingWithObstacles(detour, [obstacle])).toBe(false)
|
|
25
|
+
}
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
test("internal segment detours support vertical paths", () => {
|
|
29
|
+
const path = [
|
|
30
|
+
{ x: 0, y: 0 },
|
|
31
|
+
{ x: 0, y: 1 },
|
|
32
|
+
{ x: 0, y: 9 },
|
|
33
|
+
{ x: 0, y: 10 },
|
|
34
|
+
]
|
|
35
|
+
const obstacle = { minX: -0.5, minY: 4, maxX: 0.5, maxY: 6 }
|
|
36
|
+
|
|
37
|
+
const detours = generateInternalSegmentCollisionDetours({
|
|
38
|
+
path,
|
|
39
|
+
collidingSegmentIndex: 1,
|
|
40
|
+
obstacle,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
expect(detours).toHaveLength(2)
|
|
44
|
+
expect(
|
|
45
|
+
detours.every(
|
|
46
|
+
(detour) => !isPathCollidingWithObstacles(detour, [obstacle]),
|
|
47
|
+
),
|
|
48
|
+
).toBe(true)
|
|
49
|
+
})
|