@tscircuit/schematic-trace-solver 0.0.40 → 0.0.41
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 +37 -2
- package/dist/index.js +201 -10
- package/lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts +238 -0
- package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +31 -9
- package/lib/utils/does-trace-overlap-with-existing-traces.ts +33 -0
- package/package.json +1 -1
- package/site/examples/example25.page.tsx +4 -0
- package/tests/assets/example25.json +96 -0
- package/tests/examples/__snapshots__/example03.snap.svg +67 -76
- package/tests/examples/__snapshots__/example10.snap.svg +24 -30
- package/tests/examples/__snapshots__/example13.snap.svg +81 -84
- package/tests/examples/__snapshots__/example15.snap.svg +5 -8
- package/tests/examples/__snapshots__/example21.snap.svg +68 -74
- package/tests/examples/__snapshots__/example28.snap.svg +273 -0
- package/tests/examples/example28.test.ts +13 -0
|
@@ -0,0 +1,273 @@
|
|
|
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="V1.1
|
|
5
|
+
y+" data-x="-5.005" data-y="2.54" cx="55.35329792453959" cy="253.89930298391727" r="3" fill="hsl(230, 100%, 50%, 0.8)" />
|
|
6
|
+
</g>
|
|
7
|
+
<g>
|
|
8
|
+
<circle data-type="point" data-label="V1.2
|
|
9
|
+
y-" data-x="-4.995" data-y="1.46" cx="55.841125946798485" cy="306.58472938787986" r="3" fill="hsl(231, 100%, 50%, 0.8)" />
|
|
10
|
+
</g>
|
|
11
|
+
<g>
|
|
12
|
+
<circle data-type="point" data-label="L1.1
|
|
13
|
+
x-" data-x="-0.58" data-y="2.98" cx="271.2171977741087" cy="232.4348700045251" r="3" fill="hsl(40, 100%, 50%, 0.8)" />
|
|
14
|
+
</g>
|
|
15
|
+
<g>
|
|
16
|
+
<circle data-type="point" data-label="L1.2
|
|
17
|
+
x+" data-x="0.58" data-y="2.97" cx="327.8052483561426" cy="232.922698026784" r="3" fill="hsl(41, 100%, 50%, 0.8)" />
|
|
18
|
+
</g>
|
|
19
|
+
<g>
|
|
20
|
+
<circle data-type="point" data-label="D1.1
|
|
21
|
+
x-" data-x="2.48" data-y="3" cx="420.4925725853361" cy="231.45921396000725" r="3" fill="hsl(32, 100%, 50%, 0.8)" />
|
|
22
|
+
</g>
|
|
23
|
+
<g>
|
|
24
|
+
<circle data-type="point" data-label="D1.2
|
|
25
|
+
x+" data-x="3.52" data-y="3" cx="471.2266869002631" cy="231.45921396000725" r="3" fill="hsl(33, 100%, 50%, 0.8)" />
|
|
26
|
+
</g>
|
|
27
|
+
<g>
|
|
28
|
+
<circle data-type="point" data-label="C1.2
|
|
29
|
+
y-" data-x="3" data-y="-0.49500000000000005" cx="445.8596297427996" cy="401.9551077394974" r="3" fill="hsl(122, 100%, 50%, 0.8)" />
|
|
30
|
+
</g>
|
|
31
|
+
<g>
|
|
32
|
+
<circle data-type="point" data-label="C1.1
|
|
33
|
+
y+" data-x="3" data-y="0.49500000000000005" cx="445.8596297427996" cy="353.66013353586504" r="3" fill="hsl(121, 100%, 50%, 0.8)" />
|
|
34
|
+
</g>
|
|
35
|
+
<g>
|
|
36
|
+
<circle data-type="point" data-label="R1.1
|
|
37
|
+
y+" data-x="6" data-y="0.55" cx="592.2080364204736" cy="350.977079413441" r="3" fill="hsl(226, 100%, 50%, 0.8)" />
|
|
38
|
+
</g>
|
|
39
|
+
<g>
|
|
40
|
+
<circle data-type="point" data-label="R1.2
|
|
41
|
+
y-" data-x="6" data-y="-0.55" cx="592.2080364204736" cy="404.63816186192145" r="3" fill="hsl(227, 100%, 50%, 0.8)" />
|
|
42
|
+
</g>
|
|
43
|
+
<g>
|
|
44
|
+
<circle data-type="point" data-label="V2.1
|
|
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)" />
|
|
46
|
+
</g>
|
|
47
|
+
<g>
|
|
48
|
+
<circle data-type="point" data-label="V2.2
|
|
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)" />
|
|
50
|
+
</g>
|
|
51
|
+
<g>
|
|
52
|
+
<circle data-type="point" data-label="M1.1
|
|
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)" />
|
|
54
|
+
</g>
|
|
55
|
+
<g>
|
|
56
|
+
<circle data-type="point" data-label="M1.2
|
|
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="0.78" data-y="2.97" cx="337.56180880132086" 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 0.78,2.97 1.53,2.97 1.53,3 2.28,3 2.48,3" data-type="line" data-label="" points="327.8052483561426,232.922698026784 337.56180880132086,232.922698026784 374.1489104707394,232.922698026784 374.1489104707394,231.45921396000725 410.73601214015787,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="0.78" data-y="3.1950000000000003" x="332.68352857873174" 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" />
|
|
215
|
+
</g>
|
|
216
|
+
<g id="crosshair" style="display: none">
|
|
217
|
+
<line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
|
|
218
|
+
<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>
|
|
219
|
+
</g>
|
|
220
|
+
<script>
|
|
221
|
+
<![CDATA[
|
|
222
|
+
document.currentScript.parentElement.addEventListener('mousemove', (e) => {
|
|
223
|
+
const svg = e.currentTarget;
|
|
224
|
+
const rect = svg.getBoundingClientRect();
|
|
225
|
+
const x = e.clientX - rect.left;
|
|
226
|
+
const y = e.clientY - rect.top;
|
|
227
|
+
const crosshair = svg.getElementById('crosshair');
|
|
228
|
+
const h = svg.getElementById('crosshair-h');
|
|
229
|
+
const v = svg.getElementById('crosshair-v');
|
|
230
|
+
const coords = svg.getElementById('coordinates');
|
|
231
|
+
|
|
232
|
+
crosshair.style.display = 'block';
|
|
233
|
+
h.setAttribute('x1', '0');
|
|
234
|
+
h.setAttribute('x2', '640');
|
|
235
|
+
h.setAttribute('y1', y);
|
|
236
|
+
h.setAttribute('y2', y);
|
|
237
|
+
v.setAttribute('x1', x);
|
|
238
|
+
v.setAttribute('x2', x);
|
|
239
|
+
v.setAttribute('y1', '0');
|
|
240
|
+
v.setAttribute('y2', '640');
|
|
241
|
+
|
|
242
|
+
// Calculate real coordinates using inverse transformation
|
|
243
|
+
const matrix = {
|
|
244
|
+
"a": 48.782802225891324,
|
|
245
|
+
"c": 0,
|
|
246
|
+
"e": 299.51122306512565,
|
|
247
|
+
"b": 0,
|
|
248
|
+
"d": -48.782802225891324,
|
|
249
|
+
"f": 377.8076206376812
|
|
250
|
+
};
|
|
251
|
+
// Manually invert and apply the affine transform
|
|
252
|
+
// Since we only use translate and scale, we can directly compute:
|
|
253
|
+
// x' = (x - tx) / sx
|
|
254
|
+
// y' = (y - ty) / sy
|
|
255
|
+
const sx = matrix.a;
|
|
256
|
+
const sy = matrix.d;
|
|
257
|
+
const tx = matrix.e;
|
|
258
|
+
const ty = matrix.f;
|
|
259
|
+
const realPoint = {
|
|
260
|
+
x: (x - tx) / sx,
|
|
261
|
+
y: (y - ty) / sy // Flip y back since we used negative scale
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
|
|
265
|
+
coords.setAttribute('x', (x + 5).toString());
|
|
266
|
+
coords.setAttribute('y', (y - 5).toString());
|
|
267
|
+
});
|
|
268
|
+
document.currentScript.parentElement.addEventListener('mouseleave', () => {
|
|
269
|
+
document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
|
|
270
|
+
});
|
|
271
|
+
]]>
|
|
272
|
+
</script>
|
|
273
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { test, expect } from "bun:test"
|
|
2
|
+
import type { InputProblem } from "lib/index"
|
|
3
|
+
import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
|
|
4
|
+
import "tests/fixtures/matcher"
|
|
5
|
+
import inputProblem from "../../tests/assets/example25.json"
|
|
6
|
+
|
|
7
|
+
test("example28", () => {
|
|
8
|
+
const solver = new SchematicTracePipelineSolver(inputProblem as any)
|
|
9
|
+
|
|
10
|
+
solver.solve()
|
|
11
|
+
|
|
12
|
+
expect(solver).toMatchSolverSnapshot(import.meta.path)
|
|
13
|
+
})
|