@tscircuit/schematic-trace-solver 0.0.26 → 0.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/index.d.ts +5 -0
  2. package/dist/index.js +114 -4
  3. package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver.ts +11 -0
  4. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver.ts +40 -1
  5. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/getRestrictedCenterLines.ts +139 -0
  6. package/package.json +1 -1
  7. package/site/SchematicTracePipelineSolver/SchematicTracePipelineSolver01.page.tsx +143 -0
  8. package/site/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver01.page.tsx +574 -0
  9. package/site/examples/example11.page.tsx +1 -1
  10. package/site/examples/example12.page.tsx +1 -1
  11. package/site/examples/example13.page.tsx +219 -0
  12. package/site/examples/example14.page.tsx +210 -0
  13. package/tests/examples/__snapshots__/example01.snap.svg +4 -4
  14. package/tests/examples/__snapshots__/example02.snap.svg +4 -4
  15. package/tests/examples/__snapshots__/example03.snap.svg +68 -68
  16. package/tests/examples/__snapshots__/example04.snap.svg +12 -12
  17. package/tests/examples/__snapshots__/example05.snap.svg +1 -1
  18. package/tests/examples/__snapshots__/example06.snap.svg +11 -11
  19. package/tests/examples/__snapshots__/example07.snap.svg +48 -48
  20. package/tests/examples/__snapshots__/example08.snap.svg +25 -25
  21. package/tests/examples/__snapshots__/example09.snap.svg +131 -131
  22. package/tests/examples/__snapshots__/example10.snap.svg +26 -26
  23. package/tests/examples/__snapshots__/example11.snap.svg +162 -0
  24. package/tests/examples/__snapshots__/example12.snap.svg +145 -0
  25. package/tests/examples/__snapshots__/example13.snap.svg +322 -0
  26. package/tests/examples/__snapshots__/example14.snap.svg +213 -0
  27. package/tests/examples/__snapshots__/example15.snap.svg +235 -0
  28. package/tests/examples/example11.test.tsx +12 -0
  29. package/tests/examples/example12.test.tsx +12 -0
  30. package/tests/examples/example13.test.tsx +12 -0
  31. package/tests/examples/example14.test.tsx +12 -0
  32. package/tests/examples/example15.test.tsx +187 -0
  33. package/tests/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver01.test.ts +13 -0
  34. package/tests/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver_repro03.test.ts +0 -0
@@ -0,0 +1,219 @@
1
+ import { PipelineDebugger } from "site/components/PipelineDebugger"
2
+ import type { InputProblem } from "lib/types/InputProblem"
3
+
4
+ export const inputProblem: InputProblem = {
5
+ chips: [
6
+ {
7
+ chipId: "schematic_component_0",
8
+ center: {
9
+ x: 0,
10
+ y: 0,
11
+ },
12
+ width: 1.5,
13
+ height: 3.75,
14
+ pins: [
15
+ {
16
+ pinId: "PWR1.7",
17
+ x: 1.15,
18
+ y: 0.75,
19
+ },
20
+ {
21
+ pinId: "PWR1.6",
22
+ x: 1.15,
23
+ y: 0,
24
+ },
25
+ {
26
+ pinId: "PWR1.5",
27
+ x: 1.15,
28
+ y: -0.75,
29
+ },
30
+ {
31
+ pinId: "PWR1.4",
32
+ x: -1.15,
33
+ y: -1.125,
34
+ },
35
+ {
36
+ pinId: "PWR1.3",
37
+ x: -1.15,
38
+ y: -0.375,
39
+ },
40
+ {
41
+ pinId: "PWR1.2",
42
+ x: -1.15,
43
+ y: 0.375,
44
+ },
45
+ {
46
+ pinId: "PWR1.1",
47
+ x: -1.15,
48
+ y: 1.125,
49
+ },
50
+ ],
51
+ },
52
+ {
53
+ chipId: "schematic_component_1",
54
+ center: {
55
+ x: -3,
56
+ y: 0,
57
+ },
58
+ width: 1.06,
59
+ height: 0.388910699999999,
60
+ pins: [
61
+ {
62
+ pinId: "R6.1",
63
+ x: -3.55,
64
+ y: 0,
65
+ },
66
+ {
67
+ pinId: "R6.2",
68
+ x: -2.45,
69
+ y: 0,
70
+ },
71
+ ],
72
+ },
73
+ {
74
+ chipId: "schematic_component_2",
75
+ center: {
76
+ x: -3,
77
+ y: -2,
78
+ },
79
+ width: 1.06,
80
+ height: 0.388910699999999,
81
+ pins: [
82
+ {
83
+ pinId: "R7.1",
84
+ x: -3.55,
85
+ y: -1.9999999999999998,
86
+ },
87
+ {
88
+ pinId: "R7.2",
89
+ x: -2.45,
90
+ y: -1.9999999999999998,
91
+ },
92
+ ],
93
+ },
94
+ {
95
+ chipId: "schematic_component_3",
96
+ center: {
97
+ x: -3,
98
+ y: 2,
99
+ },
100
+ width: 1.06,
101
+ height: 0.388910699999999,
102
+ pins: [
103
+ {
104
+ pinId: "R8.1",
105
+ x: -3.55,
106
+ y: 2,
107
+ },
108
+ {
109
+ pinId: "R8.2",
110
+ x: -2.45,
111
+ y: 2,
112
+ },
113
+ ],
114
+ },
115
+ {
116
+ chipId: "schematic_component_4",
117
+ center: {
118
+ x: 3,
119
+ y: -1.5,
120
+ },
121
+ width: 1.06,
122
+ height: 0.84,
123
+ pins: [
124
+ {
125
+ pinId: "C6.1",
126
+ x: 2.45,
127
+ y: -1.5,
128
+ },
129
+ {
130
+ pinId: "C6.2",
131
+ x: 3.55,
132
+ y: -1.5,
133
+ },
134
+ ],
135
+ },
136
+ {
137
+ chipId: "schematic_component_5",
138
+ center: {
139
+ x: 3,
140
+ y: 0,
141
+ },
142
+ width: 1.06,
143
+ height: 0.84,
144
+ pins: [
145
+ {
146
+ pinId: "C7.1",
147
+ x: 2.45,
148
+ y: 0,
149
+ },
150
+ {
151
+ pinId: "C7.2",
152
+ x: 3.55,
153
+ y: 0,
154
+ },
155
+ ],
156
+ },
157
+ {
158
+ chipId: "schematic_component_6",
159
+ center: {
160
+ x: 4,
161
+ y: 3,
162
+ },
163
+ width: 1.13,
164
+ height: 0.65,
165
+ pins: [
166
+ {
167
+ pinId: "LED1.1",
168
+ x: 3.46,
169
+ y: 3,
170
+ },
171
+ {
172
+ pinId: "LED1.2",
173
+ x: 4.54,
174
+ y: 3,
175
+ },
176
+ ],
177
+ },
178
+ ],
179
+ directConnections: [
180
+ {
181
+ pinIds: ["R6.1", "PWR1.1"],
182
+ netId: ".R6 > .pin1 to .PWR1 > .OUT",
183
+ },
184
+ {
185
+ pinIds: ["LED1.1", "R8.2"],
186
+ netId: ".LED1 > .pos to .R8 > .pin2",
187
+ },
188
+ {
189
+ pinIds: ["PWR1.2", "R6.2"],
190
+ netId: ".PWR1 > .FB to .R6 > .pin2",
191
+ },
192
+ {
193
+ pinIds: ["PWR1.2", "R7.1"],
194
+ netId: ".PWR1 > .FB to .R7 > .pin1",
195
+ },
196
+ ],
197
+ netConnections: [
198
+ {
199
+ netId: "gnd",
200
+ pinIds: ["PWR1.7", "PWR1.3", "R7.2", "C6.2", "C7.2", "LED1.2"],
201
+ },
202
+ {
203
+ netId: "v5",
204
+ pinIds: ["PWR1.6", "PWR1.4", "C6.1"],
205
+ },
206
+ {
207
+ netId: "v3_3",
208
+ pinIds: ["PWR1.1", "R6.1", "R8.1", "C7.1"],
209
+ },
210
+ ],
211
+ availableNetLabelOrientations: {
212
+ gnd: ["y-"],
213
+ v5: ["y+"],
214
+ v3_3: ["y+"],
215
+ },
216
+ maxMspPairDistance: 5,
217
+ }
218
+
219
+ export default () => <PipelineDebugger inputProblem={inputProblem} />
@@ -0,0 +1,210 @@
1
+ import { PipelineDebugger } from "site/components/PipelineDebugger"
2
+ import type { InputProblem } from "lib/types/InputProblem"
3
+
4
+ export const inputProblem: InputProblem = {
5
+ chips: [
6
+ {
7
+ chipId: "schematic_component_0",
8
+ center: {
9
+ x: 0,
10
+ y: 0,
11
+ },
12
+ width: 2.4000000000000004,
13
+ height: 1,
14
+ pins: [
15
+ {
16
+ pinId: "U1.1",
17
+ x: 1.2000000000000002,
18
+ y: -0.30000000000000004,
19
+ },
20
+ {
21
+ pinId: "U1.2",
22
+ x: -1.2000000000000002,
23
+ y: -0.30000000000000004,
24
+ },
25
+ {
26
+ pinId: "U1.3",
27
+ x: 1.2000000000000002,
28
+ y: 0.09999999999999998,
29
+ },
30
+ {
31
+ pinId: "U1.4",
32
+ x: -1.2000000000000002,
33
+ y: 0.30000000000000004,
34
+ },
35
+ {
36
+ pinId: "U1.5",
37
+ x: -1.2000000000000002,
38
+ y: 0.10000000000000003,
39
+ },
40
+ {
41
+ pinId: "U1.6",
42
+ x: -1.2000000000000002,
43
+ y: -0.09999999999999998,
44
+ },
45
+ {
46
+ pinId: "U1.7",
47
+ x: 1.2000000000000002,
48
+ y: -0.10000000000000003,
49
+ },
50
+ {
51
+ pinId: "U1.8",
52
+ x: 1.2000000000000002,
53
+ y: 0.30000000000000004,
54
+ },
55
+ ],
56
+ },
57
+ {
58
+ chipId: "schematic_component_1",
59
+ center: {
60
+ x: 2.45,
61
+ y: -0.10000000000000009,
62
+ },
63
+ width: 1.0999999999999996,
64
+ height: 0.388910699999999,
65
+ pins: [
66
+ {
67
+ pinId: "R1.1",
68
+ x: 3,
69
+ y: -0.10000000000000016,
70
+ },
71
+ {
72
+ pinId: "R1.2",
73
+ x: 1.9000000000000004,
74
+ y: -0.10000000000000002,
75
+ },
76
+ ],
77
+ },
78
+ {
79
+ chipId: "schematic_component_2",
80
+ center: {
81
+ x: 0.6500000000000001,
82
+ y: -1.2944553500000002,
83
+ },
84
+ width: 1.1,
85
+ height: 0.388910699999999,
86
+ pins: [
87
+ {
88
+ pinId: "R2.1",
89
+ x: 1.2000000000000002,
90
+ y: -1.2944553500000002,
91
+ },
92
+ {
93
+ pinId: "R2.2",
94
+ x: 0.10000000000000009,
95
+ y: -1.2944553500000002,
96
+ },
97
+ ],
98
+ },
99
+ {
100
+ chipId: "schematic_component_3",
101
+ center: {
102
+ x: -1.2000000000000002,
103
+ y: -1.7000000000000002,
104
+ },
105
+ width: 1.06,
106
+ height: 1.1,
107
+ pins: [
108
+ {
109
+ pinId: "C1.1",
110
+ x: -1.2000000000000002,
111
+ y: -1.1500000000000001,
112
+ },
113
+ {
114
+ pinId: "C1.2",
115
+ x: -1.2000000000000002,
116
+ y: -2.25,
117
+ },
118
+ ],
119
+ },
120
+ {
121
+ chipId: "schematic_component_4",
122
+ center: {
123
+ x: -2.45,
124
+ y: 0.10000000000000009,
125
+ },
126
+ width: 1.0999999999999996,
127
+ height: 0.84,
128
+ pins: [
129
+ {
130
+ pinId: "C2.1",
131
+ x: -1.9000000000000004,
132
+ y: 0.10000000000000002,
133
+ },
134
+ {
135
+ pinId: "C2.2",
136
+ x: -3,
137
+ y: 0.10000000000000016,
138
+ },
139
+ ],
140
+ },
141
+ {
142
+ chipId: "schematic_component_5",
143
+ center: {
144
+ x: 1.2000000000000002,
145
+ y: 1.7000000000000002,
146
+ },
147
+ width: 1.06,
148
+ height: 1.1,
149
+ pins: [
150
+ {
151
+ pinId: "R3.1",
152
+ x: 1.2000000000000002,
153
+ y: 1.1500000000000001,
154
+ },
155
+ {
156
+ pinId: "R3.2",
157
+ x: 1.2000000000000002,
158
+ y: 2.25,
159
+ },
160
+ ],
161
+ },
162
+ ],
163
+ directConnections: [
164
+ {
165
+ pinIds: ["U1.5", "C2.1"],
166
+ netId: "U1.CTRL to C2.pin1",
167
+ },
168
+ {
169
+ pinIds: ["U1.6", "U1.2"],
170
+ netId: "U1.THRES to U1.TRIG",
171
+ },
172
+ {
173
+ pinIds: ["R1.2", "U1.7"],
174
+ netId: "R1.pin2 to U1.DISCH",
175
+ },
176
+ {
177
+ pinIds: ["U1.7", "R2.1"],
178
+ netId: "U1.DISCH to R2.pin1",
179
+ },
180
+ {
181
+ pinIds: ["R2.2", "U1.6"],
182
+ netId: "R2.pin2 to U1.THRES",
183
+ },
184
+ {
185
+ pinIds: ["U1.6", "C1.1"],
186
+ netId: "U1.THRES to C1.pin1",
187
+ },
188
+ {
189
+ pinIds: ["U1.3", "R3.1"],
190
+ netId: "U1.OUT to R3.pin1",
191
+ },
192
+ ],
193
+ netConnections: [
194
+ {
195
+ netId: "GND",
196
+ pinIds: ["U1.1", "C1.2", "C2.2"],
197
+ },
198
+ {
199
+ netId: "VCC",
200
+ pinIds: ["U1.4", "U1.8", "R1.1"],
201
+ },
202
+ ],
203
+ availableNetLabelOrientations: {
204
+ VCC: ["y+"],
205
+ GND: ["y-"],
206
+ },
207
+ maxMspPairDistance: 2.4,
208
+ }
209
+
210
+ export default () => <PipelineDebugger inputProblem={inputProblem} />
@@ -86,16 +86,16 @@ y-" data-x="-4" data-y="-0.5" cx="67.72277227722776" cy="375.44554455445547" r="
86
86
  <rect data-type="rect" data-label="C2" data-x="-4" data-y="0" x="40.00000000000006" y="264.55445544554453" width="55.44554455445541" height="110.89108910891093" fill="hsl(327, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143" />
87
87
  </g>
88
88
  <g>
89
- <rect data-type="rect" data-label="" data-x="-1.4" data-y="0.8999999999999999" x="344.950495049505" y="198.01980198019805" width="22.178217821782198" height="44.35643564356434" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
89
+ <rect data-type="rect" data-label="" data-x="-1.4" data-y="0.9249999999999999" x="344.950495049505" y="192.4752475247525" width="22.178217821782198" height="49.9009900990099" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
90
90
  </g>
91
91
  <g>
92
- <rect data-type="rect" data-label="" data-x="-1.001" data-y="0" x="378.10693069306933" y="308.91089108910893" width="44.356435643564396" height="22.17821782178214" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
92
+ <rect data-type="rect" data-label="" data-x="-1.026" data-y="0" x="372.56237623762377" y="308.91089108910893" width="49.90099009900996" height="22.17821782178214" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
93
93
  </g>
94
94
  <g>
95
- <rect data-type="rect" data-label="" data-x="-4" data-y="0.701" x="56.63366336633669" y="220.08712871287128" width="22.17821782178214" height="44.356435643564396" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
95
+ <rect data-type="rect" data-label="" data-x="-4" data-y="0.726" x="56.63366336633669" y="214.54257425742574" width="22.17821782178214" height="49.90099009900993" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
96
96
  </g>
97
97
  <g>
98
- <rect data-type="rect" data-label="" data-x="-1.4" data-y="-0.8999999999999999" x="344.950495049505" y="397.6237623762376" width="22.178217821782198" height="44.35643564356434" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
98
+ <rect data-type="rect" data-label="" data-x="-1.4" data-y="-0.9249999999999999" x="344.950495049505" y="397.6237623762376" width="22.178217821782198" height="49.9009900990099" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143" />
99
99
  </g>
100
100
  <g id="crosshair" style="display: none">
101
101
  <line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
@@ -191,16 +191,16 @@ x+" data-x="1" data-y="0.1" cx="500.20151295522464" cy="324.189420823755" r="3"
191
191
  <rect data-type="rect" data-label="schematic_component_4" data-x="0" data-y="0" x="330.93198472269955" y="298.7989915888762" width="169.2695282325251" height="67.70781129300997" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.011815475714285715" />
192
192
  </g>
193
193
  <g>
194
- <rect data-type="rect" data-label="" data-x="-1.4574283249999997" data-y="1.5024186000000004" x="283.75416992460123" y="188.56910059724328" width="16.926952823252577" height="33.85390564650501" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
194
+ <rect data-type="rect" data-label="" data-x="-1.4574283249999997" data-y="1.5274186000000005" x="283.75416992460123" y="184.33736239143013" width="16.926952823252577" height="38.08564385231816" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
195
195
  </g>
196
196
  <g>
197
- <rect data-type="rect" data-label="" data-x="-3.0434765500000003" data-y="-0.4000000000000004" x="149.51935252470935" y="349.5798500586337" width="16.926952823252492" height="33.85390564650504" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
197
+ <rect data-type="rect" data-label="" data-x="-3.0434765500000003" data-y="-0.4250000000000004" x="149.51935252470935" y="349.5798500586337" width="16.926952823252492" height="38.085643852318185" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
198
198
  </g>
199
199
  <g>
200
- <rect data-type="rect" data-label="" data-x="1.9148566499999995" data-y="-1.2034186000000007" x="569.1667133165424" y="417.5769937562517" width="16.926952823252577" height="33.853905646504984" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
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.4571549750000001" data-y="0.30000000000000004" x="530.4292400172993" y="290.33551517724993" width="16.926952823252464" height="33.85390564650504" 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.325" x="530.4292400172993" y="286.1037769714368" width="16.926952823252464" height="38.085643852318185" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.011815475714285715" />
204
204
  </g>
205
205
  <g id="crosshair" style="display: none">
206
206
  <line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />