@tscircuit/schematic-trace-solver 0.0.47 → 0.0.48
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 +20 -6
- package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +2 -0
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver_visualize.ts +12 -0
- package/package.json +1 -1
- package/site/examples/example28.page.tsx +61 -0
- package/tests/examples/__snapshots__/example28.snap.svg +23 -189
- package/tests/examples/example28.test.ts +2 -3
package/dist/index.js
CHANGED
|
@@ -1767,6 +1767,7 @@ function visualizeSingleNetLabelPlacementSolver(solver) {
|
|
|
1767
1767
|
for (const c of solver.testedCandidates) {
|
|
1768
1768
|
const fill = c.status === "ok" ? "rgba(0, 180, 0, 0.25)" : c.status === "chip-collision" ? "rgba(220, 0, 0, 0.25)" : c.status === "trace-collision" ? "rgba(220, 140, 0, 0.25)" : "rgba(120, 120, 120, 0.15)";
|
|
1769
1769
|
const stroke = c.status === "ok" ? "green" : c.status === "chip-collision" ? "red" : c.status === "trace-collision" ? "orange" : "gray";
|
|
1770
|
+
const candidateLabel = c.status === "ok" ? "status: ok(valid net label candidate)" : c.status === "chip-collision" ? "status: chip-collision" : c.status === "trace-collision" ? "status: trace-collision" : "status: parallel-to-segment";
|
|
1770
1771
|
graphics.rects.push({
|
|
1771
1772
|
center: {
|
|
1772
1773
|
x: (c.bounds.minX + c.bounds.maxX) / 2,
|
|
@@ -1775,12 +1776,16 @@ function visualizeSingleNetLabelPlacementSolver(solver) {
|
|
|
1775
1776
|
width: c.width,
|
|
1776
1777
|
height: c.height,
|
|
1777
1778
|
fill,
|
|
1778
|
-
strokeColor: stroke
|
|
1779
|
+
strokeColor: stroke,
|
|
1780
|
+
label: `${candidateLabel}
|
|
1781
|
+
orientation: ${c.orientation}`
|
|
1779
1782
|
});
|
|
1780
1783
|
graphics.points.push({
|
|
1781
1784
|
x: c.anchor.x,
|
|
1782
1785
|
y: c.anchor.y,
|
|
1783
|
-
color: stroke
|
|
1786
|
+
color: stroke,
|
|
1787
|
+
label: `anchor
|
|
1788
|
+
orientation: ${c.orientation}`
|
|
1784
1789
|
});
|
|
1785
1790
|
}
|
|
1786
1791
|
if (solver.netLabelPlacement) {
|
|
@@ -1790,12 +1795,16 @@ function visualizeSingleNetLabelPlacementSolver(solver) {
|
|
|
1790
1795
|
width: p.width,
|
|
1791
1796
|
height: p.height,
|
|
1792
1797
|
fill: "rgba(0, 128, 255, 0.35)",
|
|
1793
|
-
strokeColor: "blue"
|
|
1798
|
+
strokeColor: "blue",
|
|
1799
|
+
label: `netId: ${p.netId}
|
|
1800
|
+
globalConnNetId: ${p.globalConnNetId}`
|
|
1794
1801
|
});
|
|
1795
1802
|
graphics.points.push({
|
|
1796
1803
|
x: p.anchorPoint.x,
|
|
1797
1804
|
y: p.anchorPoint.y,
|
|
1798
|
-
color: "blue"
|
|
1805
|
+
color: "blue",
|
|
1806
|
+
label: `anchor
|
|
1807
|
+
orientation: ${p.orientation}`
|
|
1799
1808
|
});
|
|
1800
1809
|
}
|
|
1801
1810
|
return graphics;
|
|
@@ -2248,12 +2257,16 @@ var NetLabelPlacementSolver = class extends BaseSolver {
|
|
|
2248
2257
|
width: p.width,
|
|
2249
2258
|
height: p.height,
|
|
2250
2259
|
fill: getColorFromString(p.globalConnNetId, 0.35),
|
|
2251
|
-
strokeColor: getColorFromString(p.globalConnNetId, 0.9)
|
|
2260
|
+
strokeColor: getColorFromString(p.globalConnNetId, 0.9),
|
|
2261
|
+
label: `netId: ${p.netId}
|
|
2262
|
+
globalConnNetId: ${p.globalConnNetId}`
|
|
2252
2263
|
});
|
|
2253
2264
|
graphics.points.push({
|
|
2254
2265
|
x: p.anchorPoint.x,
|
|
2255
2266
|
y: p.anchorPoint.y,
|
|
2256
|
-
color: getColorFromString(p.globalConnNetId, 0.9)
|
|
2267
|
+
color: getColorFromString(p.globalConnNetId, 0.9),
|
|
2268
|
+
label: `anchorPoint
|
|
2269
|
+
orientation: ${p.orientation}`
|
|
2257
2270
|
});
|
|
2258
2271
|
}
|
|
2259
2272
|
return graphics;
|
|
@@ -3420,6 +3433,7 @@ var LongDistancePairSolver = class extends BaseSolver {
|
|
|
3420
3433
|
}
|
|
3421
3434
|
this.queuedCandidatePairs = candidatePairs;
|
|
3422
3435
|
}
|
|
3436
|
+
params;
|
|
3423
3437
|
solvedLongDistanceTraces = [];
|
|
3424
3438
|
queuedCandidatePairs = [];
|
|
3425
3439
|
currentCandidatePair = null;
|
|
@@ -350,11 +350,13 @@ export class NetLabelPlacementSolver extends BaseSolver {
|
|
|
350
350
|
height: p.height,
|
|
351
351
|
fill: getColorFromString(p.globalConnNetId, 0.35),
|
|
352
352
|
strokeColor: getColorFromString(p.globalConnNetId, 0.9),
|
|
353
|
+
label: `netId: ${p.netId}\nglobalConnNetId: ${p.globalConnNetId}`,
|
|
353
354
|
} as any)
|
|
354
355
|
graphics.points!.push({
|
|
355
356
|
x: p.anchorPoint.x,
|
|
356
357
|
y: p.anchorPoint.y,
|
|
357
358
|
color: getColorFromString(p.globalConnNetId, 0.9),
|
|
359
|
+
label: `anchorPoint\norientation: ${p.orientation}`,
|
|
358
360
|
} as any)
|
|
359
361
|
}
|
|
360
362
|
|
|
@@ -47,6 +47,14 @@ export function visualizeSingleNetLabelPlacementSolver(
|
|
|
47
47
|
: c.status === "trace-collision"
|
|
48
48
|
? "orange"
|
|
49
49
|
: "gray"
|
|
50
|
+
const candidateLabel =
|
|
51
|
+
c.status === "ok"
|
|
52
|
+
? "status: ok(valid net label candidate)"
|
|
53
|
+
: c.status === "chip-collision"
|
|
54
|
+
? "status: chip-collision"
|
|
55
|
+
: c.status === "trace-collision"
|
|
56
|
+
? "status: trace-collision"
|
|
57
|
+
: "status: parallel-to-segment"
|
|
50
58
|
|
|
51
59
|
graphics.rects!.push({
|
|
52
60
|
center: {
|
|
@@ -57,12 +65,14 @@ export function visualizeSingleNetLabelPlacementSolver(
|
|
|
57
65
|
height: c.height,
|
|
58
66
|
fill,
|
|
59
67
|
strokeColor: stroke,
|
|
68
|
+
label: `${candidateLabel}\norientation: ${c.orientation}`,
|
|
60
69
|
} as any)
|
|
61
70
|
|
|
62
71
|
graphics.points!.push({
|
|
63
72
|
x: c.anchor.x,
|
|
64
73
|
y: c.anchor.y,
|
|
65
74
|
color: stroke,
|
|
75
|
+
label: `anchor\norientation: ${c.orientation}`,
|
|
66
76
|
} as any)
|
|
67
77
|
}
|
|
68
78
|
|
|
@@ -75,11 +85,13 @@ export function visualizeSingleNetLabelPlacementSolver(
|
|
|
75
85
|
height: p.height,
|
|
76
86
|
fill: "rgba(0, 128, 255, 0.35)",
|
|
77
87
|
strokeColor: "blue",
|
|
88
|
+
label: `netId: ${p.netId}\nglobalConnNetId: ${p.globalConnNetId}`,
|
|
78
89
|
} as any)
|
|
79
90
|
graphics.points!.push({
|
|
80
91
|
x: p.anchorPoint.x,
|
|
81
92
|
y: p.anchorPoint.y,
|
|
82
93
|
color: "blue",
|
|
94
|
+
label: `anchor\norientation: ${p.orientation}`,
|
|
83
95
|
} as any)
|
|
84
96
|
}
|
|
85
97
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { InputProblem } from "lib/types/InputProblem"
|
|
2
|
+
import { PipelineDebugger } from "site/components/PipelineDebugger"
|
|
3
|
+
|
|
4
|
+
export const inputProblem: InputProblem = {
|
|
5
|
+
chips: [
|
|
6
|
+
{
|
|
7
|
+
chipId: "1",
|
|
8
|
+
center: {
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0,
|
|
11
|
+
},
|
|
12
|
+
width: 0.6,
|
|
13
|
+
height: 0.4,
|
|
14
|
+
pins: [
|
|
15
|
+
{
|
|
16
|
+
pinId: "IN",
|
|
17
|
+
x: -0.3,
|
|
18
|
+
y: 0.1,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
pinId: "GND",
|
|
22
|
+
x: -0.3,
|
|
23
|
+
y: 0,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
pinId: "EN",
|
|
27
|
+
x: -0.3,
|
|
28
|
+
y: -0.1,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
pinId: "OUT",
|
|
32
|
+
x: 0.3,
|
|
33
|
+
y: 0.1,
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
pinId: "NC",
|
|
37
|
+
x: 0.3,
|
|
38
|
+
y: 0,
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
directConnections: [],
|
|
44
|
+
netConnections: [
|
|
45
|
+
{
|
|
46
|
+
netId: "V5_IN",
|
|
47
|
+
pinIds: ["IN", "EN"],
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
netId: "V3P3",
|
|
51
|
+
pinIds: ["OUT"],
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
netId: "GND",
|
|
55
|
+
pinIds: ["GND"],
|
|
56
|
+
},
|
|
57
|
+
],
|
|
58
|
+
availableNetLabelOrientations: {},
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export default () => <PipelineDebugger inputProblem={inputProblem} />
|
|
@@ -1,217 +1,51 @@
|
|
|
1
1
|
<svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg">
|
|
2
2
|
<rect width="100%" height="100%" fill="white" />
|
|
3
3
|
<g>
|
|
4
|
-
<circle data-type="point" data-label="
|
|
5
|
-
|
|
4
|
+
<circle data-type="point" data-label="IN
|
|
5
|
+
x-" data-x="-0.3" data-y="0.1" cx="208.14913448735018" cy="347.96271637816244" r="3" fill="hsl(181, 100%, 50%, 0.8)" />
|
|
6
6
|
</g>
|
|
7
7
|
<g>
|
|
8
|
-
<circle data-type="point" data-label="
|
|
9
|
-
|
|
8
|
+
<circle data-type="point" data-label="GND
|
|
9
|
+
x-" data-x="-0.3" data-y="0" cx="208.14913448735018" cy="385.2463382157124" r="3" fill="hsl(157, 100%, 50%, 0.8)" />
|
|
10
10
|
</g>
|
|
11
11
|
<g>
|
|
12
|
-
<circle data-type="point" data-label="
|
|
13
|
-
x-" data-x="-0.
|
|
12
|
+
<circle data-type="point" data-label="EN
|
|
13
|
+
x-" data-x="-0.3" data-y="-0.1" cx="208.14913448735018" cy="422.52996005326236" r="3" fill="hsl(57, 100%, 50%, 0.8)" />
|
|
14
14
|
</g>
|
|
15
15
|
<g>
|
|
16
|
-
<circle data-type="point" data-label="
|
|
17
|
-
x+" data-x="0.
|
|
16
|
+
<circle data-type="point" data-label="OUT
|
|
17
|
+
x+" data-x="0.3" data-y="0.1" cx="431.8508655126498" cy="347.96271637816244" r="3" fill="hsl(158, 100%, 50%, 0.8)" />
|
|
18
18
|
</g>
|
|
19
19
|
<g>
|
|
20
|
-
<circle data-type="point" data-label="
|
|
21
|
-
x
|
|
20
|
+
<circle data-type="point" data-label="NC
|
|
21
|
+
x+" data-x="0.3" data-y="0" cx="431.8508655126498" cy="385.2463382157124" r="3" fill="hsl(325, 100%, 50%, 0.8)" />
|
|
22
22
|
</g>
|
|
23
23
|
<g>
|
|
24
|
-
<circle data-type="point" data-label="
|
|
25
|
-
x+" data-x="3.52" data-y="3" cx="471.2266869002631" cy="231.45921396000725" r="3" fill="hsl(33, 100%, 50%, 0.8)" />
|
|
24
|
+
<circle data-type="point" data-label="" data-x="-0.4" data-y="0.1" cx="170.86551264980025" cy="347.96271637816244" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
26
25
|
</g>
|
|
27
26
|
<g>
|
|
28
|
-
<circle data-type="point" data-label="
|
|
29
|
-
y-" data-x="3" data-y="-0.49500000000000005" cx="445.8596297427996" cy="401.9551077394974" r="3" fill="hsl(122, 100%, 50%, 0.8)" />
|
|
27
|
+
<circle data-type="point" data-label="" data-x="-0.3" data-y="0" cx="208.14913448735018" cy="385.2463382157124" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
30
28
|
</g>
|
|
31
29
|
<g>
|
|
32
|
-
<circle data-type="point" data-label="
|
|
33
|
-
y+" data-x="3" data-y="0.49500000000000005" cx="445.8596297427996" cy="353.66013353586504" r="3" fill="hsl(121, 100%, 50%, 0.8)" />
|
|
30
|
+
<circle data-type="point" data-label="" data-x="0.3" data-y="0.1" cx="431.8508655126498" cy="347.96271637816244" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
34
31
|
</g>
|
|
35
32
|
<g>
|
|
36
|
-
<
|
|
37
|
-
y+" data-x="6" data-y="0.55" cx="592.2080364204736" cy="350.977079413441" r="3" fill="hsl(226, 100%, 50%, 0.8)" />
|
|
33
|
+
<polyline data-points="-0.3,0.1 -0.3,-0.1" data-type="line" data-label="" points="208.14913448735018,347.96271637816244 208.14913448735018,422.52996005326236" fill="none" stroke="hsl(325, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
38
34
|
</g>
|
|
39
35
|
<g>
|
|
40
|
-
<
|
|
41
|
-
y-" data-x="6" data-y="-0.55" cx="592.2080364204736" cy="404.63816186192145" r="3" fill="hsl(227, 100%, 50%, 0.8)" />
|
|
36
|
+
<polyline data-points="-0.3,0.1 -0.5,0.1 -0.5,-0.1 -0.3,-0.1" data-type="line" data-label="" points="208.14913448735018,347.96271637816244 133.58189081225032,347.96271637816244 133.58189081225032,422.52996005326236 208.14913448735018,422.52996005326236" fill="none" stroke="purple" stroke-width="1" />
|
|
42
37
|
</g>
|
|
43
38
|
<g>
|
|
44
|
-
<
|
|
45
|
-
y+" data-x="-2.9999378" data-y="0.4458008" cx="153.16585067775011" cy="356.06020837913707" r="3" fill="hsl(111, 100%, 50%, 0.8)" />
|
|
39
|
+
<rect data-type="rect" data-label="1" data-x="0" data-y="0" x="208.14913448735018" y="310.67909454061254" width="223.70173102529964" height="149.13448735019972" fill="hsl(49, 100%, 50%, 0.8)" stroke="black" stroke-width="0.002682142857142857" />
|
|
46
40
|
</g>
|
|
47
41
|
<g>
|
|
48
|
-
<
|
|
49
|
-
y-" data-x="-3.0000622" data-y="-0.4458008" cx="153.15978209715323" cy="399.5550328962254" r="3" fill="hsl(112, 100%, 50%, 0.8)" />
|
|
42
|
+
<rect data-type="rect" data-label="" data-x="-0.4" data-y="0.325" x="133.58189081225032" y="180.18641810918774" width="74.56724367509986" height="167.7762982689747" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.002682142857142857" />
|
|
50
43
|
</g>
|
|
51
44
|
<g>
|
|
52
|
-
<
|
|
53
|
-
y+" data-x="0.3" data-y="0.58" cx="314.146063732893" cy="349.51359534666426" r="3" fill="hsl(311, 100%, 50%, 0.8)" />
|
|
45
|
+
<rect data-type="rect" data-label="" data-x="-0.526" data-y="0" x="40" y="347.96271637816244" width="167.77629826897467" height="74.56724367509992" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.002682142857142857" />
|
|
54
46
|
</g>
|
|
55
47
|
<g>
|
|
56
|
-
<
|
|
57
|
-
y-" data-x="0.31" data-y="-0.58" cx="314.633891755152" cy="406.1016459286982" r="3" fill="hsl(312, 100%, 50%, 0.8)" />
|
|
58
|
-
</g>
|
|
59
|
-
<g>
|
|
60
|
-
<circle data-type="point" data-label="M1.3
|
|
61
|
-
x-" data-x="-0.445" data-y="-0.1" cx="277.802876074604" cy="382.68590086027035" r="3" fill="hsl(313, 100%, 50%, 0.8)" />
|
|
62
|
-
</g>
|
|
63
|
-
<g>
|
|
64
|
-
<circle data-type="point" data-label="" data-x="-5.005" data-y="2.7600000000000002" cx="55.35329792453959" cy="243.16708649422117" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
65
|
-
</g>
|
|
66
|
-
<g>
|
|
67
|
-
<circle data-type="point" data-label="" data-x="3" data-y="-0.78" cx="445.8596297427996" cy="415.85820637387644" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
68
|
-
</g>
|
|
69
|
-
<g>
|
|
70
|
-
<circle data-type="point" data-label="" data-x="6" data-y="-0.55" cx="592.2080364204736" cy="404.63816186192145" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
71
|
-
</g>
|
|
72
|
-
<g>
|
|
73
|
-
<circle data-type="point" data-label="" data-x="-4.995" data-y="-0.6458008" cx="55.841125946798485" cy="409.31159334140364" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
74
|
-
</g>
|
|
75
|
-
<g>
|
|
76
|
-
<circle data-type="point" data-label="" data-x="1.055" data-y="2.97" cx="350.977079413441" cy="232.922698026784" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
77
|
-
</g>
|
|
78
|
-
<g>
|
|
79
|
-
<circle data-type="point" data-label="" data-x="0.3" data-y="0.58" cx="314.146063732893" cy="349.51359534666426" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
80
|
-
</g>
|
|
81
|
-
<g>
|
|
82
|
-
<circle data-type="point" data-label="" data-x="3.7199999999999998" data-y="3" cx="480.9832473454413" cy="231.45921396000725" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
83
|
-
</g>
|
|
84
|
-
<g>
|
|
85
|
-
<circle data-type="point" data-label="" data-x="6" data-y="0.55" cx="592.2080364204736" cy="350.977079413441" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
86
|
-
</g>
|
|
87
|
-
<g>
|
|
88
|
-
<circle data-type="point" data-label="" data-x="-1.08373445" data-y="-0.09999999999999987" cx="246.64361972539055" cy="382.68590086027035" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
|
|
89
|
-
</g>
|
|
90
|
-
<g>
|
|
91
|
-
<polyline data-points="-5.005,2.54 -0.58,2.98" data-type="line" data-label="" points="55.35329792453959,253.89930298391727 271.2171977741087,232.4348700045251" fill="none" stroke="hsl(136, 100%, 50%, 0.8)" stroke-width="1" />
|
|
92
|
-
</g>
|
|
93
|
-
<g>
|
|
94
|
-
<polyline data-points="0.58,2.97 2.48,3" data-type="line" data-label="" points="327.8052483561426,232.922698026784 420.4925725853361,231.45921396000725" fill="none" stroke="hsl(112, 100%, 50%, 0.8)" stroke-width="1" />
|
|
95
|
-
</g>
|
|
96
|
-
<g>
|
|
97
|
-
<polyline data-points="3.52,3 3,0.49500000000000005" data-type="line" data-label="" points="471.2266869002631,231.45921396000725 445.8596297427996,353.66013353586504" fill="none" stroke="hsl(128, 100%, 50%, 0.8)" stroke-width="1" />
|
|
98
|
-
</g>
|
|
99
|
-
<g>
|
|
100
|
-
<polyline data-points="3.52,3 6,0.55" data-type="line" data-label="" points="471.2266869002631,231.45921396000725 592.2080364204736,350.977079413441" fill="none" stroke="hsl(128, 100%, 50%, 0.8)" stroke-width="1" />
|
|
101
|
-
</g>
|
|
102
|
-
<g>
|
|
103
|
-
<polyline data-points="3,-0.49500000000000005 6,-0.55" data-type="line" data-label="" points="445.8596297427996,401.9551077394974 592.2080364204736,404.63816186192145" fill="none" stroke="hsl(136, 100%, 50%, 0.8)" stroke-width="1" />
|
|
104
|
-
</g>
|
|
105
|
-
<g>
|
|
106
|
-
<polyline data-points="6,-0.55 -4.995,1.46" data-type="line" data-label="" points="592.2080364204736,404.63816186192145 55.841125946798485,306.58472938787986" fill="none" stroke="hsl(72, 100%, 50%, 0.8)" stroke-width="1" />
|
|
107
|
-
</g>
|
|
108
|
-
<g>
|
|
109
|
-
<polyline data-points="0.58,2.97 0.3,0.58" data-type="line" data-label="" points="327.8052483561426,232.922698026784 314.146063732893,349.51359534666426" fill="none" stroke="hsl(112, 100%, 50%, 0.8)" stroke-width="1" />
|
|
110
|
-
</g>
|
|
111
|
-
<g>
|
|
112
|
-
<polyline data-points="0.31,-0.58 -4.995,1.46" data-type="line" data-label="" points="314.633891755152,406.1016459286982 55.841125946798485,306.58472938787986" fill="none" stroke="hsl(184, 100%, 50%, 0.8)" stroke-width="1" />
|
|
113
|
-
</g>
|
|
114
|
-
<g>
|
|
115
|
-
<polyline data-points="-0.445,-0.1 -2.9999378,0.4458008" data-type="line" data-label="" points="277.802876074604,382.68590086027035 153.16585067775011,356.06020837913707" fill="none" stroke="hsl(232, 100%, 50%, 0.8)" stroke-width="1" />
|
|
116
|
-
</g>
|
|
117
|
-
<g>
|
|
118
|
-
<polyline data-points="-3.0000622,-0.4458008 -4.995,1.46" data-type="line" data-label="" points="153.15978209715323,399.5550328962254 55.841125946798485,306.58472938787986" fill="none" stroke="hsl(224, 100%, 50%, 0.8)" stroke-width="1" />
|
|
119
|
-
</g>
|
|
120
|
-
<g>
|
|
121
|
-
<polyline data-points="-4.995,1.46 3,-0.49500000000000005" data-type="line" data-label="" points="55.841125946798485,306.58472938787986 445.8596297427996,401.9551077394974" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
122
|
-
</g>
|
|
123
|
-
<g>
|
|
124
|
-
<polyline data-points="-4.995,1.46 6,-0.55" data-type="line" data-label="" points="55.841125946798485,306.58472938787986 592.2080364204736,404.63816186192145" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
125
|
-
</g>
|
|
126
|
-
<g>
|
|
127
|
-
<polyline data-points="-4.995,1.46 -3.0000622,-0.4458008" data-type="line" data-label="" points="55.841125946798485,306.58472938787986 153.15978209715323,399.5550328962254" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
128
|
-
</g>
|
|
129
|
-
<g>
|
|
130
|
-
<polyline data-points="-4.995,1.46 0.31,-0.58" data-type="line" data-label="" points="55.841125946798485,306.58472938787986 314.633891755152,406.1016459286982" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
131
|
-
</g>
|
|
132
|
-
<g>
|
|
133
|
-
<polyline data-points="3,-0.49500000000000005 6,-0.55" data-type="line" data-label="" points="445.8596297427996,401.9551077394974 592.2080364204736,404.63816186192145" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
134
|
-
</g>
|
|
135
|
-
<g>
|
|
136
|
-
<polyline data-points="3,-0.49500000000000005 -3.0000622,-0.4458008" data-type="line" data-label="" points="445.8596297427996,401.9551077394974 153.15978209715323,399.5550328962254" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
137
|
-
</g>
|
|
138
|
-
<g>
|
|
139
|
-
<polyline data-points="3,-0.49500000000000005 0.31,-0.58" data-type="line" data-label="" points="445.8596297427996,401.9551077394974 314.633891755152,406.1016459286982" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
140
|
-
</g>
|
|
141
|
-
<g>
|
|
142
|
-
<polyline data-points="6,-0.55 -3.0000622,-0.4458008" data-type="line" data-label="" points="592.2080364204736,404.63816186192145 153.15978209715323,399.5550328962254" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
143
|
-
</g>
|
|
144
|
-
<g>
|
|
145
|
-
<polyline data-points="6,-0.55 0.31,-0.58" data-type="line" data-label="" points="592.2080364204736,404.63816186192145 314.633891755152,406.1016459286982" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
146
|
-
</g>
|
|
147
|
-
<g>
|
|
148
|
-
<polyline data-points="-3.0000622,-0.4458008 0.31,-0.58" data-type="line" data-label="" points="153.15978209715323,399.5550328962254 314.633891755152,406.1016459286982" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
|
|
149
|
-
</g>
|
|
150
|
-
<g>
|
|
151
|
-
<polyline data-points="0.58,2.97 1.53,2.97 1.53,3 2.48,3" data-type="line" data-label="" points="327.8052483561426,232.922698026784 374.1489104707394,232.922698026784 374.1489104707394,231.45921396000725 420.4925725853361,231.45921396000725" fill="none" stroke="purple" stroke-width="1" />
|
|
152
|
-
</g>
|
|
153
|
-
<g>
|
|
154
|
-
<polyline data-points="-5.005,2.54 -5.005,2.9800000000000004 -0.5800000000000001,2.9800000000000004" data-type="line" data-label="" points="55.35329792453959,253.89930298391727 55.35329792453959,232.43487000452507 271.2171977741087,232.43487000452507" fill="none" stroke="purple" stroke-width="1" />
|
|
155
|
-
</g>
|
|
156
|
-
<g>
|
|
157
|
-
<polyline data-points="3.52,3 3.7199999999999998,3 3.7199999999999998,1.7474999999999996 3,1.7474999999999996 3,0.49500000000000005" data-type="line" data-label="" points="471.2266869002631,231.45921396000725 480.9832473454413,231.45921396000725 480.9832473454413,292.55967374793613 445.8596297427996,292.55967374793613 445.8596297427996,353.66013353586504" fill="none" stroke="purple" stroke-width="1" />
|
|
158
|
-
</g>
|
|
159
|
-
<g>
|
|
160
|
-
<polyline data-points="3,-0.4950000000000001 3,-0.78 0.31,-0.78 0.31,-0.58" data-type="line" data-label="" points="445.8596297427996,401.9551077394974 445.8596297427996,415.85820637387644 314.633891755152,415.85820637387644 314.633891755152,406.1016459286982" fill="none" stroke="purple" stroke-width="1" />
|
|
161
|
-
</g>
|
|
162
|
-
<g>
|
|
163
|
-
<polyline data-points="-4.995,1.46 -4.995,-0.6458008 -3.0000622,-0.6458008 -3.0000622,-0.4458007999999998" data-type="line" data-label="" points="55.841125946798485,306.58472938787986 55.841125946798485,409.31159334140364 153.15978209715323,409.31159334140364 153.15978209715323,399.5550328962253" fill="none" stroke="purple" stroke-width="1" />
|
|
164
|
-
</g>
|
|
165
|
-
<g>
|
|
166
|
-
<polyline data-points="-0.44499999999999984,-0.09999999999999987 -1.7224689,-0.09999999999999987 -1.7224689,0.6458008000000002 -2.9999378,0.6458008000000002 -2.9999378,0.4458008" data-type="line" data-label="" points="277.802876074604,382.68590086027035 215.48436337617707,382.68590086027035 215.48436337617707,346.3036479339588 153.16585067775011,346.3036479339588 153.16585067775011,356.06020837913707" fill="none" stroke="purple" stroke-width="1" />
|
|
167
|
-
</g>
|
|
168
|
-
<g>
|
|
169
|
-
<rect data-type="rect" data-label="schematic_component_0" data-x="-5" data-y="2" x="40" y="253.89930298391727" width="31.194423871338046" height="52.685426403962595" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.020499027410714285" />
|
|
170
|
-
</g>
|
|
171
|
-
<g>
|
|
172
|
-
<rect data-type="rect" data-label="schematic_component_1" data-x="0" data-y="3" x="271.2171977741087" y="220.23916944805225" width="56.58805058203393" height="22.44008902391002" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.020499027410714285" />
|
|
173
|
-
</g>
|
|
174
|
-
<g>
|
|
175
|
-
<rect data-type="rect" data-label="schematic_component_2" data-x="3" data-y="3" x="420.4925725853361" y="218.28785735901658" width="50.734114314926956" height="26.342713201981326" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.020499027410714285" />
|
|
176
|
-
</g>
|
|
177
|
-
<g>
|
|
178
|
-
<rect data-type="rect" data-label="schematic_component_3" data-x="3" data-y="0" x="431.95653110842056" y="353.66013353586504" width="27.80619726875807" height="48.294974203632364" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.020499027410714285" />
|
|
179
|
-
</g>
|
|
180
|
-
<g>
|
|
181
|
-
<rect data-type="rect" data-label="schematic_component_4" data-x="6" data-y="0" x="584.4160728409472" y="350.977079413441" width="15.583927159052791" height="53.66108244848044" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.020499027410714285" />
|
|
182
|
-
</g>
|
|
183
|
-
<g>
|
|
184
|
-
<rect data-type="rect" data-label="schematic_component_5" data-x="-3" data-y="0" x="143.49775540526844" y="356.06020837913707" width="19.330121964366498" height="43.49482451708832" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.020499027410714285" />
|
|
185
|
-
</g>
|
|
186
|
-
<g>
|
|
187
|
-
<rect data-type="rect" data-label="schematic_component_6" data-x="0" data-y="0" x="277.802876074604" y="349.51359534666426" width="43.416693981043295" height="56.58805058203393" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.020499027410714285" />
|
|
188
|
-
</g>
|
|
189
|
-
<g>
|
|
190
|
-
<rect data-type="rect" data-label="" data-x="-4.78" data-y="2.7600000000000002" x="55.35329792453959" y="238.288806271632" width="21.95226100165104" height="9.75656044517828" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
191
|
-
</g>
|
|
192
|
-
<g>
|
|
193
|
-
<rect data-type="rect" data-label="" data-x="3" data-y="-0.93" x="440.9813495202105" y="415.85820637387644" width="9.756560445178309" height="14.634840667767435" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
194
|
-
</g>
|
|
195
|
-
<g>
|
|
196
|
-
<rect data-type="rect" data-label="" data-x="6" data-y="-0.7010000000000001" x="587.3297561978845" y="404.68694466414735" width="9.756560445178138" height="14.634840667767378" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
197
|
-
</g>
|
|
198
|
-
<g>
|
|
199
|
-
<rect data-type="rect" data-label="" data-x="-4.995" data-y="-0.7958008" x="50.96284572420936" y="409.31159334140364" width="9.756560445178224" height="14.634840667767378" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
200
|
-
</g>
|
|
201
|
-
<g>
|
|
202
|
-
<rect data-type="rect" data-label="" data-x="1.055" data-y="3.1950000000000003" x="346.0987991908519" y="210.97043702513287" width="9.756560445178252" height="21.952261001651124" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
203
|
-
</g>
|
|
204
|
-
<g>
|
|
205
|
-
<rect data-type="rect" data-label="" data-x="0.3" data-y="0.8059999999999999" x="309.2677835103039" y="327.51255154278726" width="9.756560445178309" height="21.952261001651095" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
206
|
-
</g>
|
|
207
|
-
<g>
|
|
208
|
-
<rect data-type="rect" data-label="" data-x="3.7199999999999998" data-y="3.225" x="476.10496712285226" y="209.50695295835615" width="9.756560445178252" height="21.952261001651095" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
209
|
-
</g>
|
|
210
|
-
<g>
|
|
211
|
-
<rect data-type="rect" data-label="" data-x="6" data-y="0.776" x="587.3297561978845" y="328.976035609564" width="9.756560445178138" height="21.952261001651095" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
212
|
-
</g>
|
|
213
|
-
<g>
|
|
214
|
-
<rect data-type="rect" data-label="" data-x="-1.08373445" data-y="0.12500000000000014" x="241.7653395028014" y="360.73363985861926" width="9.75656044517828" height="21.952261001651095" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.020499027410714285" />
|
|
48
|
+
<rect data-type="rect" data-label="" data-x="0.526" data-y="0.1" x="432.22370173102536" y="310.67909454061254" width="167.77629826897464" height="74.56724367509986" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.002682142857142857" />
|
|
215
49
|
</g>
|
|
216
50
|
<g id="crosshair" style="display: none">
|
|
217
51
|
<line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
|
|
@@ -241,12 +75,12 @@ x-" data-x="-0.445" data-y="-0.1" cx="277.802876074604" cy="382.68590086027035"
|
|
|
241
75
|
|
|
242
76
|
// Calculate real coordinates using inverse transformation
|
|
243
77
|
const matrix = {
|
|
244
|
-
"a":
|
|
78
|
+
"a": 372.83621837549936,
|
|
245
79
|
"c": 0,
|
|
246
|
-
"e":
|
|
80
|
+
"e": 320,
|
|
247
81
|
"b": 0,
|
|
248
|
-
"d": -
|
|
249
|
-
"f":
|
|
82
|
+
"d": -372.83621837549936,
|
|
83
|
+
"f": 385.2463382157124
|
|
250
84
|
};
|
|
251
85
|
// Manually invert and apply the affine transform
|
|
252
86
|
// Since we only use translate and scale, we can directly compute:
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { test, expect } from "bun:test"
|
|
2
|
-
import type { InputProblem } from "lib/index"
|
|
3
2
|
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
3
|
+
import { inputProblem } from "site/examples/example28.page"
|
|
4
4
|
import "tests/fixtures/matcher"
|
|
5
|
-
import inputProblem from "../../tests/assets/example25.json"
|
|
6
5
|
|
|
7
6
|
test("example28", () => {
|
|
8
|
-
const solver = new SchematicTracePipelineSolver(inputProblem
|
|
7
|
+
const solver = new SchematicTracePipelineSolver(inputProblem)
|
|
9
8
|
|
|
10
9
|
solver.solve()
|
|
11
10
|
|