@tscircuit/schematic-trace-solver 0.0.161 → 0.0.163
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 +4 -1
- package/dist/index.js +63 -23
- package/lib/solvers/AvailableNetOrientationSolver/AvailableNetOrientationSolver.ts +21 -3
- package/lib/solvers/AvailableNetOrientationSolver/types.ts +1 -0
- package/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts +28 -21
- package/lib/solvers/MspConnectionPairSolver/getMspConnectionPairsFromPins.ts +3 -3
- package/lib/solvers/MspConnectionPairSolver/shouldSeparateGroundNetRows.ts +40 -0
- package/lib/types/InputProblem.ts +3 -0
- package/package.json +1 -1
- package/tests/repros/__snapshots__/repro-bluetooth-controller-ground-decoupling-groups.snap.svg +41 -32
- package/tests/repros/__snapshots__/repro-isolated-rs485-isow7841.snap.svg +308 -0
- package/tests/repros/__snapshots__/repro-normal-net-label-branch-from-junction.snap.svg +93 -0
- package/tests/repros/assets/repro-isolated-rs485-isow7841.input.json +1992 -0
- package/tests/repros/repro-isolated-rs485-isow7841.test.ts +21 -0
- package/tests/repros/repro-normal-net-label-branch-from-junction.test.ts +73 -0
- package/tests/solvers/MspConnectionPairSolver/msp-connection-pair-solver-ground-net-rows.test.ts +57 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
<svg width="1200" height="2016" viewBox="0 0 1200 2016" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Solver debug visualization on top and Circuit JSON schematic on the bottom">
|
|
2
|
+
<g transform="translate(0, 0) scale(1.875, 1.875) translate(0, 0)">
|
|
3
|
+
<rect width="100%" height="100%" fill="white"/><g><polyline data-points="-6.7,-19 -4.7,-19" data-type="line" data-label="" points="261.6314199395772,335.8418017028289 569.2392199945072,335.8418017028289" fill="none" stroke="hsl(154, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-6.7,-19 -6.5,-19 -6.5,-19.525 -4.5,-19.525 -4.5,-19 -4.7,-19" data-type="line" data-label="" points="261.6314199395772,335.8418017028289 292.39219994507016,335.8418017028289 292.39219994507016,416.588849217248 600.0000000000001,416.588849217248 600.0000000000001,335.8418017028289 569.2392199945072,335.8418017028289" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-6.5,-19 -6.5,-19.05 -6.34,-19.05 -6.34,-18.749" data-type="line" data-label="" points="292.39219994507016,335.8418017028289 292.39219994507016,343.53199670420236 317.0008239494646,343.53199670420236 317.0008239494646,297.237022795935" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="R8" data-x="-7" data-y="-19" x="169.34907992309832" y="285.8555341939027" width="92.28234001647888" height="99.97253501785235" fill="hsl(78, 100%, 50%, 0.8)" stroke="black" stroke-width="0.006501785714285714"/></g><g><rect data-type="rect" data-label="R7" data-x="-5" data-y="-19" x="476.9568799780281" y="285.8555341939027" width="92.282340016479" height="99.97253501785235" fill="hsl(77, 100%, 50%, 0.8)" stroke="black" stroke-width="0.006501785714285714"/></g><g><rect data-type="rect" data-label="netId: U1_IO22
|
|
4
|
+
globalConnNetId: connectivity_net1" data-x="-7.721" data-y="-19" x="40.00000000000034" y="303.54298269706123" width="129.1952760230704" height="64.59763801153531" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.006501785714285714"/></g><g><rect data-type="rect" data-label="netId: V3V3
|
|
5
|
+
globalConnNetId: connectivity_net0" data-x="-6.34" data-y="-18.509" x="284.7020049436969" y="223.41115078275243" width="64.59763801153531" height="73.82587201318256" fill="#ef444466" stroke="#ef4444" stroke-width="0.006501785714285714"/></g><g><rect data-type="rect" data-label="netId: U1_IO21
|
|
6
|
+
globalConnNetId: connectivity_net2" data-x="-5.801" data-y="-19" x="322.99917605053565" y="303.54298269706123" width="153.80390002746503" height="64.59763801153531" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.006501785714285714"/></g><g><circle data-type="point" data-label="R8.pin1
|
|
7
|
+
x-" data-x="-7.3" data-y="-19" cx="169.34907992309832" cy="335.8418017028289" r="3" fill="hsl(140, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="R8.pin2
|
|
8
|
+
x+" data-x="-6.7" data-y="-19" cx="261.6314199395772" cy="335.8418017028289" r="3" fill="hsl(141, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="R7.pin1
|
|
9
|
+
x-" data-x="-5.3" data-y="-19" cx="476.95687997802816" cy="335.8418017028289" r="3" fill="hsl(349, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="R7.pin2
|
|
10
|
+
x+" data-x="-4.7" data-y="-19" cx="569.2392199945072" cy="335.8418017028289" r="3" fill="hsl(350, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="anchorPoint
|
|
11
|
+
orientation: x-" data-x="-7.3" data-y="-19" cx="169.34907992309832" cy="335.8418017028289" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
|
|
12
|
+
orientation: y+" data-x="-6.34" data-y="-18.749" cx="317.0008239494646" cy="297.237022795935" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
|
|
13
|
+
orientation: x-" data-x="-5.3" data-y="-19" cx="476.95687997802816" cy="335.8418017028289" 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[
|
|
14
|
+
document.currentScript.parentElement.addEventListener('mousemove', (e) => {
|
|
15
|
+
const svg = e.currentTarget;
|
|
16
|
+
const rect = svg.getBoundingClientRect();
|
|
17
|
+
const x = e.clientX - rect.left;
|
|
18
|
+
const y = e.clientY - rect.top;
|
|
19
|
+
const crosshair = svg.getElementById('crosshair');
|
|
20
|
+
const h = svg.getElementById('crosshair-h');
|
|
21
|
+
const v = svg.getElementById('crosshair-v');
|
|
22
|
+
const coords = svg.getElementById('coordinates');
|
|
23
|
+
|
|
24
|
+
crosshair.style.display = 'block';
|
|
25
|
+
h.setAttribute('x1', '0');
|
|
26
|
+
h.setAttribute('x2', '640');
|
|
27
|
+
h.setAttribute('y1', y);
|
|
28
|
+
h.setAttribute('y2', y);
|
|
29
|
+
v.setAttribute('x1', x);
|
|
30
|
+
v.setAttribute('x2', x);
|
|
31
|
+
v.setAttribute('y1', '0');
|
|
32
|
+
v.setAttribute('y2', '640');
|
|
33
|
+
|
|
34
|
+
// Calculate real coordinates using inverse transformation
|
|
35
|
+
const matrix = {"a":153.80390002746498,"c":0,"e":1292.1175501235925,"b":0,"d":-153.80390002746498,"f":-2586.4322988190056};
|
|
36
|
+
// Manually invert and apply the affine transform
|
|
37
|
+
// Since we only use translate and scale, we can directly compute:
|
|
38
|
+
// x' = (x - tx) / sx
|
|
39
|
+
// y' = (y - ty) / sy
|
|
40
|
+
const sx = matrix.a;
|
|
41
|
+
const sy = matrix.d;
|
|
42
|
+
const tx = matrix.e;
|
|
43
|
+
const ty = matrix.f;
|
|
44
|
+
const realPoint = {
|
|
45
|
+
x: (x - tx) / sx,
|
|
46
|
+
y: (y - ty) / sy // Flip y back since we used negative scale
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
|
|
50
|
+
coords.setAttribute('x', (x + 5).toString());
|
|
51
|
+
coords.setAttribute('y', (y - 5).toString());
|
|
52
|
+
});
|
|
53
|
+
document.currentScript.parentElement.addEventListener('mouseleave', () => {
|
|
54
|
+
document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
|
|
55
|
+
});
|
|
56
|
+
]]></script>
|
|
57
|
+
</g>
|
|
58
|
+
<g transform="translate(0, 1216)">
|
|
59
|
+
<style>
|
|
60
|
+
.boundary { fill: rgb(245, 241, 237); }
|
|
61
|
+
.schematic-boundary { fill: none; stroke: #fff; }
|
|
62
|
+
.component { fill: none; stroke: rgb(132, 0, 0); }
|
|
63
|
+
.chip { fill: rgb(255, 255, 194); stroke: rgb(132, 0, 0); }
|
|
64
|
+
.component-pin { fill: none; stroke: rgb(132, 0, 0); }
|
|
65
|
+
.text { font-family: sans-serif; fill: rgb(0, 150, 0); }
|
|
66
|
+
.pin-number { fill: rgb(169, 0, 0); }
|
|
67
|
+
.port-label { fill: rgb(0, 100, 100); }
|
|
68
|
+
.component-name { fill: rgb(0, 100, 100); }
|
|
69
|
+
|
|
70
|
+
</style><rect class="boundary" x="0" y="0" width="1200" height="800"/><g class="trace sch-trace" data-layer="base" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_0__stack1"><path d="M 500.98568079765005 434.0441155701001 L 551.8230858305501 434.0441155701001 L 551.8230858305501 567.4923037814624 L 1060.1971361595502 567.4923037814624 L 1060.1971361595502 434.0441155701001 L 1009.3597311266501 434.0441155701001" class="trace-invisible-hover-outline sch-trace-hitbox" stroke="rgb(0, 150, 0)" fill="none" stroke-width="40.669924026320004px" stroke-linecap="round" opacity="0" stroke-linejoin="round"/><path class="sch-trace-path" d="M 500.98568079765005 434.0441155701001 L 551.8230858305501 434.0441155701001 L 551.8230858305501 567.4923037814624 L 1060.1971361595502 567.4923037814624 L 1060.1971361595502 434.0441155701001 L 1009.3597311266501 434.0441155701001" stroke="rgb(0, 150, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round" stroke-linejoin="round"/></g><g class="trace sch-trace" data-layer="base" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_1__stack1"><path d="M 551.8230858305501 434.0441155701001 L 551.8230858305501 446.75346682832514 L 592.49300985687 446.75346682832514 L 592.49300985687 370.24317225381037" class="trace-invisible-hover-outline sch-trace-hitbox" stroke="rgb(0, 150, 0)" fill="none" stroke-width="40.669924026320004px" stroke-linecap="round" opacity="0" stroke-linejoin="round"/><path class="sch-trace-path" d="M 551.8230858305501 434.0441155701001 L 551.8230858305501 446.75346682832514 L 592.49300985687 446.75346682832514 L 592.49300985687 370.24317225381037" stroke="rgb(0, 150, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round" stroke-linejoin="round"/></g><g class="trace-overlays sch-trace-overlays" data-layer="overlay" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_0__stack1"><circle cx="551.8230858305501" cy="434.0441155701001" r="7.625610754935" class="trace-junction sch-trace-junction" fill="rgb(0, 150, 0)"/></g><g class="trace-overlays sch-trace-overlays" data-layer="overlay" data-circuit-json-type="schematic_trace" data-schematic-trace-id="schematic_trace_1__stack1"/><g class="sch-component" data-circuit-json-type="schematic_component" data-schematic-component-id="schematic_component_0__stack1"><rect class="component-overlay sch-component-overlay" x="348.4734656989501" y="413.7142372974434" width="152.51221509869993" height="40.65975654531337" fill="transparent"/><path class="sch-component-symbol-path" d="M 348.4734656989501 434.0441155701001 L 373.8972519559034 434.0441155701001" stroke="rgb(132, 0, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 475.56189454069676 434.0441155701001 L 500.98568079765005 434.0441155701001" stroke="rgb(132, 0, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 373.8972519559034 413.7142372974434 L 475.56189454069676 413.7142372974434 L 475.56189454069676 454.37399384275676 L 373.8972519559034 454.37399384275676 L 373.8972519559034 413.7142372974434" stroke="rgb(132, 0, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round"/><text class="sch-component-name sch-component-text" x="424.7295732483001" y="393.3741915437801" stroke="rgb(245, 241, 237)" stroke-width="5.0837405032900005px" paint-order="stroke" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="ideographic" font-size="45.75366452961px">R8</text><text class="sch-component-text" x="424.7295732483001" y="474.71403959642004" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="hanging" font-size="45.75366452961px"></text><circle class="component-pin sch-component-pin" cx="348.4734656989501" cy="434.0441155701001" r="5.0837405032900005px" stroke-width="5.0837405032900005px" fill="none" stroke="rgb(132, 0, 0)"/></g><g class="sch-component" data-circuit-json-type="schematic_component" data-schematic-component-id="schematic_component_1__stack1"><rect class="component-overlay sch-component-overlay" x="856.8475160279502" y="413.7142372974434" width="152.51221509869993" height="40.65975654531337" fill="transparent"/><path class="sch-component-symbol-path" d="M 856.8475160279502 434.0441155701001 L 882.2713022849034 434.0441155701001" stroke="rgb(132, 0, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 983.9359448696969 434.0441155701001 L 1009.3597311266501 434.0441155701001" stroke="rgb(132, 0, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round"/><path class="sch-component-symbol-path" d="M 882.2713022849034 413.7142372974434 L 983.9359448696969 413.7142372974434 L 983.9359448696969 454.37399384275676 L 882.2713022849034 454.37399384275676 L 882.2713022849034 413.7142372974434" stroke="rgb(132, 0, 0)" fill="none" stroke-width="5.0837405032900005px" stroke-linecap="round"/><text class="sch-component-name sch-component-text" x="933.1036235773001" y="393.3741915437801" stroke="rgb(245, 241, 237)" stroke-width="5.0837405032900005px" paint-order="stroke" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="ideographic" font-size="45.75366452961px">R7</text><text class="sch-component-text" x="933.1036235773001" y="474.71403959642004" fill="rgb(15, 15, 15)" font-family="sans-serif" text-anchor="middle" dominant-baseline="hanging" font-size="45.75366452961px"></text><circle class="component-pin sch-component-pin" cx="856.8475160279502" cy="434.0441155701001" r="5.0837405032900005px" stroke-width="5.0837405032900005px" fill="none" stroke="rgb(132, 0, 0)"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_0_0__stack1"><circle cx="348.4734656989501" cy="434.0441155701001" r="10.167481006580001" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_0_1__stack1"><circle cx="500.98568079765005" cy="434.0441155701001" r="10.167481006580001" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_1_0__stack1"><circle cx="856.8475160279502" cy="434.0441155701001" r="10.167481006580001" fill="red" opacity="0"/></g><g class="schematic-port-hover sch-port-hover" data-schematic-port-id="source_port_1_1__stack1"><circle cx="1009.3597311266501" cy="434.0441155701001" r="10.167481006580001" fill="red" opacity="0"/></g><path class="net-label sch-net-label" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_0__stack1" d="
|
|
71
|
+
M 348.4734656989501,434.0441155701001
|
|
72
|
+
L 334.7473663400671,459.4628180865501
|
|
73
|
+
L 127.09351258234827,459.46281808655004
|
|
74
|
+
L 127.09351258234827,408.62541305365005
|
|
75
|
+
L 334.7473663400671,408.62541305365005
|
|
76
|
+
Z
|
|
77
|
+
" fill="rgba(255, 255, 255, 0.6)" stroke="rgb(132, 0, 0)" stroke-width="5.0837405032900005px"/><text class="net-label-text sch-net-label-text" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_0__stack1" x="325.59663343414513" y="434.0441155701001" fill="rgb(132, 0, 0)" text-anchor="end" dominant-baseline="central" font-family="sans-serif" font-variant-numeric="tabular-nums" font-size="45.75366452961px" transform="">U1_IO22</text><path class="net-label sch-net-label" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_1__stack1" d="
|
|
78
|
+
M 592.49300985687,370.24317225381037
|
|
79
|
+
L 567.07430734042,356.51707289492737
|
|
80
|
+
L 567.07430734042,219.79834495978162
|
|
81
|
+
L 617.91171237332,219.79834495978162
|
|
82
|
+
L 617.91171237332,356.51707289492737
|
|
83
|
+
Z
|
|
84
|
+
" fill="rgba(255, 255, 255, 0.6)" stroke="rgb(132, 0, 0)" stroke-width="5.0837405032900005px"/><text class="net-label-text sch-net-label-text" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_1__stack1" x="592.49300985687" y="347.3663399890054" fill="rgb(132, 0, 0)" text-anchor="start" dominant-baseline="central" font-family="sans-serif" font-variant-numeric="tabular-nums" font-size="45.75366452961px" transform="rotate(-90 592.49300985687 347.3663399890054)">V3V3</text><path class="net-label sch-net-label" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_2__stack1" d="
|
|
85
|
+
M 856.8475160279502,434.0441155701001
|
|
86
|
+
L 843.1214166690672,459.4628180865501
|
|
87
|
+
L 635.4675629113483,459.46281808655004
|
|
88
|
+
L 635.4675629113483,408.62541305365005
|
|
89
|
+
L 843.1214166690672,408.62541305365005
|
|
90
|
+
Z
|
|
91
|
+
" fill="rgba(255, 255, 255, 0.6)" stroke="rgb(132, 0, 0)" stroke-width="5.0837405032900005px"/><text class="net-label-text sch-net-label-text" data-circuit-json-type="schematic_net_label" data-schematic-net-label-id="schematic_net_label_2__stack1" x="833.9706837631452" y="434.0441155701001" fill="rgb(132, 0, 0)" text-anchor="end" dominant-baseline="central" font-family="sans-serif" font-variant-numeric="tabular-nums" font-size="45.75366452961px" transform="">U1_IO21</text>
|
|
92
|
+
</g>
|
|
93
|
+
</svg>
|