@tscircuit/schematic-trace-solver 0.0.34 → 0.0.35
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 +14 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +19 -0
- package/package.json +2 -2
- package/site/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2_01-example17.page.tsx +324 -0
- package/tests/examples/__snapshots__/example02.snap.svg +5 -8
- package/tests/examples/__snapshots__/example04.snap.svg +15 -12
- package/tests/examples/__snapshots__/example15.snap.svg +5 -8
- package/tests/examples/__snapshots__/example17.snap.svg +13 -16
- package/tests/fixtures/matcher.ts +17 -15
- package/tests/fixtures/preload.ts +1 -0
- package/tests/solvers/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver_repro01.test.ts +1 -1
- package/tests/solvers/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2_01-example17-d1_1-u1_1.test.ts +323 -0
- package/tests/solvers/SchematicTraceSingleLineSolver2/__snapshots__/SchematicTraceSingleLineSolver2_01-example17-d1_1-u1_1.snap.svg +160 -0
package/dist/index.js
CHANGED
|
@@ -842,6 +842,20 @@ var SchematicTraceSingleLineSolver2 = class extends BaseSolver {
|
|
|
842
842
|
chipAlpha: 0.1,
|
|
843
843
|
connectionAlpha: 0.1
|
|
844
844
|
});
|
|
845
|
+
g.lines.push({
|
|
846
|
+
points: this.baseElbow,
|
|
847
|
+
strokeColor: "red",
|
|
848
|
+
strokeDash: "4 4"
|
|
849
|
+
});
|
|
850
|
+
const [pin1, pin2] = this.pins;
|
|
851
|
+
g.lines.push({
|
|
852
|
+
points: [
|
|
853
|
+
{ x: pin1.x, y: pin1.y },
|
|
854
|
+
{ x: pin2.x, y: pin2.y }
|
|
855
|
+
],
|
|
856
|
+
strokeColor: "blue",
|
|
857
|
+
strokeDash: "5 5"
|
|
858
|
+
});
|
|
845
859
|
for (const { path, collisionChipIds: collisionRectIds } of this.queue) {
|
|
846
860
|
g.lines.push({ points: path, strokeColor: "teal", strokeDash: "2 2" });
|
|
847
861
|
}
|
|
@@ -222,6 +222,25 @@ export class SchematicTraceSingleLineSolver2 extends BaseSolver {
|
|
|
222
222
|
connectionAlpha: 0.1,
|
|
223
223
|
})
|
|
224
224
|
|
|
225
|
+
// Draw the base elbow
|
|
226
|
+
|
|
227
|
+
g.lines!.push({
|
|
228
|
+
points: this.baseElbow,
|
|
229
|
+
strokeColor: "red",
|
|
230
|
+
strokeDash: "4 4",
|
|
231
|
+
})
|
|
232
|
+
|
|
233
|
+
// Draw the MSP pair connection with a dashed line
|
|
234
|
+
const [pin1, pin2] = this.pins
|
|
235
|
+
g.lines!.push({
|
|
236
|
+
points: [
|
|
237
|
+
{ x: pin1.x, y: pin1.y },
|
|
238
|
+
{ x: pin2.x, y: pin2.y },
|
|
239
|
+
],
|
|
240
|
+
strokeColor: "blue",
|
|
241
|
+
strokeDash: "5 5",
|
|
242
|
+
})
|
|
243
|
+
|
|
225
244
|
// Draw all the new candidates
|
|
226
245
|
for (const { path, collisionChipIds: collisionRectIds } of this.queue) {
|
|
227
246
|
g.lines!.push({ points: path, strokeColor: "teal", strokeDash: "2 2" })
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/schematic-trace-solver",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.35",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "cosmos",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"@tscircuit/math-utils": "^0.0.19",
|
|
16
16
|
"@types/bun": "^1.2.21",
|
|
17
17
|
"bun-match-svg": "^0.0.13",
|
|
18
|
-
"calculate-elbow": "^0.0.
|
|
18
|
+
"calculate-elbow": "^0.0.12",
|
|
19
19
|
"connectivity-map": "^1.0.0",
|
|
20
20
|
"flatbush": "^4.5.0",
|
|
21
21
|
"graphics-debug": "^0.0.62",
|
package/site/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2_01-example17.page.tsx
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
import { useMemo } from "react"
|
|
2
|
+
import { GenericSolverDebugger } from "../components/GenericSolverDebugger"
|
|
3
|
+
import { SchematicTraceSingleLineSolver2 } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2"
|
|
4
|
+
|
|
5
|
+
export const inputProblem = {
|
|
6
|
+
chipMap: {
|
|
7
|
+
schematic_component_0: {
|
|
8
|
+
chipId: "schematic_component_0",
|
|
9
|
+
center: {
|
|
10
|
+
x: 0,
|
|
11
|
+
y: 0,
|
|
12
|
+
},
|
|
13
|
+
width: 2.3,
|
|
14
|
+
height: 1,
|
|
15
|
+
pins: [
|
|
16
|
+
{
|
|
17
|
+
pinId: "U1.1",
|
|
18
|
+
x: -1.15,
|
|
19
|
+
y: 0.30000000000000004,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
pinId: "U1.2",
|
|
23
|
+
x: -1.15,
|
|
24
|
+
y: 0.10000000000000003,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
pinId: "U1.3",
|
|
28
|
+
x: -1.15,
|
|
29
|
+
y: -0.09999999999999998,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
pinId: "U1.4",
|
|
33
|
+
x: -1.15,
|
|
34
|
+
y: -0.30000000000000004,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
pinId: "U1.5",
|
|
38
|
+
x: 1.15,
|
|
39
|
+
y: -0.30000000000000004,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
pinId: "U1.6",
|
|
43
|
+
x: 1.15,
|
|
44
|
+
y: -0.10000000000000003,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
pinId: "U1.7",
|
|
48
|
+
x: 1.15,
|
|
49
|
+
y: 0.09999999999999998,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
pinId: "U1.8",
|
|
53
|
+
x: 1.15,
|
|
54
|
+
y: 0.30000000000000004,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
schematic_component_1: {
|
|
59
|
+
chipId: "schematic_component_1",
|
|
60
|
+
center: {
|
|
61
|
+
x: -1.1500000000000004,
|
|
62
|
+
y: 1.6700000000000002,
|
|
63
|
+
},
|
|
64
|
+
width: 1.04,
|
|
65
|
+
height: 1.0400000000000005,
|
|
66
|
+
pins: [
|
|
67
|
+
{
|
|
68
|
+
pinId: "D1.1",
|
|
69
|
+
x: -1.1500000000000004,
|
|
70
|
+
y: 1.15,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
pinId: "D1.2",
|
|
74
|
+
x: -1.1500000000000004,
|
|
75
|
+
y: 2.1900000000000004,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
schematic_component_2: {
|
|
80
|
+
chipId: "schematic_component_2",
|
|
81
|
+
center: {
|
|
82
|
+
x: -2.37,
|
|
83
|
+
y: 0.10000000000000009,
|
|
84
|
+
},
|
|
85
|
+
width: 1.04,
|
|
86
|
+
height: 0.54,
|
|
87
|
+
pins: [
|
|
88
|
+
{
|
|
89
|
+
pinId: "D2.1",
|
|
90
|
+
x: -1.85,
|
|
91
|
+
y: 0.10000000000000002,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
pinId: "D2.2",
|
|
95
|
+
x: -2.89,
|
|
96
|
+
y: 0.10000000000000016,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
schematic_component_3: {
|
|
101
|
+
chipId: "schematic_component_3",
|
|
102
|
+
center: {
|
|
103
|
+
x: 2.4,
|
|
104
|
+
y: -0.3000000000000007,
|
|
105
|
+
},
|
|
106
|
+
width: 1.1000000000000005,
|
|
107
|
+
height: 0.84,
|
|
108
|
+
pins: [
|
|
109
|
+
{
|
|
110
|
+
pinId: "C1.1",
|
|
111
|
+
x: 1.8499999999999996,
|
|
112
|
+
y: -0.3000000000000007,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
pinId: "C1.2",
|
|
116
|
+
x: 2.95,
|
|
117
|
+
y: -0.3000000000000007,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
schematic_component_4: {
|
|
122
|
+
chipId: "schematic_component_4",
|
|
123
|
+
center: {
|
|
124
|
+
x: 4.2,
|
|
125
|
+
y: -0.3000000000000007,
|
|
126
|
+
},
|
|
127
|
+
width: 1.0999999999999996,
|
|
128
|
+
height: 0.84,
|
|
129
|
+
pins: [
|
|
130
|
+
{
|
|
131
|
+
pinId: "C2.1",
|
|
132
|
+
x: 3.6500000000000004,
|
|
133
|
+
y: -0.3000000000000007,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
pinId: "C2.2",
|
|
137
|
+
x: 4.75,
|
|
138
|
+
y: -0.3000000000000007,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
pins: [
|
|
144
|
+
{
|
|
145
|
+
pinId: "U1.1",
|
|
146
|
+
x: -1.15,
|
|
147
|
+
y: 0.30000000000000004,
|
|
148
|
+
chipId: "schematic_component_0",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
pinId: "D1.1",
|
|
152
|
+
x: -1.1500000000000004,
|
|
153
|
+
y: 1.15,
|
|
154
|
+
chipId: "schematic_component_1",
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
inputProblem: {
|
|
158
|
+
chips: [
|
|
159
|
+
{
|
|
160
|
+
chipId: "schematic_component_0",
|
|
161
|
+
center: {
|
|
162
|
+
x: 0,
|
|
163
|
+
y: 0,
|
|
164
|
+
},
|
|
165
|
+
width: 2.3,
|
|
166
|
+
height: 1,
|
|
167
|
+
pins: [
|
|
168
|
+
{
|
|
169
|
+
pinId: "U1.1",
|
|
170
|
+
x: -1.15,
|
|
171
|
+
y: 0.30000000000000004,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
pinId: "U1.2",
|
|
175
|
+
x: -1.15,
|
|
176
|
+
y: 0.10000000000000003,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
pinId: "U1.3",
|
|
180
|
+
x: -1.15,
|
|
181
|
+
y: -0.09999999999999998,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
pinId: "U1.4",
|
|
185
|
+
x: -1.15,
|
|
186
|
+
y: -0.30000000000000004,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
pinId: "U1.5",
|
|
190
|
+
x: 1.15,
|
|
191
|
+
y: -0.30000000000000004,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
pinId: "U1.6",
|
|
195
|
+
x: 1.15,
|
|
196
|
+
y: -0.10000000000000003,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
pinId: "U1.7",
|
|
200
|
+
x: 1.15,
|
|
201
|
+
y: 0.09999999999999998,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
pinId: "U1.8",
|
|
205
|
+
x: 1.15,
|
|
206
|
+
y: 0.30000000000000004,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
chipId: "schematic_component_1",
|
|
212
|
+
center: {
|
|
213
|
+
x: -1.1500000000000004,
|
|
214
|
+
y: 1.6700000000000002,
|
|
215
|
+
},
|
|
216
|
+
width: 1.04,
|
|
217
|
+
height: 1.0400000000000005,
|
|
218
|
+
pins: [
|
|
219
|
+
{
|
|
220
|
+
pinId: "D1.1",
|
|
221
|
+
x: -1.1500000000000004,
|
|
222
|
+
y: 1.15,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
pinId: "D1.2",
|
|
226
|
+
x: -1.1500000000000004,
|
|
227
|
+
y: 2.1900000000000004,
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
chipId: "schematic_component_2",
|
|
233
|
+
center: {
|
|
234
|
+
x: -2.37,
|
|
235
|
+
y: 0.10000000000000009,
|
|
236
|
+
},
|
|
237
|
+
width: 1.04,
|
|
238
|
+
height: 0.54,
|
|
239
|
+
pins: [
|
|
240
|
+
{
|
|
241
|
+
pinId: "D2.1",
|
|
242
|
+
x: -1.85,
|
|
243
|
+
y: 0.10000000000000002,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
pinId: "D2.2",
|
|
247
|
+
x: -2.89,
|
|
248
|
+
y: 0.10000000000000016,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
chipId: "schematic_component_3",
|
|
254
|
+
center: {
|
|
255
|
+
x: 2.4,
|
|
256
|
+
y: -0.3000000000000007,
|
|
257
|
+
},
|
|
258
|
+
width: 1.1000000000000005,
|
|
259
|
+
height: 0.84,
|
|
260
|
+
pins: [
|
|
261
|
+
{
|
|
262
|
+
pinId: "C1.1",
|
|
263
|
+
x: 1.8499999999999996,
|
|
264
|
+
y: -0.3000000000000007,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
pinId: "C1.2",
|
|
268
|
+
x: 2.95,
|
|
269
|
+
y: -0.3000000000000007,
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
chipId: "schematic_component_4",
|
|
275
|
+
center: {
|
|
276
|
+
x: 4.2,
|
|
277
|
+
y: -0.3000000000000007,
|
|
278
|
+
},
|
|
279
|
+
width: 1.0999999999999996,
|
|
280
|
+
height: 0.84,
|
|
281
|
+
pins: [
|
|
282
|
+
{
|
|
283
|
+
pinId: "C2.1",
|
|
284
|
+
x: 3.6500000000000004,
|
|
285
|
+
y: -0.3000000000000007,
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
pinId: "C2.2",
|
|
289
|
+
x: 4.75,
|
|
290
|
+
y: -0.3000000000000007,
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
directConnections: [
|
|
296
|
+
{
|
|
297
|
+
pinIds: ["U1.5", "C1.1"],
|
|
298
|
+
netId: ".U1 .VCC to .C1 .pin1",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
pinIds: ["C1.2", "C2.1"],
|
|
302
|
+
netId: ".C1 .pin2 to .C2 .pin1",
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
pinIds: ["U1.1", "D1.1"],
|
|
306
|
+
netId: ".U1 .OUT1 to .D1 .pin1",
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
pinIds: ["U1.2", "D2.1"],
|
|
310
|
+
netId: ".U1 .OUT2 to .D2 .pin1",
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
netConnections: [],
|
|
314
|
+
availableNetLabelOrientations: {},
|
|
315
|
+
maxMspPairDistance: 2.4,
|
|
316
|
+
},
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export default () => {
|
|
320
|
+
const solver = useMemo(() => {
|
|
321
|
+
return new SchematicTraceSingleLineSolver2(inputProblem as any)
|
|
322
|
+
}, [])
|
|
323
|
+
return <GenericSolverDebugger solver={solver} />
|
|
324
|
+
}
|
|
@@ -62,10 +62,7 @@ x+" data-x="1" data-y="0.1" cx="500.20151295522464" cy="324.189420823755" r="3"
|
|
|
62
62
|
<circle data-type="point" data-label="" data-x="1.9148566499999995" data-y="-1.0024186000000008" cx="577.6301897281687" cy="417.4923589921354" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
63
63
|
</g>
|
|
64
64
|
<g>
|
|
65
|
-
<circle data-type="point" data-label="" data-x="1" data-y="0.
|
|
66
|
-
</g>
|
|
67
|
-
<g>
|
|
68
|
-
<circle data-type="point" data-label="" data-x="1.9143099500000003" data-y="0.09999999999999964" cx="577.5839199026265" cy="324.189420823755" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
65
|
+
<circle data-type="point" data-label="" data-x="1.4571549750000001" data-y="0.29999999999999966" cx="538.8927164289255" cy="307.26246800050245" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
69
66
|
</g>
|
|
70
67
|
<g>
|
|
71
68
|
<polyline data-points="-1,0.2 -1.9148566499999995,1.1024186000000005" data-type="line" data-label="" points="330.93198472269955,315.7259444121287 253.50330794975545,239.34995906700078" fill="none" stroke="hsl(248, 100%, 50%, 0.8)" stroke-width="1" />
|
|
@@ -175,6 +172,9 @@ x+" data-x="1" data-y="0.1" cx="500.20151295522464" cy="324.189420823755" r="3"
|
|
|
175
172
|
<g>
|
|
176
173
|
<polyline data-points="-1,0 -1.0999999999999999,0 -1.0999999999999999,-0.09999999999999995 -1.9143099500000003,-0.09999999999999995 -1.9143099500000003,0" data-type="line" data-label="" points="330.93198472269955,332.6528972353812 322.4685083110733,332.6528972353812 322.4685083110733,341.11637364700744 253.54957777529776,341.11637364700744 253.54957777529776,332.6528972353812" fill="none" stroke="purple" stroke-width="1" />
|
|
177
174
|
</g>
|
|
175
|
+
<g>
|
|
176
|
+
<polyline data-points="1,0.1 1.4571549750000001,0.1 1.4571549750000001,0.29999999999999966 1.9143099500000003,0.29999999999999966 1.9143099500000003,0.09999999999999964" data-type="line" data-label="" points="500.20151295522464,324.189420823755 538.8927164289255,324.189420823755 538.8927164289255,307.26246800050245 577.5839199026265,307.26246800050245 577.5839199026265,324.189420823755" fill="none" stroke="purple" stroke-width="1" />
|
|
177
|
+
</g>
|
|
178
178
|
<g>
|
|
179
179
|
<rect data-type="rect" data-label="schematic_component_0" data-x="-1.9145832999999999" data-y="0.5512093000000002" x="231.13349767792428" y="239.34995906700078" width="44.78589036920462" height="93.30293816838042" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.011815475714285715" />
|
|
180
180
|
</g>
|
|
@@ -200,10 +200,7 @@ x+" data-x="1" data-y="0.1" cx="500.20151295522464" cy="324.189420823755" r="3"
|
|
|
200
200
|
<rect data-type="rect" data-label="" data-x="1.9148566499999995" data-y="-1.2284186000000008" x="569.1667133165424" y="417.5769937562517" width="16.926952823252577" height="38.08564385231813" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
|
|
201
201
|
</g>
|
|
202
202
|
<g>
|
|
203
|
-
<rect data-type="rect" data-label="" data-x="1.
|
|
204
|
-
</g>
|
|
205
|
-
<g>
|
|
206
|
-
<rect data-type="rect" data-label="" data-x="1.9143099500000003" data-y="0.3259999999999996" x="569.1204434910002" y="286.01914220732056" width="16.926952823252464" height="38.085643852318185" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
|
|
203
|
+
<rect data-type="rect" data-label="" data-x="1.4571549750000001" data-y="0.5249999999999997" x="530.4292400172993" y="269.1768241481843" width="16.926952823252464" height="38.08564385231813" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
|
|
207
204
|
</g>
|
|
208
205
|
<g id="crosshair" style="display: none">
|
|
209
206
|
<line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
|
|
@@ -2,30 +2,33 @@
|
|
|
2
2
|
<rect width="100%" height="100%" fill="white" />
|
|
3
3
|
<g>
|
|
4
4
|
<circle data-type="point" data-label="Q1.1
|
|
5
|
-
y+" data-x="0.30397715550000004" data-y="0.5800832909999993" cx="
|
|
5
|
+
y+" data-x="0.30397715550000004" data-y="0.5800832909999993" cx="402.5477478715151" cy="162.47313199841204" r="3" fill="hsl(315, 100%, 50%, 0.8)" />
|
|
6
6
|
</g>
|
|
7
7
|
<g>
|
|
8
8
|
<circle data-type="point" data-label="Q1.2
|
|
9
|
-
y-" data-x="0.31067575550000137" data-y="-0.5800832909999993" cx="
|
|
9
|
+
y-" data-x="0.31067575550000137" data-y="-0.5800832909999993" cx="404.36681333050564" cy="477.52686800158796" r="3" fill="hsl(316, 100%, 50%, 0.8)" />
|
|
10
10
|
</g>
|
|
11
11
|
<g>
|
|
12
12
|
<circle data-type="point" data-label="Q1.3
|
|
13
|
-
x-" data-x="-0.4467558855000001" data-y="-0.10250625000000019" cx="
|
|
13
|
+
x-" data-x="-0.4467558855000001" data-y="-0.10250625000000019" cx="198.67939570751895" cy="347.8364999709806" r="3" fill="hsl(317, 100%, 50%, 0.8)" />
|
|
14
14
|
</g>
|
|
15
15
|
<g>
|
|
16
|
-
<circle data-type="point" data-label="" data-x="0.30397715550000004" data-y="0.
|
|
16
|
+
<circle data-type="point" data-label="" data-x="0.30397715550000004" data-y="0.5800832909999993" cx="402.5477478715151" cy="162.47313199841204" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
17
17
|
</g>
|
|
18
18
|
<g>
|
|
19
|
-
<
|
|
19
|
+
<circle data-type="point" data-label="" data-x="0.31067575550000137" data-y="-0.5800832909999993" cx="404.36681333050564" cy="477.52686800158796" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
20
20
|
</g>
|
|
21
21
|
<g>
|
|
22
|
-
<polyline data-points="0.30397715550000004,0.5800832909999993 0.
|
|
22
|
+
<polyline data-points="0.30397715550000004,0.5800832909999993 0.31067575550000137,-0.5800832909999993" data-type="line" data-label="" points="402.5477478715151,162.47313199841204 404.36681333050564,477.52686800158796" fill="none" stroke="hsl(73, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
23
23
|
</g>
|
|
24
24
|
<g>
|
|
25
|
-
<rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="
|
|
25
|
+
<rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="198.67939570751895" y="162.47313199841204" width="242.6412085849621" height="315.0537360031759" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.003682440324999998" />
|
|
26
26
|
</g>
|
|
27
27
|
<g>
|
|
28
|
-
<rect data-type="rect" data-label="" data-x="0.30397715550000004" data-y="
|
|
28
|
+
<rect data-type="rect" data-label="" data-x="0.30397715550000004" data-y="0.8060832909999993" x="375.3918427720889" y="40" width="54.311810198852356" height="122.20157294741779" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.003682440324999998" />
|
|
29
|
+
</g>
|
|
30
|
+
<g>
|
|
31
|
+
<rect data-type="rect" data-label="" data-x="0.31067575550000137" data-y="-0.8060832909999993" x="377.2109082310795" y="477.7984270525822" width="54.3118101988523" height="122.20157294741779" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.003682440324999998" />
|
|
29
32
|
</g>
|
|
30
33
|
<g id="crosshair" style="display: none">
|
|
31
34
|
<line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
|
|
@@ -55,12 +58,12 @@ x-" data-x="-0.4467558855000001" data-y="-0.10250625000000019" cx="167.682625598
|
|
|
55
58
|
|
|
56
59
|
// Calculate real coordinates using inverse transformation
|
|
57
60
|
const matrix = {
|
|
58
|
-
"a":
|
|
61
|
+
"a": 271.55905099426167,
|
|
59
62
|
"c": 0,
|
|
60
|
-
"e":
|
|
63
|
+
"e": 320,
|
|
61
64
|
"b": 0,
|
|
62
|
-
"d": -
|
|
63
|
-
"f":
|
|
65
|
+
"d": -271.55905099426167,
|
|
66
|
+
"f": 320
|
|
64
67
|
};
|
|
65
68
|
// Manually invert and apply the affine transform
|
|
66
69
|
// Since we only use translate and scale, we can directly compute:
|
|
@@ -332,10 +332,7 @@ y-" data-x="-2.025" data-y="-2.7" cx="318.5204755614267" cy="526.0237780713342"
|
|
|
332
332
|
<circle data-type="point" data-label="" data-x="-2.025" data-y="-1.4000000000000004" cx="318.5204755614267" cy="461.9110523998238" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
333
333
|
</g>
|
|
334
334
|
<g>
|
|
335
|
-
<circle data-type="point" data-label="" data-x="-2.025" data-y="2.
|
|
336
|
-
</g>
|
|
337
|
-
<g>
|
|
338
|
-
<circle data-type="point" data-label="" data-x="-1.1099999999999999" data-y="2.0000000000000018" cx="363.6459709379128" cy="294.23161602818135" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
335
|
+
<circle data-type="point" data-label="" data-x="-2.025" data-y="2.200000000000001" cx="318.5204755614267" cy="284.36811977102593" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
339
336
|
</g>
|
|
340
337
|
<g>
|
|
341
338
|
<circle data-type="point" data-label="" data-x="0.29250000000000076" data-y="5.205000000000002" cx="432.8137384412153" cy="136.16908850726549" r="3" fill="hsl(80, 100%, 50%, 0.9)" />
|
|
@@ -811,6 +808,9 @@ y-" data-x="-2.025" data-y="-2.7" cx="318.5204755614267" cy="526.0237780713342"
|
|
|
811
808
|
<g>
|
|
812
809
|
<polyline data-points="-1.1099999999999999,2.600000000000002 -1.3099999999999998,2.600000000000002 -1.3099999999999998,2.8000000000000016 -1.1099999999999999,2.8000000000000016" data-type="line" data-label="" points="363.6459709379128,264.64112725671504 353.7824746807574,264.64112725671504 353.7824746807574,254.77763099955962 363.6459709379128,254.77763099955962" fill="none" stroke="purple" stroke-width="1" />
|
|
813
810
|
</g>
|
|
811
|
+
<g>
|
|
812
|
+
<polyline data-points="-2.025,2.000000000000001 -2.025,2.200000000000001 -1.3099999999999998,2.200000000000001 -1.3099999999999998,2.0000000000000018 -1.1099999999999999,2.0000000000000018" data-type="line" data-label="" points="318.5204755614267,294.2316160281814 318.5204755614267,284.36811977102593 353.7824746807574,284.36811977102593 353.7824746807574,294.23161602818135 363.6459709379128,294.23161602818135" fill="none" stroke="purple" stroke-width="1" />
|
|
813
|
+
</g>
|
|
814
814
|
<g>
|
|
815
815
|
<polyline data-points="-2.025,-1.6000000000000003 -2.025,-1.4000000000000004 -1.3099999999999998,-1.4000000000000004 -1.3099999999999998,-1.6000000000000008 -1.1099999999999997,-1.6000000000000008" data-type="line" data-label="" points="318.5204755614267,471.7745486569793 318.5204755614267,461.9110523998238 353.7824746807574,461.9110523998238 353.7824746807574,471.7745486569793 363.6459709379128,471.7745486569793" fill="none" stroke="purple" stroke-width="1" />
|
|
816
816
|
</g>
|
|
@@ -887,10 +887,7 @@ y-" data-x="-2.025" data-y="-2.7" cx="318.5204755614267" cy="526.0237780713342"
|
|
|
887
887
|
<rect data-type="rect" data-label="" data-x="-2.25" data-y="-1.4000000000000004" x="296.327608982827" y="456.97930427124606" width="22.192866578599705" height="9.863496257155475" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020276785714285723" />
|
|
888
888
|
</g>
|
|
889
889
|
<g>
|
|
890
|
-
<rect data-type="rect" data-label="" data-x="-2.
|
|
891
|
-
</g>
|
|
892
|
-
<g>
|
|
893
|
-
<rect data-type="rect" data-label="" data-x="-1.3359999999999999" data-y="2.0000000000000018" x="341.4037868780273" y="289.2998678996036" width="22.192866578599762" height="9.863496257155418" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020276785714285723" />
|
|
890
|
+
<rect data-type="rect" data-label="" data-x="-2.25" data-y="2.200000000000001" x="296.327608982827" y="279.4363716424482" width="22.192866578599705" height="9.863496257155475" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020276785714285723" />
|
|
894
891
|
</g>
|
|
895
892
|
<g>
|
|
896
893
|
<rect data-type="rect" data-label="" data-x="0.29250000000000076" data-y="4.980000000000002" x="427.8819903126376" y="136.16908850726549" width="9.863496257155475" height="22.192866578599705" fill="hsl(80, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020276785714285723" />
|
|
@@ -65,19 +65,16 @@ x-" data-x="3.6500000000000004" data-y="-0.3000000000000007" cx="519.37172774869
|
|
|
65
65
|
x+" data-x="4.75" data-y="-0.3000000000000007" cx="600" cy="395.8638743455498" r="3" fill="hsl(3, 100%, 50%, 0.8)" />
|
|
66
66
|
</g>
|
|
67
67
|
<g>
|
|
68
|
-
<circle data-type="point" data-label="" data-x="1.3499999999999999" data-y="
|
|
68
|
+
<circle data-type="point" data-label="" data-x="-1.3499999999999999" data-y="0.30000000000000004" cx="152.87958115183247" cy="351.8848167539267" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
69
69
|
</g>
|
|
70
70
|
<g>
|
|
71
|
-
<circle data-type="point" data-label="" data-x="
|
|
72
|
-
</g>
|
|
73
|
-
<g>
|
|
74
|
-
<circle data-type="point" data-label="" data-x="-1.15" data-y="0.30000000000000004" cx="167.5392670157068" cy="351.8848167539267" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
71
|
+
<circle data-type="point" data-label="" data-x="-1.5" data-y="0.10000000000000003" cx="141.8848167539267" cy="366.5445026178011" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
75
72
|
</g>
|
|
76
73
|
<g>
|
|
77
|
-
<circle data-type="point" data-label="" data-x="
|
|
74
|
+
<circle data-type="point" data-label="" data-x="1.4999999999999998" data-y="-0.3000000000000004" cx="361.78010471204186" cy="395.8638743455498" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
78
75
|
</g>
|
|
79
76
|
<g>
|
|
80
|
-
<circle data-type="point" data-label="" data-x="
|
|
77
|
+
<circle data-type="point" data-label="" data-x="3.3000000000000003" data-y="-0.3000000000000007" cx="493.717277486911" cy="395.8638743455498" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
81
78
|
</g>
|
|
82
79
|
<g>
|
|
83
80
|
<polyline data-points="1.15,-0.30000000000000004 1.8499999999999996,-0.3000000000000007" data-type="line" data-label="" points="336.1256544502618,395.86387434554973 387.43455497382195,395.8638743455498" fill="none" stroke="hsl(160, 100%, 50%, 0.8)" stroke-width="1" />
|
|
@@ -92,13 +89,16 @@ x+" data-x="4.75" data-y="-0.3000000000000007" cx="600" cy="395.8638743455498" r
|
|
|
92
89
|
<polyline data-points="-1.15,0.10000000000000003 -1.85,0.10000000000000002" data-type="line" data-label="" points="167.5392670157068,366.5445026178011 116.2303664921466,366.5445026178011" fill="none" stroke="hsl(48, 100%, 50%, 0.8)" stroke-width="1" />
|
|
93
90
|
</g>
|
|
94
91
|
<g>
|
|
95
|
-
<polyline data-points="1.15,-0.30000000000000004 1.
|
|
92
|
+
<polyline data-points="1.15,-0.30000000000000004 1.8499999999999996,-0.3000000000000007" data-type="line" data-label="" points="336.1256544502618,395.86387434554973 387.43455497382195,395.8638743455498" fill="none" stroke="purple" stroke-width="1" />
|
|
96
93
|
</g>
|
|
97
94
|
<g>
|
|
98
95
|
<polyline data-points="2.95,-0.3000000000000007 3.6500000000000004,-0.3000000000000007" data-type="line" data-label="" points="468.0628272251309,395.8638743455498 519.3717277486911,395.8638743455498" fill="none" stroke="purple" stroke-width="1" />
|
|
99
96
|
</g>
|
|
100
97
|
<g>
|
|
101
|
-
<polyline data-points="-1.15,0.
|
|
98
|
+
<polyline data-points="-1.15,0.30000000000000004 -1.3499999999999999,0.30000000000000004 -1.3499999999999999,0.7250000000000001 -1.1500000000000004,0.7250000000000001 -1.1500000000000004,1.15" data-type="line" data-label="" points="167.5392670157068,351.8848167539267 152.87958115183247,351.8848167539267 152.87958115183247,320.73298429319374 167.5392670157068,320.73298429319374 167.5392670157068,289.58115183246076" fill="none" stroke="purple" stroke-width="1" />
|
|
99
|
+
</g>
|
|
100
|
+
<g>
|
|
101
|
+
<polyline data-points="-1.15,0.10000000000000003 -1.85,0.10000000000000002" data-type="line" data-label="" points="167.5392670157068,366.5445026178011 116.2303664921466,366.5445026178011" fill="none" stroke="purple" stroke-width="1" />
|
|
102
102
|
</g>
|
|
103
103
|
<g>
|
|
104
104
|
<rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="167.5392670157068" y="337.22513089005236" width="168.58638743455498" height="73.29842931937173" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013642857142857144" />
|
|
@@ -116,19 +116,16 @@ x+" data-x="4.75" data-y="-0.3000000000000007" cx="600" cy="395.8638743455498" r
|
|
|
116
116
|
<rect data-type="rect" data-label="schematic_component_4" data-x="4.2" data-y="-0.3000000000000007" x="519.3717277486911" y="365.07853403141365" width="80.62827225130889" height="61.57068062827227" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013642857142857144" />
|
|
117
117
|
</g>
|
|
118
118
|
<g>
|
|
119
|
-
<rect data-type="rect" data-label="" data-x="1.
|
|
119
|
+
<rect data-type="rect" data-label="" data-x="-1.575" data-y="0.30000000000000004" x="119.89528795811518" y="344.5549738219895" width="32.98429319371729" height="14.659685863874358" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013642857142857144" />
|
|
120
120
|
</g>
|
|
121
121
|
<g>
|
|
122
|
-
<rect data-type="rect" data-label="" data-x="
|
|
122
|
+
<rect data-type="rect" data-label="" data-x="-1.5" data-y="0.32500000000000007" x="134.55497382198953" y="333.5602094240838" width="14.65968586387433" height="32.98429319371729" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013642857142857144" />
|
|
123
123
|
</g>
|
|
124
124
|
<g>
|
|
125
|
-
<rect data-type="rect" data-label="" data-x="
|
|
125
|
+
<rect data-type="rect" data-label="" data-x="1.4999999999999998" data-y="-0.07500000000000037" x="354.45026178010465" y="362.8795811518325" width="14.659685863874358" height="32.98429319371729" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013642857142857144" />
|
|
126
126
|
</g>
|
|
127
127
|
<g>
|
|
128
|
-
<rect data-type="rect" data-label="" data-x="
|
|
129
|
-
</g>
|
|
130
|
-
<g>
|
|
131
|
-
<rect data-type="rect" data-label="" data-x="-1.3499999999999999" data-y="0.32500000000000007" x="145.5497382198953" y="333.5602094240838" width="14.659685863874358" height="32.98429319371729" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013642857142857144" />
|
|
128
|
+
<rect data-type="rect" data-label="" data-x="3.3000000000000003" data-y="-0.0750000000000007" x="486.38743455497377" y="362.8795811518325" width="14.659685863874415" height="32.98429319371729" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013642857142857144" />
|
|
132
129
|
</g>
|
|
133
130
|
<g id="crosshair" style="display: none">
|
|
134
131
|
<line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
|
|
@@ -25,21 +25,23 @@ async function toMatchSolverSnapshot(
|
|
|
25
25
|
return Math.max(acc, elm.step ?? 0)
|
|
26
26
|
}, 0)
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
28
|
+
if (lastStep !== 0) {
|
|
29
|
+
graphicsObject.points = graphicsObject.points?.filter(
|
|
30
|
+
(p) => p.step === lastStep,
|
|
31
|
+
)
|
|
32
|
+
graphicsObject.lines = graphicsObject.lines?.filter(
|
|
33
|
+
(l) => l.step === lastStep,
|
|
34
|
+
)
|
|
35
|
+
graphicsObject.rects = graphicsObject.rects?.filter(
|
|
36
|
+
(r) => r.step === lastStep,
|
|
37
|
+
)
|
|
38
|
+
graphicsObject.circles = graphicsObject.circles?.filter(
|
|
39
|
+
(c) => c.step === lastStep,
|
|
40
|
+
)
|
|
41
|
+
graphicsObject.texts = graphicsObject.texts?.filter(
|
|
42
|
+
(t) => t.step === lastStep,
|
|
43
|
+
)
|
|
44
|
+
}
|
|
43
45
|
|
|
44
46
|
const svg = getSvgFromGraphicsObject(graphicsObject, {
|
|
45
47
|
backgroundColor: "white",
|
package/tests/solvers/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver_repro01.test.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { test, expect } from "bun:test"
|
|
|
2
2
|
import input from "./SchematicTraceSingleLineSolver_repro01.json"
|
|
3
3
|
import { SchematicTraceSingleLineSolver } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver"
|
|
4
4
|
|
|
5
|
-
test("SchematicTraceSingleLineSolver_repro01", () => {
|
|
5
|
+
test.skip("SchematicTraceSingleLineSolver_repro01", () => {
|
|
6
6
|
const solver = new SchematicTraceSingleLineSolver(input as any)
|
|
7
7
|
solver.solve()
|
|
8
8
|
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { SchematicTraceSingleLineSolver2 } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2"
|
|
2
|
+
import { test, expect } from "bun:test"
|
|
3
|
+
|
|
4
|
+
test("SchematicTraceSingleLineSolver2 should solve problem correctly", () => {
|
|
5
|
+
const input = {
|
|
6
|
+
chipMap: {
|
|
7
|
+
schematic_component_0: {
|
|
8
|
+
chipId: "schematic_component_0",
|
|
9
|
+
center: {
|
|
10
|
+
x: 0,
|
|
11
|
+
y: 0,
|
|
12
|
+
},
|
|
13
|
+
width: 2.3,
|
|
14
|
+
height: 1,
|
|
15
|
+
pins: [
|
|
16
|
+
{
|
|
17
|
+
pinId: "U1.1",
|
|
18
|
+
x: -1.15,
|
|
19
|
+
y: 0.30000000000000004,
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
pinId: "U1.2",
|
|
23
|
+
x: -1.15,
|
|
24
|
+
y: 0.10000000000000003,
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
pinId: "U1.3",
|
|
28
|
+
x: -1.15,
|
|
29
|
+
y: -0.09999999999999998,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
pinId: "U1.4",
|
|
33
|
+
x: -1.15,
|
|
34
|
+
y: -0.30000000000000004,
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
pinId: "U1.5",
|
|
38
|
+
x: 1.15,
|
|
39
|
+
y: -0.30000000000000004,
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
pinId: "U1.6",
|
|
43
|
+
x: 1.15,
|
|
44
|
+
y: -0.10000000000000003,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
pinId: "U1.7",
|
|
48
|
+
x: 1.15,
|
|
49
|
+
y: 0.09999999999999998,
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
pinId: "U1.8",
|
|
53
|
+
x: 1.15,
|
|
54
|
+
y: 0.30000000000000004,
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
schematic_component_1: {
|
|
59
|
+
chipId: "schematic_component_1",
|
|
60
|
+
center: {
|
|
61
|
+
x: -1.1500000000000004,
|
|
62
|
+
y: 1.6700000000000002,
|
|
63
|
+
},
|
|
64
|
+
width: 1.04,
|
|
65
|
+
height: 1.0400000000000005,
|
|
66
|
+
pins: [
|
|
67
|
+
{
|
|
68
|
+
pinId: "D1.1",
|
|
69
|
+
x: -1.1500000000000004,
|
|
70
|
+
y: 1.15,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
pinId: "D1.2",
|
|
74
|
+
x: -1.1500000000000004,
|
|
75
|
+
y: 2.1900000000000004,
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
schematic_component_2: {
|
|
80
|
+
chipId: "schematic_component_2",
|
|
81
|
+
center: {
|
|
82
|
+
x: -2.37,
|
|
83
|
+
y: 0.10000000000000009,
|
|
84
|
+
},
|
|
85
|
+
width: 1.04,
|
|
86
|
+
height: 0.54,
|
|
87
|
+
pins: [
|
|
88
|
+
{
|
|
89
|
+
pinId: "D2.1",
|
|
90
|
+
x: -1.85,
|
|
91
|
+
y: 0.10000000000000002,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
pinId: "D2.2",
|
|
95
|
+
x: -2.89,
|
|
96
|
+
y: 0.10000000000000016,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
schematic_component_3: {
|
|
101
|
+
chipId: "schematic_component_3",
|
|
102
|
+
center: {
|
|
103
|
+
x: 2.4,
|
|
104
|
+
y: -0.3000000000000007,
|
|
105
|
+
},
|
|
106
|
+
width: 1.1000000000000005,
|
|
107
|
+
height: 0.84,
|
|
108
|
+
pins: [
|
|
109
|
+
{
|
|
110
|
+
pinId: "C1.1",
|
|
111
|
+
x: 1.8499999999999996,
|
|
112
|
+
y: -0.3000000000000007,
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
pinId: "C1.2",
|
|
116
|
+
x: 2.95,
|
|
117
|
+
y: -0.3000000000000007,
|
|
118
|
+
},
|
|
119
|
+
],
|
|
120
|
+
},
|
|
121
|
+
schematic_component_4: {
|
|
122
|
+
chipId: "schematic_component_4",
|
|
123
|
+
center: {
|
|
124
|
+
x: 4.2,
|
|
125
|
+
y: -0.3000000000000007,
|
|
126
|
+
},
|
|
127
|
+
width: 1.0999999999999996,
|
|
128
|
+
height: 0.84,
|
|
129
|
+
pins: [
|
|
130
|
+
{
|
|
131
|
+
pinId: "C2.1",
|
|
132
|
+
x: 3.6500000000000004,
|
|
133
|
+
y: -0.3000000000000007,
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
pinId: "C2.2",
|
|
137
|
+
x: 4.75,
|
|
138
|
+
y: -0.3000000000000007,
|
|
139
|
+
},
|
|
140
|
+
],
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
pins: [
|
|
144
|
+
{
|
|
145
|
+
pinId: "U1.1",
|
|
146
|
+
x: -1.15,
|
|
147
|
+
y: 0.30000000000000004,
|
|
148
|
+
chipId: "schematic_component_0",
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
pinId: "D1.1",
|
|
152
|
+
x: -1.1500000000000004,
|
|
153
|
+
y: 1.15,
|
|
154
|
+
chipId: "schematic_component_1",
|
|
155
|
+
},
|
|
156
|
+
],
|
|
157
|
+
inputProblem: {
|
|
158
|
+
chips: [
|
|
159
|
+
{
|
|
160
|
+
chipId: "schematic_component_0",
|
|
161
|
+
center: {
|
|
162
|
+
x: 0,
|
|
163
|
+
y: 0,
|
|
164
|
+
},
|
|
165
|
+
width: 2.3,
|
|
166
|
+
height: 1,
|
|
167
|
+
pins: [
|
|
168
|
+
{
|
|
169
|
+
pinId: "U1.1",
|
|
170
|
+
x: -1.15,
|
|
171
|
+
y: 0.30000000000000004,
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
pinId: "U1.2",
|
|
175
|
+
x: -1.15,
|
|
176
|
+
y: 0.10000000000000003,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
pinId: "U1.3",
|
|
180
|
+
x: -1.15,
|
|
181
|
+
y: -0.09999999999999998,
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
pinId: "U1.4",
|
|
185
|
+
x: -1.15,
|
|
186
|
+
y: -0.30000000000000004,
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
pinId: "U1.5",
|
|
190
|
+
x: 1.15,
|
|
191
|
+
y: -0.30000000000000004,
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
pinId: "U1.6",
|
|
195
|
+
x: 1.15,
|
|
196
|
+
y: -0.10000000000000003,
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
pinId: "U1.7",
|
|
200
|
+
x: 1.15,
|
|
201
|
+
y: 0.09999999999999998,
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
pinId: "U1.8",
|
|
205
|
+
x: 1.15,
|
|
206
|
+
y: 0.30000000000000004,
|
|
207
|
+
},
|
|
208
|
+
],
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
chipId: "schematic_component_1",
|
|
212
|
+
center: {
|
|
213
|
+
x: -1.1500000000000004,
|
|
214
|
+
y: 1.6700000000000002,
|
|
215
|
+
},
|
|
216
|
+
width: 1.04,
|
|
217
|
+
height: 1.0400000000000005,
|
|
218
|
+
pins: [
|
|
219
|
+
{
|
|
220
|
+
pinId: "D1.1",
|
|
221
|
+
x: -1.1500000000000004,
|
|
222
|
+
y: 1.15,
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
pinId: "D1.2",
|
|
226
|
+
x: -1.1500000000000004,
|
|
227
|
+
y: 2.1900000000000004,
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
chipId: "schematic_component_2",
|
|
233
|
+
center: {
|
|
234
|
+
x: -2.37,
|
|
235
|
+
y: 0.10000000000000009,
|
|
236
|
+
},
|
|
237
|
+
width: 1.04,
|
|
238
|
+
height: 0.54,
|
|
239
|
+
pins: [
|
|
240
|
+
{
|
|
241
|
+
pinId: "D2.1",
|
|
242
|
+
x: -1.85,
|
|
243
|
+
y: 0.10000000000000002,
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
pinId: "D2.2",
|
|
247
|
+
x: -2.89,
|
|
248
|
+
y: 0.10000000000000016,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
chipId: "schematic_component_3",
|
|
254
|
+
center: {
|
|
255
|
+
x: 2.4,
|
|
256
|
+
y: -0.3000000000000007,
|
|
257
|
+
},
|
|
258
|
+
width: 1.1000000000000005,
|
|
259
|
+
height: 0.84,
|
|
260
|
+
pins: [
|
|
261
|
+
{
|
|
262
|
+
pinId: "C1.1",
|
|
263
|
+
x: 1.8499999999999996,
|
|
264
|
+
y: -0.3000000000000007,
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
pinId: "C1.2",
|
|
268
|
+
x: 2.95,
|
|
269
|
+
y: -0.3000000000000007,
|
|
270
|
+
},
|
|
271
|
+
],
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
chipId: "schematic_component_4",
|
|
275
|
+
center: {
|
|
276
|
+
x: 4.2,
|
|
277
|
+
y: -0.3000000000000007,
|
|
278
|
+
},
|
|
279
|
+
width: 1.0999999999999996,
|
|
280
|
+
height: 0.84,
|
|
281
|
+
pins: [
|
|
282
|
+
{
|
|
283
|
+
pinId: "C2.1",
|
|
284
|
+
x: 3.6500000000000004,
|
|
285
|
+
y: -0.3000000000000007,
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
pinId: "C2.2",
|
|
289
|
+
x: 4.75,
|
|
290
|
+
y: -0.3000000000000007,
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
directConnections: [
|
|
296
|
+
{
|
|
297
|
+
pinIds: ["U1.5", "C1.1"],
|
|
298
|
+
netId: ".U1 .VCC to .C1 .pin1",
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
pinIds: ["C1.2", "C2.1"],
|
|
302
|
+
netId: ".C1 .pin2 to .C2 .pin1",
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
pinIds: ["U1.1", "D1.1"],
|
|
306
|
+
netId: ".U1 .OUT1 to .D1 .pin1",
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
pinIds: ["U1.2", "D2.1"],
|
|
310
|
+
netId: ".U1 .OUT2 to .D2 .pin1",
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
netConnections: [],
|
|
314
|
+
availableNetLabelOrientations: {},
|
|
315
|
+
maxMspPairDistance: 2.4,
|
|
316
|
+
},
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
const solver = new SchematicTraceSingleLineSolver2(input as any)
|
|
320
|
+
solver.solve()
|
|
321
|
+
|
|
322
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
323
|
+
})
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
<svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="100%" height="100%" fill="white" />
|
|
3
|
+
<g>
|
|
4
|
+
<circle data-type="point" data-label="U1.1
|
|
5
|
+
x-" data-x="-1.15" data-y="0.30000000000000004" cx="167.5392670157068" cy="351.8848167539267" r="3" fill="hsl(319, 100%, 50%, 0.8)" />
|
|
6
|
+
</g>
|
|
7
|
+
<g>
|
|
8
|
+
<circle data-type="point" data-label="U1.2
|
|
9
|
+
x-" data-x="-1.15" data-y="0.10000000000000003" cx="167.5392670157068" cy="366.5445026178011" r="3" fill="hsl(320, 100%, 50%, 0.8)" />
|
|
10
|
+
</g>
|
|
11
|
+
<g>
|
|
12
|
+
<circle data-type="point" data-label="U1.3
|
|
13
|
+
x-" data-x="-1.15" data-y="-0.09999999999999998" cx="167.5392670157068" cy="381.2041884816754" r="3" fill="hsl(321, 100%, 50%, 0.8)" />
|
|
14
|
+
</g>
|
|
15
|
+
<g>
|
|
16
|
+
<circle data-type="point" data-label="U1.4
|
|
17
|
+
x-" data-x="-1.15" data-y="-0.30000000000000004" cx="167.5392670157068" cy="395.86387434554973" r="3" fill="hsl(322, 100%, 50%, 0.8)" />
|
|
18
|
+
</g>
|
|
19
|
+
<g>
|
|
20
|
+
<circle data-type="point" data-label="U1.5
|
|
21
|
+
x+" data-x="1.15" data-y="-0.30000000000000004" cx="336.1256544502618" cy="395.86387434554973" r="3" fill="hsl(323, 100%, 50%, 0.8)" />
|
|
22
|
+
</g>
|
|
23
|
+
<g>
|
|
24
|
+
<circle data-type="point" data-label="U1.6
|
|
25
|
+
x+" data-x="1.15" data-y="-0.10000000000000003" cx="336.1256544502618" cy="381.2041884816754" r="3" fill="hsl(324, 100%, 50%, 0.8)" />
|
|
26
|
+
</g>
|
|
27
|
+
<g>
|
|
28
|
+
<circle data-type="point" data-label="U1.7
|
|
29
|
+
x+" data-x="1.15" data-y="0.09999999999999998" cx="336.1256544502618" cy="366.5445026178011" r="3" fill="hsl(325, 100%, 50%, 0.8)" />
|
|
30
|
+
</g>
|
|
31
|
+
<g>
|
|
32
|
+
<circle data-type="point" data-label="U1.8
|
|
33
|
+
x+" data-x="1.15" data-y="0.30000000000000004" cx="336.1256544502618" cy="351.8848167539267" r="3" fill="hsl(326, 100%, 50%, 0.8)" />
|
|
34
|
+
</g>
|
|
35
|
+
<g>
|
|
36
|
+
<circle data-type="point" data-label="D1.1
|
|
37
|
+
y-" data-x="-1.1500000000000004" data-y="1.15" cx="167.5392670157068" cy="289.58115183246076" r="3" fill="hsl(32, 100%, 50%, 0.8)" />
|
|
38
|
+
</g>
|
|
39
|
+
<g>
|
|
40
|
+
<circle data-type="point" data-label="D1.2
|
|
41
|
+
y+" data-x="-1.1500000000000004" data-y="2.1900000000000004" cx="167.5392670157068" cy="213.35078534031413" r="3" fill="hsl(33, 100%, 50%, 0.8)" />
|
|
42
|
+
</g>
|
|
43
|
+
<g>
|
|
44
|
+
<circle data-type="point" data-label="D2.1
|
|
45
|
+
x+" data-x="-1.85" data-y="0.10000000000000002" cx="116.2303664921466" cy="366.5445026178011" r="3" fill="hsl(273, 100%, 50%, 0.8)" />
|
|
46
|
+
</g>
|
|
47
|
+
<g>
|
|
48
|
+
<circle data-type="point" data-label="D2.2
|
|
49
|
+
x-" data-x="-2.89" data-y="0.10000000000000016" cx="40" cy="366.544502617801" r="3" fill="hsl(274, 100%, 50%, 0.8)" />
|
|
50
|
+
</g>
|
|
51
|
+
<g>
|
|
52
|
+
<circle data-type="point" data-label="C1.1
|
|
53
|
+
x-" data-x="1.8499999999999996" data-y="-0.3000000000000007" cx="387.43455497382195" cy="395.8638743455498" r="3" fill="hsl(121, 100%, 50%, 0.8)" />
|
|
54
|
+
</g>
|
|
55
|
+
<g>
|
|
56
|
+
<circle data-type="point" data-label="C1.2
|
|
57
|
+
x+" data-x="2.95" data-y="-0.3000000000000007" cx="468.0628272251309" cy="395.8638743455498" r="3" fill="hsl(122, 100%, 50%, 0.8)" />
|
|
58
|
+
</g>
|
|
59
|
+
<g>
|
|
60
|
+
<circle data-type="point" data-label="C2.1
|
|
61
|
+
x-" data-x="3.6500000000000004" data-y="-0.3000000000000007" cx="519.3717277486911" cy="395.8638743455498" r="3" fill="hsl(2, 100%, 50%, 0.8)" />
|
|
62
|
+
</g>
|
|
63
|
+
<g>
|
|
64
|
+
<circle data-type="point" data-label="C2.2
|
|
65
|
+
x+" data-x="4.75" data-y="-0.3000000000000007" cx="600" cy="395.8638743455498" r="3" fill="hsl(3, 100%, 50%, 0.8)" />
|
|
66
|
+
</g>
|
|
67
|
+
<g>
|
|
68
|
+
<polyline data-points="1.15,-0.30000000000000004 1.8499999999999996,-0.3000000000000007" data-type="line" data-label="" points="336.1256544502618,395.86387434554973 387.43455497382195,395.8638743455498" fill="none" stroke="hsl(160, 100%, 50%, 0.1)" stroke-width="1" />
|
|
69
|
+
</g>
|
|
70
|
+
<g>
|
|
71
|
+
<polyline data-points="2.95,-0.3000000000000007 3.6500000000000004,-0.3000000000000007" data-type="line" data-label="" points="468.0628272251309,395.8638743455498 519.3717277486911,395.8638743455498" fill="none" stroke="hsl(48, 100%, 50%, 0.1)" stroke-width="1" />
|
|
72
|
+
</g>
|
|
73
|
+
<g>
|
|
74
|
+
<polyline data-points="-1.15,0.30000000000000004 -1.1500000000000004,1.15" data-type="line" data-label="" points="167.5392670157068,351.8848167539267 167.5392670157068,289.58115183246076" fill="none" stroke="hsl(280, 100%, 50%, 0.1)" stroke-width="1" />
|
|
75
|
+
</g>
|
|
76
|
+
<g>
|
|
77
|
+
<polyline data-points="-1.15,0.10000000000000003 -1.85,0.10000000000000002" data-type="line" data-label="" points="167.5392670157068,366.5445026178011 116.2303664921466,366.5445026178011" fill="none" stroke="hsl(48, 100%, 50%, 0.1)" stroke-width="1" />
|
|
78
|
+
</g>
|
|
79
|
+
<g>
|
|
80
|
+
<polyline data-points="-1.15,0.30000000000000004 -1.3499999999999999,0.30000000000000004 -1.3499999999999999,0.7250000000000001 -1.1500000000000004,0.7250000000000001 -1.1500000000000004,1.15" data-type="line" data-label="" points="167.5392670157068,351.8848167539267 152.87958115183247,351.8848167539267 152.87958115183247,320.73298429319374 167.5392670157068,320.73298429319374 167.5392670157068,289.58115183246076" fill="none" stroke="red" stroke-width="1" stroke-dasharray="4 4" />
|
|
81
|
+
</g>
|
|
82
|
+
<g>
|
|
83
|
+
<polyline data-points="-1.15,0.30000000000000004 -1.1500000000000004,1.15" data-type="line" data-label="" points="167.5392670157068,351.8848167539267 167.5392670157068,289.58115183246076" fill="none" stroke="blue" stroke-width="1" stroke-dasharray="5 5" />
|
|
84
|
+
</g>
|
|
85
|
+
<g>
|
|
86
|
+
<polyline data-points="-1.15,0.30000000000000004 -1.3499999999999999,0.30000000000000004 -1.3499999999999999,0.7250000000000001 -1.1500000000000004,0.7250000000000001 -1.1500000000000004,1.15" data-type="line" data-label="" points="167.5392670157068,351.8848167539267 152.87958115183247,351.8848167539267 152.87958115183247,320.73298429319374 167.5392670157068,320.73298429319374 167.5392670157068,289.58115183246076" fill="none" stroke="green" stroke-width="1" />
|
|
87
|
+
</g>
|
|
88
|
+
<g>
|
|
89
|
+
<rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="167.5392670157068" y="337.22513089005236" width="168.58638743455498" height="73.29842931937173" fill="hsl(24, 100%, 50%, 0.1)" stroke="black" stroke-width="0.013642857142857144" />
|
|
90
|
+
</g>
|
|
91
|
+
<g>
|
|
92
|
+
<rect data-type="rect" data-label="schematic_component_1" data-x="-1.1500000000000004" data-y="1.6700000000000002" x="129.42408376963348" y="213.35078534031413" width="76.2303664921466" height="76.23036649214663" fill="hsl(24, 100%, 50%, 0.1)" stroke="black" stroke-width="0.013642857142857144" />
|
|
93
|
+
</g>
|
|
94
|
+
<g>
|
|
95
|
+
<rect data-type="rect" data-label="schematic_component_2" data-x="-2.37" data-y="0.10000000000000009" x="40" y="346.75392670157066" width="76.2303664921466" height="39.58115183246076" fill="hsl(24, 100%, 50%, 0.1)" stroke="black" stroke-width="0.013642857142857144" />
|
|
96
|
+
</g>
|
|
97
|
+
<g>
|
|
98
|
+
<rect data-type="rect" data-label="schematic_component_3" data-x="2.4" data-y="-0.3000000000000007" x="387.43455497382195" y="365.07853403141365" width="80.62827225130894" height="61.57068062827227" fill="hsl(24, 100%, 50%, 0.1)" stroke="black" stroke-width="0.013642857142857144" />
|
|
99
|
+
</g>
|
|
100
|
+
<g>
|
|
101
|
+
<rect data-type="rect" data-label="schematic_component_4" data-x="4.2" data-y="-0.3000000000000007" x="519.3717277486911" y="365.07853403141365" width="80.62827225130889" height="61.57068062827227" fill="hsl(24, 100%, 50%, 0.1)" stroke="black" stroke-width="0.013642857142857144" />
|
|
102
|
+
</g>
|
|
103
|
+
<g id="crosshair" style="display: none">
|
|
104
|
+
<line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
|
|
105
|
+
<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>
|
|
106
|
+
</g>
|
|
107
|
+
<script>
|
|
108
|
+
<![CDATA[
|
|
109
|
+
document.currentScript.parentElement.addEventListener('mousemove', (e) => {
|
|
110
|
+
const svg = e.currentTarget;
|
|
111
|
+
const rect = svg.getBoundingClientRect();
|
|
112
|
+
const x = e.clientX - rect.left;
|
|
113
|
+
const y = e.clientY - rect.top;
|
|
114
|
+
const crosshair = svg.getElementById('crosshair');
|
|
115
|
+
const h = svg.getElementById('crosshair-h');
|
|
116
|
+
const v = svg.getElementById('crosshair-v');
|
|
117
|
+
const coords = svg.getElementById('coordinates');
|
|
118
|
+
|
|
119
|
+
crosshair.style.display = 'block';
|
|
120
|
+
h.setAttribute('x1', '0');
|
|
121
|
+
h.setAttribute('x2', '640');
|
|
122
|
+
h.setAttribute('y1', y);
|
|
123
|
+
h.setAttribute('y2', y);
|
|
124
|
+
v.setAttribute('x1', x);
|
|
125
|
+
v.setAttribute('x2', x);
|
|
126
|
+
v.setAttribute('y1', '0');
|
|
127
|
+
v.setAttribute('y2', '640');
|
|
128
|
+
|
|
129
|
+
// Calculate real coordinates using inverse transformation
|
|
130
|
+
const matrix = {
|
|
131
|
+
"a": 73.29842931937172,
|
|
132
|
+
"c": 0,
|
|
133
|
+
"e": 251.8324607329843,
|
|
134
|
+
"b": 0,
|
|
135
|
+
"d": -73.29842931937172,
|
|
136
|
+
"f": 373.8743455497382
|
|
137
|
+
};
|
|
138
|
+
// Manually invert and apply the affine transform
|
|
139
|
+
// Since we only use translate and scale, we can directly compute:
|
|
140
|
+
// x' = (x - tx) / sx
|
|
141
|
+
// y' = (y - ty) / sy
|
|
142
|
+
const sx = matrix.a;
|
|
143
|
+
const sy = matrix.d;
|
|
144
|
+
const tx = matrix.e;
|
|
145
|
+
const ty = matrix.f;
|
|
146
|
+
const realPoint = {
|
|
147
|
+
x: (x - tx) / sx,
|
|
148
|
+
y: (y - ty) / sy // Flip y back since we used negative scale
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
|
|
152
|
+
coords.setAttribute('x', (x + 5).toString());
|
|
153
|
+
coords.setAttribute('y', (y - 5).toString());
|
|
154
|
+
});
|
|
155
|
+
document.currentScript.parentElement.addEventListener('mouseleave', () => {
|
|
156
|
+
document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
|
|
157
|
+
});
|
|
158
|
+
]]>
|
|
159
|
+
</script>
|
|
160
|
+
</svg>
|