@tscircuit/schematic-trace-solver 0.0.123 → 0.0.125

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.
@@ -0,0 +1,32 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import inputProblem from "./bug-report-20260806T061548Z.json"
4
+ import "tests/fixtures/matcher"
5
+ import { getTraceLabelCollisions } from "tests/fixtures/traceLabelCollisions"
6
+
7
+ test("bug-report-20260806T061548Z", () => {
8
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
9
+
10
+ solver.solve()
11
+
12
+ const railOutput = solver.railNetLabelCornerPlacementSolver!.getOutput()
13
+ const finalOutput = solver.sameNetJunctionAlignmentSolver!.getOutput()
14
+ const v3v3Label = railOutput.netLabelPlacements.find(
15
+ (label) =>
16
+ label.netId === "V3V3" &&
17
+ label.mspConnectionPairIds.includes(
18
+ "schematic_port_43-schematic_port_41",
19
+ ),
20
+ )!
21
+ const pin45Trace = finalOutput.traces.find(
22
+ (trace) => trace.mspPairId === "schematic_port_49-schematic_port_44",
23
+ )!
24
+
25
+ expect(v3v3Label.anchorPoint.x).toBeGreaterThan(2.901)
26
+ expect(pin45Trace.tracePath).toHaveLength(4)
27
+ expect(
28
+ getTraceLabelCollisions(finalOutput.traces, finalOutput.netLabelPlacements),
29
+ ).toEqual([])
30
+
31
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
32
+ })
@@ -1,20 +1,20 @@
1
- <svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="white"/><g><polyline data-points="-0.8,0.2 -2,0.5" data-type="line" data-label="" points="422.5742574257426,278.4158415841584 289.50495049504957,245.14851485148515" fill="none" stroke="hsl(190, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-0.8,0 -4,0.5" data-type="line" data-label="" points="422.5742574257426,300.5940594059406 67.72277227722776,245.14851485148515" fill="none" stroke="hsl(57, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-0.8,-0.2 -4,-0.5" data-type="line" data-label="" points="422.5742574257426,322.7722772277228 67.72277227722776,356.03960396039605" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-0.8,-0.2 -2,-0.5" data-type="line" data-label="" points="422.5742574257426,322.7722772277228 289.50495049504957,356.03960396039605" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-4,-0.5 -2,-0.5" data-type="line" data-label="" points="67.72277227722776,356.03960396039605 289.50495049504957,356.03960396039605" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-0.8,0.20000000000000018 -1.4,0.20000000000000018 -1.4,0.6 -2,0.6 -2,0.5" data-type="line" data-label="" points="422.5742574257426,278.4158415841584 356.0396039603961,278.4158415841584 356.0396039603961,234.05940594059405 289.50495049504957,234.05940594059405 289.50495049504957,245.14851485148515" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-0.7999999999999998,0 -1.275,0 -1.275,0.8000000000000002 -4,0.8000000000000002 -4,0.5" data-type="line" data-label="" points="422.57425742574264,300.5940594059406 369.90099009900996,300.5940594059406 369.90099009900996,211.88118811881185 67.72277227722776,211.88118811881185 67.72277227722776,245.14851485148515" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-0.8,-0.20000000000000018 -1.4,-0.20000000000000018 -1.4,-0.7 -2,-0.7 -2,-0.5" data-type="line" data-label="" points="422.5742574257426,322.7722772277228 356.0396039603961,322.7722772277228 356.0396039603961,378.2178217821782 289.50495049504957,378.2178217821782 289.50495049504957,356.03960396039605" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-4,-0.5 -4,-0.7000000000000002 -2,-0.7000000000000002 -2,-0.5" data-type="line" data-label="" points="67.72277227722776,356.03960396039605 67.72277227722776,378.21782178217825 289.50495049504957,378.21782178217825 289.50495049504957,356.03960396039605" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="U1" data-x="0" data-y="0" x="422.57425742574264" y="267.3267326732673" width="177.4257425742574" height="66.53465346534654" fill="hsl(164, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="C1" data-x="-2" data-y="0" x="261.78217821782187" y="245.14851485148512" width="55.445544554455466" height="110.8910891089109" fill="hsl(326, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="C2" data-x="-4" data-y="0" x="40.00000000000006" y="245.14851485148512" width="55.44554455445541" height="110.8910891089109" fill="hsl(327, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="netId: VCC
2
- globalConnNetId: connectivity_net0" data-x="-1.1" data-y="0.42500000000000016" x="378.21782178217825" y="228.51485148514848" width="22.178217821782198" height="49.9009900990099" fill="#ef444466" stroke="#ef4444" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="netId: EN
3
- globalConnNetId: connectivity_net1" data-x="-1.5" data-y="0" x="320" y="289.5049504950495" width="49.90099009900996" height="22.17821782178214" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="netId: GND
4
- globalConnNetId: connectivity_net2" data-x="-2" data-y="-0.9249999999999999" x="278.41584158415844" y="378.21782178217825" width="22.178217821782198" height="49.9009900990099" fill="#00000066" stroke="#000000" stroke-width="0.009017857142857143"/></g><g><circle data-type="point" data-label="U1.1
5
- x-" data-x="-0.8" data-y="0.2" cx="422.5742574257426" cy="278.4158415841584" r="3" fill="hsl(319, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.2
6
- x-" data-x="-0.8" data-y="0" cx="422.5742574257426" cy="300.5940594059406" r="3" fill="hsl(320, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.3
7
- x-" data-x="-0.8" data-y="-0.2" cx="422.5742574257426" cy="322.7722772277228" r="3" fill="hsl(321, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.4
8
- x+" data-x="0.8" data-y="-0.2" cx="600" cy="322.7722772277228" r="3" fill="hsl(322, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.5
9
- x+" data-x="0.8" data-y="0" cx="600" cy="300.5940594059406" r="3" fill="hsl(323, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.6
10
- x+" data-x="0.8" data-y="0.2" cx="600" cy="278.4158415841584" r="3" fill="hsl(324, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C1.1
11
- y+" data-x="-2" data-y="0.5" cx="289.50495049504957" cy="245.14851485148515" r="3" fill="hsl(121, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C1.2
12
- y-" data-x="-2" data-y="-0.5" cx="289.50495049504957" cy="356.03960396039605" r="3" fill="hsl(122, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C2.1
13
- y+" data-x="-4" data-y="0.5" cx="67.72277227722776" cy="245.14851485148515" r="3" fill="hsl(2, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C2.2
14
- y-" data-x="-4" data-y="-0.5" cx="67.72277227722776" cy="356.03960396039605" r="3" fill="hsl(3, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="anchorPoint
15
- orientation: y+" data-x="-1.1" data-y="0.20000000000000018" cx="389.3069306930693" cy="278.4158415841584" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
16
- orientation: x-" data-x="-1.275" data-y="0" cx="369.90099009900996" cy="300.5940594059406" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
17
- orientation: y-" data-x="-2" data-y="-0.7" cx="289.50495049504957" cy="378.2178217821782" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g id="crosshair" style="display: none"><line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5"/><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></g><script><![CDATA[
1
+ <svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="white"/><g><polyline data-points="-0.8,0.2 -2,0.5" data-type="line" data-label="" points="422.5742574257426,292.2772277227723 289.50495049504957,259.009900990099" fill="none" stroke="hsl(190, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-0.8,0 -4,0.5" data-type="line" data-label="" points="422.5742574257426,314.4554455445545 67.72277227722776,259.009900990099" fill="none" stroke="hsl(57, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="-0.8,-0.2 -4,-0.5" data-type="line" data-label="" points="422.5742574257426,336.6336633663367 67.72277227722776,369.90099009900996" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-0.8,-0.2 -2,-0.5" data-type="line" data-label="" points="422.5742574257426,336.6336633663367 289.50495049504957,369.90099009900996" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-4,-0.5 -2,-0.5" data-type="line" data-label="" points="67.72277227722776,369.90099009900996 289.50495049504957,369.90099009900996" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-0.8,0.20000000000000018 -1.0749999999999997,0.20000000000000018 -1.0749999999999997,0.6 -2,0.6 -2,0.5" data-type="line" data-label="" points="422.5742574257426,292.2772277227723 392.07920792079216,292.2772277227723 392.07920792079216,247.92079207920796 289.50495049504957,247.92079207920796 289.50495049504957,259.009900990099" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-0.7999999999999998,0 -1.275,0 -1.275,0.8000000000000002 -4,0.8000000000000002 -4,0.5" data-type="line" data-label="" points="422.57425742574264,314.4554455445545 369.90099009900996,314.4554455445545 369.90099009900996,225.74257425742576 67.72277227722776,225.74257425742576 67.72277227722776,259.009900990099" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-0.8,-0.20000000000000018 -1.4,-0.20000000000000018 -1.4,-0.7 -2,-0.7 -2,-0.5" data-type="line" data-label="" points="422.5742574257426,336.6336633663367 356.0396039603961,336.6336633663367 356.0396039603961,392.0792079207921 289.50495049504957,392.0792079207921 289.50495049504957,369.90099009900996" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-4,-0.5 -4,-0.7000000000000002 -2,-0.7000000000000002 -2,-0.5" data-type="line" data-label="" points="67.72277227722776,369.90099009900996 67.72277227722776,392.0792079207921 289.50495049504957,392.0792079207921 289.50495049504957,369.90099009900996" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="U1" data-x="0" data-y="0" x="422.57425742574264" y="281.1881188118812" width="177.4257425742574" height="66.53465346534654" fill="hsl(164, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="C1" data-x="-2" data-y="0" x="261.78217821782187" y="259.009900990099" width="55.445544554455466" height="110.89108910891093" fill="hsl(326, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="C2" data-x="-4" data-y="0" x="40.00000000000006" y="259.009900990099" width="55.44554455445541" height="110.89108910891093" fill="hsl(327, 100%, 50%, 0.8)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="netId: VCC
2
+ globalConnNetId: connectivity_net0" data-x="-1.0749999999999997" data-y="0.825" x="380.9900990099011" y="198.01980198019808" width="22.17821782178214" height="49.9009900990099" fill="#ef444466" stroke="#ef4444" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="netId: EN
3
+ globalConnNetId: connectivity_net1" data-x="-1.5" data-y="0" x="320" y="303.3663366336634" width="49.90099009900996" height="22.17821782178214" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.009017857142857143"/></g><g><rect data-type="rect" data-label="netId: GND
4
+ globalConnNetId: connectivity_net2" data-x="-2" data-y="-0.9249999999999999" x="278.41584158415844" y="392.0792079207921" width="22.178217821782198" height="49.9009900990099" fill="#00000066" stroke="#000000" stroke-width="0.009017857142857143"/></g><g><circle data-type="point" data-label="U1.1
5
+ x-" data-x="-0.8" data-y="0.2" cx="422.5742574257426" cy="292.2772277227723" r="3" fill="hsl(319, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.2
6
+ x-" data-x="-0.8" data-y="0" cx="422.5742574257426" cy="314.4554455445545" r="3" fill="hsl(320, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.3
7
+ x-" data-x="-0.8" data-y="-0.2" cx="422.5742574257426" cy="336.6336633663367" r="3" fill="hsl(321, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.4
8
+ x+" data-x="0.8" data-y="-0.2" cx="600" cy="336.6336633663367" r="3" fill="hsl(322, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.5
9
+ x+" data-x="0.8" data-y="0" cx="600" cy="314.4554455445545" r="3" fill="hsl(323, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="U1.6
10
+ x+" data-x="0.8" data-y="0.2" cx="600" cy="292.2772277227723" r="3" fill="hsl(324, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C1.1
11
+ y+" data-x="-2" data-y="0.5" cx="289.50495049504957" cy="259.009900990099" r="3" fill="hsl(121, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C1.2
12
+ y-" data-x="-2" data-y="-0.5" cx="289.50495049504957" cy="369.90099009900996" r="3" fill="hsl(122, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C2.1
13
+ y+" data-x="-4" data-y="0.5" cx="67.72277227722776" cy="259.009900990099" r="3" fill="hsl(2, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="C2.2
14
+ y-" data-x="-4" data-y="-0.5" cx="67.72277227722776" cy="369.90099009900996" r="3" fill="hsl(3, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="anchorPoint
15
+ orientation: y+" data-x="-1.0749999999999997" data-y="0.6" cx="392.07920792079216" cy="247.92079207920796" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
16
+ orientation: x-" data-x="-1.275" data-y="0" cx="369.90099009900996" cy="314.4554455445545" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
17
+ orientation: y-" data-x="-2" data-y="-0.7" cx="289.50495049504957" cy="392.0792079207921" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g id="crosshair" style="display: none"><line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5"/><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></g><script><![CDATA[
18
18
  document.currentScript.parentElement.addEventListener('mousemove', (e) => {
19
19
  const svg = e.currentTarget;
20
20
  const rect = svg.getBoundingClientRect();
@@ -36,7 +36,7 @@ orientation: y-" data-x="-2" data-y="-0.7" cx="289.50495049504957" cy="378.21782
36
36
  v.setAttribute('y2', '640');
37
37
 
38
38
  // Calculate real coordinates using inverse transformation
39
- const matrix = {"a":110.89108910891089,"c":0,"e":511.2871287128713,"b":0,"d":-110.89108910891089,"f":300.5940594059406};
39
+ const matrix = {"a":110.89108910891089,"c":0,"e":511.2871287128713,"b":0,"d":-110.89108910891089,"f":314.4554455445545};
40
40
  // Manually invert and apply the affine transform
41
41
  // Since we only use translate and scale, we can directly compute:
42
42
  // x' = (x - tx) / sx