@tscircuit/schematic-trace-solver 0.0.49 → 0.0.51

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 (23) hide show
  1. package/dist/index.d.ts +133 -1
  2. package/dist/index.js +1084 -41
  3. package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +682 -0
  4. package/lib/solvers/AvailableNetOrientationSolver/constants.ts +6 -0
  5. package/lib/solvers/AvailableNetOrientationSolver/geometry.ts +192 -0
  6. package/lib/solvers/AvailableNetOrientationSolver/traces.ts +43 -0
  7. package/lib/solvers/AvailableNetOrientationSolver/types.ts +44 -0
  8. package/lib/solvers/AvailableNetOrientationSolver/visualize.ts +123 -0
  9. package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +30 -0
  10. package/lib/solvers/VccNetLabelCornerPlacementSolver/VccNetLabelCornerPlacementSolver.ts +268 -0
  11. package/lib/solvers/VccNetLabelCornerPlacementSolver/geometry.ts +59 -0
  12. package/lib/solvers/VccNetLabelCornerPlacementSolver/types.ts +37 -0
  13. package/lib/solvers/VccNetLabelCornerPlacementSolver/visualize.ts +114 -0
  14. package/package.json +1 -1
  15. package/tests/assets/example22.json +1 -1
  16. package/tests/examples/__snapshots__/example12.snap.svg +33 -30
  17. package/tests/examples/__snapshots__/example13.snap.svg +10 -4
  18. package/tests/examples/__snapshots__/example14.snap.svg +72 -66
  19. package/tests/examples/__snapshots__/example16.snap.svg +33 -27
  20. package/tests/examples/__snapshots__/example20.snap.svg +29 -23
  21. package/tests/examples/__snapshots__/example21.snap.svg +77 -65
  22. package/tests/examples/__snapshots__/example22.snap.svg +31 -25
  23. package/tests/examples/__snapshots__/example31.snap.svg +12 -12
@@ -2,94 +2,100 @@
2
2
  <rect width="100%" height="100%" fill="white" />
3
3
  <g>
4
4
  <circle data-type="point" data-label="U1.1
5
- x+" data-x="1.2000000000000002" data-y="-0.30000000000000004" cx="308.80000000000007" cy="227.88" r="3" fill="hsl(319, 100%, 50%, 0.8)" />
5
+ x+" data-x="1.2000000000000002" data-y="-0.30000000000000004" cx="308.80000000000007" cy="253.13599999999997" r="3" fill="hsl(319, 100%, 50%, 0.8)" />
6
6
  </g>
7
7
  <g>
8
8
  <circle data-type="point" data-label="U1.2
9
- x-" data-x="-1.2000000000000002" data-y="-0.30000000000000004" cx="40" cy="227.88" r="3" fill="hsl(320, 100%, 50%, 0.8)" />
9
+ x-" data-x="-1.2000000000000002" data-y="-0.30000000000000004" cx="40" cy="253.13599999999997" r="3" fill="hsl(320, 100%, 50%, 0.8)" />
10
10
  </g>
11
11
  <g>
12
12
  <circle data-type="point" data-label="U1.3
13
- x+" data-x="1.2000000000000002" data-y="0.09999999999999998" cx="308.80000000000007" cy="183.07999999999998" r="3" fill="hsl(321, 100%, 50%, 0.8)" />
13
+ x+" data-x="1.2000000000000002" data-y="0.09999999999999998" cx="308.80000000000007" cy="208.33599999999998" r="3" fill="hsl(321, 100%, 50%, 0.8)" />
14
14
  </g>
15
15
  <g>
16
16
  <circle data-type="point" data-label="U1.4
17
- x-" data-x="-1.2000000000000002" data-y="0.30000000000000004" cx="40" cy="160.67999999999995" r="3" fill="hsl(322, 100%, 50%, 0.8)" />
17
+ x-" data-x="-1.2000000000000002" data-y="0.30000000000000004" cx="40" cy="185.93599999999998" r="3" fill="hsl(322, 100%, 50%, 0.8)" />
18
18
  </g>
19
19
  <g>
20
20
  <circle data-type="point" data-label="U1.5
21
- x-" data-x="-1.2000000000000002" data-y="0.10000000000000003" cx="40" cy="183.07999999999998" r="3" fill="hsl(323, 100%, 50%, 0.8)" />
21
+ x-" data-x="-1.2000000000000002" data-y="0.10000000000000003" cx="40" cy="208.33599999999996" r="3" fill="hsl(323, 100%, 50%, 0.8)" />
22
22
  </g>
23
23
  <g>
24
24
  <circle data-type="point" data-label="U1.6
25
- x-" data-x="-1.2000000000000002" data-y="-0.09999999999999998" cx="40" cy="205.47999999999996" r="3" fill="hsl(324, 100%, 50%, 0.8)" />
25
+ x-" data-x="-1.2000000000000002" data-y="-0.09999999999999998" cx="40" cy="230.73599999999996" r="3" fill="hsl(324, 100%, 50%, 0.8)" />
26
26
  </g>
27
27
  <g>
28
28
  <circle data-type="point" data-label="U1.7
29
- x+" data-x="1.2000000000000002" data-y="-0.10000000000000003" cx="308.80000000000007" cy="205.47999999999996" r="3" fill="hsl(325, 100%, 50%, 0.8)" />
29
+ x+" data-x="1.2000000000000002" data-y="-0.10000000000000003" cx="308.80000000000007" cy="230.736" r="3" fill="hsl(325, 100%, 50%, 0.8)" />
30
30
  </g>
31
31
  <g>
32
32
  <circle data-type="point" data-label="U1.8
33
- x+" data-x="1.2000000000000002" data-y="0.30000000000000004" cx="308.80000000000007" cy="160.67999999999995" r="3" fill="hsl(326, 100%, 50%, 0.8)" />
33
+ x+" data-x="1.2000000000000002" data-y="0.30000000000000004" cx="308.80000000000007" cy="185.93599999999998" r="3" fill="hsl(326, 100%, 50%, 0.8)" />
34
34
  </g>
35
35
  <g>
36
36
  <circle data-type="point" data-label="J1.1
37
- x-" data-x="1.6" data-y="-1.895" cx="353.6" cy="406.52" r="3" fill="hsl(218, 100%, 50%, 0.8)" />
37
+ x-" data-x="1.6" data-y="-1.895" cx="353.6" cy="431.77599999999995" r="3" fill="hsl(218, 100%, 50%, 0.8)" />
38
38
  </g>
39
39
  <g>
40
40
  <circle data-type="point" data-label="J1.2
41
- x-" data-x="1.6" data-y="-2.095" cx="353.6" cy="428.91999999999996" r="3" fill="hsl(219, 100%, 50%, 0.8)" />
41
+ x-" data-x="1.6" data-y="-2.095" cx="353.6" cy="454.176" r="3" fill="hsl(219, 100%, 50%, 0.8)" />
42
42
  </g>
43
43
  <g>
44
44
  <circle data-type="point" data-label="J1.3
45
- x-" data-x="1.6" data-y="-2.295" cx="353.6" cy="451.31999999999994" r="3" fill="hsl(220, 100%, 50%, 0.8)" />
45
+ x-" data-x="1.6" data-y="-2.295" cx="353.6" cy="476.5759999999999" r="3" fill="hsl(220, 100%, 50%, 0.8)" />
46
46
  </g>
47
47
  <g>
48
48
  <circle data-type="point" data-label="anchorPoint
49
- orientation: y-" data-x="1.049" data-y="-2.2950000000000004" cx="291.88800000000003" cy="451.32" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
49
+ orientation: y-" data-x="1.049" data-y="-2.2950000000000004" cx="291.88800000000003" cy="476.576" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
50
50
  </g>
51
51
  <g>
52
52
  <circle data-type="point" data-label="anchorPoint
53
- orientation: x+" data-x="1.2000000000000002" data-y="0.30000000000000004" cx="308.80000000000007" cy="160.67999999999995" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
53
+ orientation: y+" data-x="1.3010000000000002" data-y="0.5010000000000001" cx="320.1120000000001" cy="163.42399999999998" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
54
54
  </g>
55
55
  <g>
56
56
  <circle data-type="point" data-label="anchorPoint
57
- orientation: x-" data-x="1.6" data-y="-1.895" cx="353.6" cy="406.52" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
57
+ orientation: y+" data-x="1.499" data-y="-1.6940000000000002" cx="342.288" cy="409.264" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
58
58
  </g>
59
59
  <g>
60
60
  <circle data-type="point" data-label="anchorPoint
61
- orientation: x-" data-x="1.6" data-y="-2.095" cx="353.6" cy="428.91999999999996" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
61
+ orientation: x-" data-x="1.6" data-y="-2.095" cx="353.6" cy="454.176" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
62
62
  </g>
63
63
  <g>
64
- <polyline data-points="1.2000000000000002,-0.30000000000000004 1.6,-2.295" data-type="line" data-label="" points="308.80000000000007,227.88 353.6,451.31999999999994" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
64
+ <polyline data-points="1.2000000000000002,-0.30000000000000004 1.6,-2.295" data-type="line" data-label="" points="308.80000000000007,253.13599999999997 353.6,476.5759999999999" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
65
65
  </g>
66
66
  <g>
67
- <polyline data-points="1.2000000000000002,0.30000000000000004 1.6,-1.895" data-type="line" data-label="" points="308.80000000000007,160.67999999999995 353.6,406.52" fill="none" stroke="hsl(190, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
67
+ <polyline data-points="1.2000000000000002,0.30000000000000004 1.6,-1.895" data-type="line" data-label="" points="308.80000000000007,185.93599999999998 353.6,431.77599999999995" fill="none" stroke="hsl(190, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
68
68
  </g>
69
69
  <g>
70
- <polyline data-points="1.2000000000000002,-0.30000000000000004 1.4000000000000001,-0.30000000000000004 1.4000000000000001,-1.2975000000000003 1.049,-1.2975000000000003 1.049,-2.2950000000000004 1.6,-2.295" data-type="line" data-label="" points="308.80000000000007,227.88 331.20000000000005,227.88 331.20000000000005,339.6 291.88800000000003,339.6 291.88800000000003,451.32 353.6,451.31999999999994" fill="none" stroke="purple" stroke-width="1" />
70
+ <polyline data-points="1.2000000000000002,-0.30000000000000004 1.4000000000000001,-0.30000000000000004 1.4000000000000001,-1.2975000000000003 1.049,-1.2975000000000003 1.049,-2.2950000000000004 1.6,-2.295" data-type="line" data-label="" points="308.80000000000007,253.13599999999997 331.20000000000005,253.13599999999997 331.20000000000005,364.856 291.88800000000003,364.856 291.88800000000003,476.576 353.6,476.5759999999999" fill="none" stroke="purple" stroke-width="1" />
71
71
  </g>
72
72
  <g>
73
- <rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="40" y="138.27999999999997" width="268.80000000000007" height="112" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.008928571428571428" />
73
+ <polyline data-points="1.2000000000000002,0.30000000000000004 1.3010000000000002,0.30000000000000004 1.3010000000000002,0.5010000000000001" data-type="line" data-label="" points="308.80000000000007,185.93599999999998 320.1120000000001,185.93599999999998 320.1120000000001,163.42399999999998" fill="none" stroke="purple" stroke-width="1" />
74
74
  </g>
75
75
  <g>
76
- <rect data-type="rect" data-label="schematic_component_1" data-x="2.7" data-y="-2.095" x="353.6" y="384.12" width="246.39999999999998" height="89.59999999999997" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.008928571428571428" />
76
+ <polyline data-points="1.6,-1.895 1.499,-1.895 1.499,-1.6940000000000002" data-type="line" data-label="" points="353.6,431.77599999999995 342.288,431.77599999999995 342.288,409.264" fill="none" stroke="purple" stroke-width="1" />
77
+ </g>
78
+ <g>
79
+ <rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="40" y="163.53599999999997" width="268.80000000000007" height="111.99999999999997" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.008928571428571428" />
80
+ </g>
81
+ <g>
82
+ <rect data-type="rect" data-label="schematic_component_1" data-x="2.7" data-y="-2.095" x="353.6" y="409.376" width="246.39999999999998" height="89.60000000000002" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.008928571428571428" />
77
83
  </g>
78
84
  <g>
79
85
  <rect data-type="rect" data-label="netId: GND
80
- globalConnNetId: connectivity_net0" data-x="1.049" data-y="-2.5200000000000005" x="280.68800000000005" y="451.32" width="22.399999999999977" height="50.400000000000034" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
86
+ globalConnNetId: connectivity_net0" data-x="1.049" data-y="-2.5200000000000005" x="280.68800000000005" y="476.576" width="22.399999999999977" height="50.39999999999998" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
81
87
  </g>
82
88
  <g>
83
89
  <rect data-type="rect" data-label="netId: VCC
84
- globalConnNetId: connectivity_net1" data-x="1.4260000000000002" data-y="0.30000000000000004" x="308.91200000000003" y="149.47999999999996" width="50.400000000000034" height="22.400000000000006" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
90
+ globalConnNetId: connectivity_net1" data-x="1.3010000000000002" data-y="0.7260000000000001" x="308.91200000000003" y="113.02399999999997" width="22.400000000000034" height="50.400000000000006" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
85
91
  </g>
86
92
  <g>
87
93
  <rect data-type="rect" data-label="netId: VCC
88
- globalConnNetId: connectivity_net1" data-x="1.374" data-y="-1.895" x="303.088" y="395.31999999999994" width="50.400000000000034" height="22.400000000000034" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
94
+ globalConnNetId: connectivity_net1" data-x="1.499" data-y="-1.469" x="331.088" y="358.864" width="22.400000000000034" height="50.400000000000034" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
89
95
  </g>
90
96
  <g>
91
97
  <rect data-type="rect" data-label="netId: MMM
92
- globalConnNetId: connectivity_net2" data-x="1.374" data-y="-2.095" x="303.088" y="417.71999999999997" width="50.400000000000034" height="22.400000000000034" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
98
+ globalConnNetId: connectivity_net2" data-x="1.374" data-y="-2.095" x="303.088" y="442.976" width="50.400000000000034" height="22.399999999999977" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008928571428571428" />
93
99
  </g>
94
100
  <g id="crosshair" style="display: none">
95
101
  <line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
@@ -124,7 +130,7 @@ globalConnNetId: connectivity_net2" data-x="1.374" data-y="-2.095" x="303.088" y
124
130
  "e": 174.40000000000003,
125
131
  "b": 0,
126
132
  "d": -112,
127
- "f": 194.27999999999997
133
+ "f": 219.53599999999997
128
134
  };
129
135
  // Manually invert and apply the affine transform
130
136
  // Since we only use translate and scale, we can directly compute:
@@ -2,31 +2,31 @@
2
2
  <rect width="100%" height="100%" fill="white" />
3
3
  <g>
4
4
  <circle data-type="point" data-label="U1.1
5
- x+" data-x="1.2000000000000002" data-y="0.30000000000000004" cx="345.4545454545455" cy="297.72727272727275" r="3" fill="hsl(319, 100%, 50%, 0.8)" />
5
+ x+" data-x="1.2000000000000002" data-y="0.30000000000000004" cx="338.66666666666674" cy="298.22222222222223" r="3" fill="hsl(319, 100%, 50%, 0.8)" />
6
6
  </g>
7
7
  <g>
8
8
  <circle data-type="point" data-label="R1.1
9
- x+" data-x="3" data-y="-0.10000000000000016" cx="574.5454545454545" cy="348.6363636363637" r="3" fill="hsl(226, 100%, 50%, 0.8)" />
9
+ x+" data-x="3" data-y="-0.10000000000000016" cx="562.6666666666667" cy="348" r="3" fill="hsl(226, 100%, 50%, 0.8)" />
10
10
  </g>
11
11
  <g>
12
12
  <circle data-type="point" data-label="anchorPoint
13
- orientation: y+" data-x="2.2" data-y="0.30000000000000004" cx="472.72727272727275" cy="297.72727272727275" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
13
+ orientation: y+" data-x="3.2" data-y="0.30000000000000004" cx="587.5555555555557" cy="298.22222222222223" r="3" fill="hsl(40, 100%, 50%, 0.9)" />
14
14
  </g>
15
15
  <g>
16
- <polyline data-points="1.2000000000000002,0.30000000000000004 3,-0.10000000000000016" data-type="line" data-label="" points="345.4545454545455,297.72727272727275 574.5454545454545,348.6363636363637" fill="none" stroke="hsl(190, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
16
+ <polyline data-points="1.2000000000000002,0.30000000000000004 3,-0.10000000000000016" data-type="line" data-label="" points="338.66666666666674,298.22222222222223 562.6666666666667,348" fill="none" stroke="hsl(190, 100%, 50%, 0.8)" stroke-width="1" stroke-dasharray="4 2" />
17
17
  </g>
18
18
  <g>
19
- <polyline data-points="1.2000000000000002,0.30000000000000004 3.2,0.30000000000000004 3.2,-0.10000000000000016 3,-0.10000000000000016" data-type="line" data-label="" points="345.4545454545455,297.72727272727275 600,297.72727272727275 600,348.6363636363637 574.5454545454545,348.6363636363637" fill="none" stroke="purple" stroke-width="1" />
19
+ <polyline data-points="1.2000000000000002,0.30000000000000004 3.2,0.30000000000000004 3.2,-0.10000000000000016 3,-0.10000000000000016" data-type="line" data-label="" points="338.66666666666674,298.22222222222223 587.5555555555557,298.22222222222223 587.5555555555557,348 562.6666666666667,348" fill="none" stroke="purple" stroke-width="1" />
20
20
  </g>
21
21
  <g>
22
- <rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="40" y="272.2727272727273" width="305.4545454545455" height="127.27272727272725" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.007857142857142858" />
22
+ <rect data-type="rect" data-label="schematic_component_0" data-x="0" data-y="0" x="40.00000000000003" y="273.3333333333333" width="298.66666666666674" height="124.44444444444446" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.008035714285714287" />
23
23
  </g>
24
24
  <g>
25
- <rect data-type="rect" data-label="schematic_component_1" data-x="2.45" data-y="-0.10000000000000009" x="434.5454545454546" y="323.887500909091" width="139.9999999999999" height="49.49772545454533" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.007857142857142858" />
25
+ <rect data-type="rect" data-label="schematic_component_1" data-x="2.45" data-y="-0.10000000000000009" x="425.7777777777778" y="323.80111200000005" width="136.8888888888889" height="48.39777599999991" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.008035714285714287" />
26
26
  </g>
27
27
  <g>
28
28
  <rect data-type="rect" data-label="netId: VCC
29
- globalConnNetId: connectivity_net0" data-x="2.2" data-y="0.525" x="460" y="240.4545454545455" width="25.454545454545496" height="57.27272727272725" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.007857142857142858" />
29
+ globalConnNetId: connectivity_net0" data-x="3.2" data-y="0.525" x="575.1111111111111" y="242.22222222222223" width="24.888888888888914" height="56" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.008035714285714287" />
30
30
  </g>
31
31
  <g id="crosshair" style="display: none">
32
32
  <line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5" />
@@ -56,12 +56,12 @@ globalConnNetId: connectivity_net0" data-x="2.2" data-y="0.525" x="460" y="240.4
56
56
 
57
57
  // Calculate real coordinates using inverse transformation
58
58
  const matrix = {
59
- "a": 127.27272727272727,
59
+ "a": 124.44444444444444,
60
60
  "c": 0,
61
- "e": 192.72727272727275,
61
+ "e": 189.33333333333337,
62
62
  "b": 0,
63
- "d": -127.27272727272727,
64
- "f": 335.90909090909093
63
+ "d": -124.44444444444444,
64
+ "f": 335.55555555555554
65
65
  };
66
66
  // Manually invert and apply the affine transform
67
67
  // Since we only use translate and scale, we can directly compute: