@tscircuit/schematic-trace-solver 0.0.112 → 0.0.114

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 (22) hide show
  1. package/dist/index.d.ts +10 -0
  2. package/dist/index.js +128 -10
  3. package/lib/solvers/LongDistancePairSolver/LongDistancePairSolver.ts +55 -1
  4. package/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts +13 -4
  5. package/lib/solvers/MspConnectionPairSolver/isLabeledPeripheralConnection.ts +44 -0
  6. package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +30 -3
  7. package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapIssueSolver/TraceOverlapIssueSolver.ts +11 -1
  8. package/lib/solvers/TraceOverlapShiftSolver/TraceOverlapShiftSolver.ts +12 -0
  9. package/package.json +1 -1
  10. package/site/bug-reports/bug-report-20260728T144234Z.page.tsx +4 -0
  11. package/site/bug-reports/bug-report-20260728T225606Z.page.tsx +4 -0
  12. package/tests/bug-reports/bug-report-20260707T092615Z/__snapshots__/bug-report-20260707T092615Z.snap.svg +1 -1
  13. package/tests/bug-reports/bug-report-20260728T144234Z/__snapshots__/bug-report-20260728T144234Z.snap.svg +108 -0
  14. package/tests/bug-reports/bug-report-20260728T144234Z/bug-report-20260728T144234Z.json +518 -0
  15. package/tests/bug-reports/bug-report-20260728T144234Z/bug-report-20260728T144234Z.test.ts +12 -0
  16. package/tests/bug-reports/bug-report-20260728T225606Z/__snapshots__/bug-report-20260728T225606Z.snap.svg +131 -0
  17. package/tests/bug-reports/bug-report-20260728T225606Z/bug-report-20260728T225606Z.json +1127 -0
  18. package/tests/bug-reports/bug-report-20260728T225606Z/bug-report-20260728T225606Z.test.ts +35 -0
  19. package/tests/repros/__snapshots__/repro-atmega328p-missing-gnd-netlabel.snap.svg +1 -1
  20. package/tests/repros/__snapshots__/repro-rp2040-usb-cc2-ground-overlap.snap.svg +70 -0
  21. package/tests/repros/assets/repro-rp2040-usb-cc2-ground-overlap.input.json +164 -0
  22. package/tests/repros/repro-rp2040-usb-cc2-ground-overlap.test.ts +95 -0
@@ -0,0 +1,35 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import inputProblem from "./bug-report-20260728T225606Z.json"
4
+ import "tests/fixtures/matcher"
5
+
6
+ test("bug-report-20260728T225606Z", () => {
7
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
8
+
9
+ solver.solve()
10
+
11
+ const routedPinPairs = solver
12
+ .netLabelTraceCollisionSolver!.getOutput()
13
+ .traces.map((trace) => new Set(trace.pinIds))
14
+
15
+ expect(
16
+ routedPinPairs.some(
17
+ (pinIds) =>
18
+ pinIds.has("schematic_port_3") && pinIds.has("schematic_port_56"),
19
+ ),
20
+ ).toBe(true)
21
+ expect(
22
+ routedPinPairs.some(
23
+ (pinIds) =>
24
+ pinIds.has("schematic_port_4") && pinIds.has("schematic_port_57"),
25
+ ),
26
+ ).toBe(true)
27
+ expect(
28
+ routedPinPairs.some(
29
+ (pinIds) =>
30
+ pinIds.has("schematic_port_7") && pinIds.has("schematic_port_60"),
31
+ ),
32
+ ).toBe(true)
33
+
34
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
35
+ })
@@ -1,4 +1,4 @@
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="13.45,16 8.9,14.5" data-type="line" data-label="" points="439.8389477922427,115.96732009126299 97.87142665414046,228.70386552140667" fill="none" stroke="hsl(16, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="14.55,16 8.9,15.1" data-type="line" data-label="" points="522.5124144410149,115.96732009126299 97.87142665414046,183.6092473493493" fill="none" stroke="hsl(16, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="13.45,14 11.1,13.1" data-type="line" data-label="" points="439.8389477922427,266.28271399812115 263.2183599516844,333.92464125620734" fill="none" stroke="hsl(160, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="8.9,15.1 8.9,14.7" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 97.87142665414046,213.67232613072088" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,15.1 11.1,13.3" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 263.2183599516844,318.89310186552143" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,15.1 14.55,14" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 522.5124144410149,266.28271399812115" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,15.1 14.55,16" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.7 11.1,13.3" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 263.2183599516844,318.89310186552143" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.7 14.55,14" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 522.5124144410149,266.28271399812115" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.7 14.55,16" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,13.3 14.55,14" data-type="line" data-label="" points="263.2183599516844,318.89310186552143 522.5124144410149,266.28271399812115" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,13.3 14.55,16" data-type="line" data-label="" points="263.2183599516844,318.89310186552143 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="14.55,14 14.55,16" data-type="line" data-label="" points="522.5124144410149,266.28271399812115 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 8.9,14.5" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 97.87142665414046,228.70386552140667" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 11.1,12.7" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 263.2183599516844,363.98772003757904" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 13.14,10" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 416.54006173667983,566.9135018118375" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 13.45,16" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 11.1,12.7" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 263.2183599516844,363.98772003757904" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 13.14,10" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 416.54006173667983,566.9135018118375" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 13.45,16" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,12.7 13.14,10" data-type="line" data-label="" points="263.2183599516844,363.98772003757904 416.54006173667983,566.9135018118375" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,12.7 13.45,16" data-type="line" data-label="" points="263.2183599516844,363.98772003757904 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="13.14,10 13.45,16" data-type="line" data-label="" points="416.54006173667983,566.9135018118375 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,15.5 14.86,10" data-type="line" data-label="" points="263.2183599516844,153.54616856797747 545.8113004965778,566.9135018118375" fill="none" stroke="hsl(50, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 8.600000000000001,14.5 8.600000000000001,14.9 8.9,14.9" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 75.32411756811189,228.70386552140667 75.32411756811189,198.64078674003486 97.87142665414046,198.64078674003486" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="14.55,16 14.75,16 14.75,14 14.55,14" data-type="line" data-label="" points="522.5124144410149,115.96732009126299 537.5439538317005,115.96732009126299 537.5439538317005,266.28271399812115 522.5124144410149,266.28271399812115" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="8.9,14.7 8.8,14.7 8.8,15.1 8.9,15.1" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 90.35565695879757,213.67232613072088 90.35565695879757,183.6092473493493 97.87142665414046,183.6092473493493" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="13.45,16 12.274999999999999,16 12.274999999999999,13.299999999999999 13.630999999999998,13.299999999999999 13.630999999999998,12.9 12.274999999999999,12.9 12.274999999999999,12.7 11.1,12.7" data-type="line" data-label="" points="439.8389477922427,115.96732009126299 351.52865387196346,115.96732009126299 351.52865387196346,318.89310186552154 453.4424909408133,318.89310186552154 453.4424909408133,348.95618064689313 351.52865387196346,348.95618064689313 351.52865387196346,363.98772003757904 263.2183599516844,363.98772003757904" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="14.75,16 15.010000000000002,16 15.010000000000002,15.999" data-type="line" data-label="" points="537.5439538317005,115.96732009126299 557.0849550395922,115.96732009126299 557.0849550395922,116.04247778821627" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="11.1,13.3 13.860999999999999,13.3 13.860999999999999,12.799000000000001" data-type="line" data-label="" points="263.2183599516844,318.89310186552143 470.72876124010213,318.89310186552143 470.72876124010213,356.5471080391894" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="8.600000000000001,14.5 8.34,14.5 8.34,14.501" data-type="line" data-label="" points="75.32411756811189,228.70386552140667 55.783116360220106,228.70386552140667 55.783116360220106,228.62870782445316" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="13.14,10 12.929,10 12.929,10.401" data-type="line" data-label="" points="416.54006173667983,566.9135018118375 400.6817876795062,566.9135018118375 400.6817876795062,536.7752653335124" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="schematic_component_0" data-x="10" data-y="14" x="97.87142665414046" y="138.51462917729174" width="165.34693329754396" height="255.53616964165883" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="schematic_component_1" data-x="14" data-y="14" x="439.83894779224266" y="219.68494188699515" width="82.6734666487722" height="93.19554422225201" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="schematic_component_2" data-x="14" data-y="10" x="416.5400617366798" y="537.6429346396459" width="129.27123875989798" height="58.54113434438318" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="schematic_component_3" data-x="14" data-y="16" x="439.83894779224266" y="69.36954798013699" width="82.6734666487722" height="93.19554422225201" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="ATMEGA328P_AU" data-x="10.080000000000002" data-y="12.17" x="127.93450543551216" y="397.05710669708776" width="117.24600724734955" height="13.528385451617169" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="U_MCU" data-x="9.600000000000001" data-y="15.83" x="127.93450543551222" y="121.97993584753738" width="45.094618172057494" height="13.528385451617169" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="netId: GND
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="13.45,16 8.9,14.5" data-type="line" data-label="" points="439.8389477922427,115.96732009126299 97.87142665414046,228.70386552140667" fill="none" stroke="hsl(16, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="14.55,16 8.9,15.1" data-type="line" data-label="" points="522.5124144410149,115.96732009126299 97.87142665414046,183.6092473493493" fill="none" stroke="hsl(16, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="13.45,14 11.1,13.1" data-type="line" data-label="" points="439.8389477922427,266.28271399812115 263.2183599516844,333.92464125620734" fill="none" stroke="hsl(160, 100%, 50%, 0.8)" stroke-width="1px"/></g><g><polyline data-points="8.9,15.1 8.9,14.7" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 97.87142665414046,213.67232613072088" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,15.1 11.1,13.3" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 263.2183599516844,318.89310186552143" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,15.1 14.55,14" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 522.5124144410149,266.28271399812115" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,15.1 14.55,16" data-type="line" data-label="" points="97.87142665414046,183.6092473493493 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.7 11.1,13.3" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 263.2183599516844,318.89310186552143" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.7 14.55,14" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 522.5124144410149,266.28271399812115" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.7 14.55,16" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,13.3 14.55,14" data-type="line" data-label="" points="263.2183599516844,318.89310186552143 522.5124144410149,266.28271399812115" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,13.3 14.55,16" data-type="line" data-label="" points="263.2183599516844,318.89310186552143 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="14.55,14 14.55,16" data-type="line" data-label="" points="522.5124144410149,266.28271399812115 522.5124144410149,115.96732009126299" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 8.9,14.5" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 97.87142665414046,228.70386552140667" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 11.1,12.7" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 263.2183599516844,363.98772003757904" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 13.14,10" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 416.54006173667983,566.9135018118375" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.9 13.45,16" data-type="line" data-label="" points="97.87142665414046,198.64078674003486 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 11.1,12.7" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 263.2183599516844,363.98772003757904" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 13.14,10" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 416.54006173667983,566.9135018118375" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 13.45,16" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,12.7 13.14,10" data-type="line" data-label="" points="263.2183599516844,363.98772003757904 416.54006173667983,566.9135018118375" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,12.7 13.45,16" data-type="line" data-label="" points="263.2183599516844,363.98772003757904 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="13.14,10 13.45,16" data-type="line" data-label="" points="416.54006173667983,566.9135018118375 439.8389477922427,115.96732009126299" fill="none" stroke="hsl(23, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="11.1,15.5 14.86,10" data-type="line" data-label="" points="263.2183599516844,153.54616856797747 545.8113004965778,566.9135018118375" fill="none" stroke="hsl(50, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="8.9,14.5 8.600000000000001,14.5 8.600000000000001,14.9 8.9,14.9" data-type="line" data-label="" points="97.87142665414046,228.70386552140667 75.32411756811189,228.70386552140667 75.32411756811189,198.64078674003486 97.87142665414046,198.64078674003486" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="14.55,16 14.75,16 14.75,14 14.55,14" data-type="line" data-label="" points="522.5124144410149,115.96732009126299 537.5439538317005,115.96732009126299 537.5439538317005,266.28271399812115 522.5124144410149,266.28271399812115" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="8.9,14.7 8.8,14.7 8.8,15.1 8.9,15.1" data-type="line" data-label="" points="97.87142665414046,213.67232613072088 90.35565695879757,213.67232613072088 90.35565695879757,183.6092473493493 97.87142665414046,183.6092473493493" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="13.45,16 12.274999999999999,16 12.274999999999999,13.299999999999999 13.630999999999998,13.299999999999999 13.630999999999998,12.9 12.274999999999999,12.9 12.274999999999999,12.7 11.1,12.7" data-type="line" data-label="" points="439.8389477922427,115.96732009126299 351.52865387196346,115.96732009126299 351.52865387196346,318.89310186552154 453.4424909408133,318.89310186552154 453.4424909408133,348.95618064689313 351.52865387196346,348.95618064689313 351.52865387196346,363.98772003757904 263.2183599516844,363.98772003757904" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="14.75,16 15.010000000000002,16 15.010000000000002,15.999" data-type="line" data-label="" points="537.5439538317005,115.96732009126299 557.0849550395922,115.96732009126299 557.0849550395922,116.04247778821627" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="11.1,13.3 11.2,13.3 11.2,13.280000000000001 13.860999999999999,13.280000000000001 13.860999999999999,12.799000000000001" data-type="line" data-label="" points="263.2183599516844,318.89310186552143 270.7341296470273,318.89310186552143 270.7341296470273,320.39625580459006 470.72876124010213,320.39625580459006 470.72876124010213,356.5471080391894" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="8.600000000000001,14.5 8.34,14.5 8.34,14.501" data-type="line" data-label="" points="75.32411756811189,228.70386552140667 55.783116360220106,228.70386552140667 55.783116360220106,228.62870782445316" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="13.14,10 12.929,10 12.929,10.401" data-type="line" data-label="" points="416.54006173667983,566.9135018118375 400.6817876795062,566.9135018118375 400.6817876795062,536.7752653335124" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="schematic_component_0" data-x="10" data-y="14" x="97.87142665414046" y="138.51462917729174" width="165.34693329754396" height="255.53616964165883" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="schematic_component_1" data-x="14" data-y="14" x="439.83894779224266" y="219.68494188699515" width="82.6734666487722" height="93.19554422225201" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="schematic_component_2" data-x="14" data-y="10" x="416.5400617366798" y="537.6429346396459" width="129.27123875989798" height="58.54113434438318" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="schematic_component_3" data-x="14" data-y="16" x="439.83894779224266" y="69.36954798013699" width="82.6734666487722" height="93.19554422225201" fill="hsl(24, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="ATMEGA328P_AU" data-x="10.080000000000002" data-y="12.17" x="127.93450543551216" y="397.05710669708776" width="117.24600724734955" height="13.528385451617169" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="U_MCU" data-x="9.600000000000001" data-y="15.83" x="127.93450543551222" y="121.97993584753738" width="45.094618172057494" height="13.528385451617169" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="netId: GND
2
2
  globalConnNetId: connectivity_net1" data-x="15.010000000000002" data-y="15.759" x="541.301838679372" y="116.04247778821627" width="31.566232720440212" height="36.075694537646086" fill="#00000066" stroke="#000000" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="netId: GND
3
3
  globalConnNetId: connectivity_net1" data-x="13.860999999999999" data-y="12.559000000000001" x="454.945644879882" y="356.54710803918937" width="31.566232720440212" height="36.07569453764597" fill="#00000066" stroke="#000000" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="netId: VCC_3V3
4
4
  globalConnNetId: connectivity_net0" data-x="12.862499999999999" data-y="16.48" x="379.9006844718829" y="43.81593101597093" width="31.566232720440325" height="72.15138907529195" fill="#ef444466" stroke="#ef4444" stroke-width="0.013305357142857141"/></g><g><rect data-type="rect" data-label="netId: VCC_3V3
@@ -0,0 +1,70 @@
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="-11.342500000000001,-18.990000000000002 -9.797500000000001,-18.815" data-type="line" data-label="" points="428.00799467022,320.5969353764158 543.2911392405065,307.53897401732183" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-11.342500000000001,-18.990000000000002 -9.797500000000001,-20.625000000000004" data-type="line" data-label="" points="428.00799467022,320.5969353764158 543.2911392405065,442.5956029313793" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-9.797500000000001,-18.815 -9.797500000000001,-20.625000000000004" data-type="line" data-label="" points="543.2911392405065,307.53897401732183 543.2911392405065,442.5956029313793" fill="none" stroke="hsl(157, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-11.342500000000001,-18.04 -9.797500000000001,-18.215" data-type="line" data-label="" points="428.00799467022,249.7108594270485 543.2911392405065,262.76882078614244" fill="none" stroke="hsl(273, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-11.342500000000001,-18.240000000000002 -9.797500000000001,-20.025000000000002" data-type="line" data-label="" points="428.00799467022,264.6342438374418 543.2911392405065,397.8254497001999" fill="none" stroke="hsl(274, 100%, 50%, 0.8)" stroke-width="1px" stroke-dasharray="4 2"/></g><g><polyline data-points="-9.797500000000001,-18.815 -9.797500000000001,-18.990000000000002 -11.342500000000001,-18.990000000000002" data-type="line" data-label="" points="543.2911392405065,307.53897401732183 543.2911392405065,320.5969353764158 428.00799467022,320.5969353764158" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-9.797500000000001,-20.625000000000004 -9.797500000000001,-20.825000000000003 -10.322500000000002,-20.825000000000003 -10.322500000000002,-19.015 -9.797500000000001,-19.015 -9.797500000000001,-18.815" data-type="line" data-label="" points="543.2911392405065,442.5956029313793 543.2911392405065,457.51898734177234 504.1172551632246,457.51898734177234 504.1172551632246,322.4623584277149 543.2911392405065,322.4623584277149 543.2911392405065,307.53897401732183" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-11.342500000000001,-18.04 -9.797500000000001,-18.04 -9.797500000000001,-18.215" data-type="line" data-label="" points="428.00799467022,249.7108594270485 543.2911392405065,249.7108594270485 543.2911392405065,262.76882078614244" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-11.342500000000001,-17.29 -11.041500000000001,-17.29 -11.041500000000001,-17.139" data-type="line" data-label="" points="428.00799467022,193.74816788807448 450.46768820786156,193.74816788807448 450.46768820786156,182.48101265822766" fill="none" stroke="purple" stroke-width="1px"/></g><g><polyline data-points="-9.797500000000001,-20.025000000000002 -9.797500000000001,-19.925 -9.697500000000002,-19.925 -9.697500000000002,-18.874 -10.1485,-18.874" data-type="line" data-label="" points="543.2911392405065,397.8254497001999 543.2911392405065,390.36375749500326 550.752831445703,390.36375749500326 550.752831445703,311.9413724183876 517.1005996002667,311.9413724183876" fill="none" stroke="purple" stroke-width="1px"/></g><g><rect data-type="rect" data-label="schematic_component_16" data-x="-13.9425" data-y="-18.14" x="40.000000000000284" y="182.55562958027986" width="388.0079946702198" height="149.23384410393055" fill="hsl(320, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="schematic_component_17" data-x="-9.580000000000002" data-y="-18.515" x="519.0406395736176" y="262.76882078614244" width="80.95936042638255" height="44.77015323117939" fill="hsl(320, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="schematic_component_18" data-x="-9.580000000000002" data-y="-20.325000000000003" x="519.0406395736176" y="397.8254497001999" width="80.95936042638255" height="44.77015323117939" fill="hsl(320, 100%, 50%, 0.8)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="U3" data-x="-16.0225" data-y="-17.025000000000002" x="65.36975349766828" y="164.6475682878082" width="26.862091938707408" height="18.654230512991262" fill="rgba(160, 0, 220, 0.14)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="netId: VBUS
2
+ globalConnNetId: connectivity_net3" data-x="-11.041500000000001" data-y="-16.929" x="428.08261159227186" y="151.14190539640208" width="44.77015323117939" height="31.339107261825575" fill="#ef444466" stroke="#ef4444" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="netId: D_PLUS
3
+ globalConnNetId: connectivity_net2" data-x="-10.921500000000002" data-y="-17.490000000000002" x="428.08261159227186" y="201.20986009327112" width="62.67821452365092" height="14.923384410393282" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="netId: D_MINUS
4
+ globalConnNetId: connectivity_net1" data-x="-10.861500000000001" data-y="-17.69" x="428.08261159227186" y="216.13324450366417" width="71.6322451698868" height="14.923384410393282" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="netId: CC1
5
+ globalConnNetId: connectivity_net4" data-x="-9.557500000000001" data-y="-18.04" x="543.2911392405065" y="242.24916722185185" width="35.8161225849434" height="14.923384410393282" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="netId: CC2
6
+ globalConnNetId: connectivity_net5" data-x="-11.101500000000001" data-y="-18.240000000000002" x="428.0826115922719" y="257.17255163224513" width="35.8161225849434" height="14.923384410393282" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="netId: CC2
7
+ globalConnNetId: connectivity_net5" data-x="-10.3885" data-y="-18.874" x="481.28447701532326" y="304.47968021319093" width="35.8161225849434" height="14.923384410393282" fill="hsl(40, 100%, 50%, 0.35)" stroke="black" stroke-width="0.013401785714285713"/></g><g><rect data-type="rect" data-label="netId: GND
8
+ globalConnNetId: connectivity_net0" data-x="-9.797500000000001" data-y="-21.035000000000004" x="525.3830779480347" y="457.51898734177234" width="35.8161225849434" height="31.339107261825575" fill="#00000066" stroke="#000000" stroke-width="0.013401785714285713"/></g><g><circle data-type="point" data-label="schematic_port_83
9
+ x+" data-x="-11.342500000000001" data-y="-17.29" cx="428.00799467022" cy="193.74816788807448" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_84
10
+ x+" data-x="-11.342500000000001" data-y="-17.490000000000002" cx="428.00799467022" cy="208.67155229846776" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_85
11
+ x+" data-x="-11.342500000000001" data-y="-17.69" cx="428.00799467022" cy="223.5949367088608" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_86
12
+ x+" data-x="-11.342500000000001" data-y="-18.04" cx="428.00799467022" cy="249.7108594270485" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_87
13
+ x+" data-x="-11.342500000000001" data-y="-18.240000000000002" cx="428.00799467022" cy="264.6342438374418" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_88
14
+ x+" data-x="-11.342500000000001" data-y="-18.59" cx="428.00799467022" cy="290.75016655562945" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_89
15
+ x+" data-x="-11.342500000000001" data-y="-18.79" cx="428.00799467022" cy="305.6735509660225" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_90
16
+ x+" data-x="-11.342500000000001" data-y="-18.990000000000002" cx="428.00799467022" cy="320.5969353764158" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_91
17
+ y+" data-x="-9.797500000000001" data-y="-18.215" cx="543.2911392405065" cy="262.76882078614244" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_92
18
+ y-" data-x="-9.797500000000001" data-y="-18.815" cx="543.2911392405065" cy="307.53897401732183" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_93
19
+ y+" data-x="-9.797500000000001" data-y="-20.025000000000002" cx="543.2911392405065" cy="397.8254497001999" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="schematic_port_94
20
+ y-" data-x="-9.797500000000001" data-y="-20.625000000000004" cx="543.2911392405065" cy="442.5956029313793" r="3" fill="hsl(184, 100%, 50%, 0.8)"/></g><g><circle data-type="point" data-label="anchorPoint
21
+ orientation: y+" data-x="-11.041500000000001" data-y="-17.139" cx="450.46768820786156" cy="182.48101265822766" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
22
+ orientation: x+" data-x="-11.342500000000001" data-y="-17.490000000000002" cx="428.00799467022" cy="208.67155229846776" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
23
+ orientation: x+" data-x="-11.342500000000001" data-y="-17.69" cx="428.00799467022" cy="223.5949367088608" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
24
+ orientation: x+" data-x="-9.797500000000001" data-y="-18.04" cx="543.2911392405065" cy="249.7108594270485" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
25
+ orientation: x+" data-x="-11.342500000000001" data-y="-18.240000000000002" cx="428.00799467022" cy="264.6342438374418" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
26
+ orientation: x-" data-x="-10.1485" data-y="-18.874" cx="517.1005996002667" cy="311.9413724183876" r="3" fill="hsl(40, 100%, 50%, 0.9)"/></g><g><circle data-type="point" data-label="anchorPoint
27
+ orientation: y-" data-x="-9.797500000000001" data-y="-20.825000000000003" cx="543.2911392405065" cy="457.51898734177234" 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[
28
+ document.currentScript.parentElement.addEventListener('mousemove', (e) => {
29
+ const svg = e.currentTarget;
30
+ const rect = svg.getBoundingClientRect();
31
+ const x = e.clientX - rect.left;
32
+ const y = e.clientY - rect.top;
33
+ const crosshair = svg.getElementById('crosshair');
34
+ const h = svg.getElementById('crosshair-h');
35
+ const v = svg.getElementById('crosshair-v');
36
+ const coords = svg.getElementById('coordinates');
37
+
38
+ crosshair.style.display = 'block';
39
+ h.setAttribute('x1', '0');
40
+ h.setAttribute('x2', '640');
41
+ h.setAttribute('y1', y);
42
+ h.setAttribute('y2', y);
43
+ v.setAttribute('x1', x);
44
+ v.setAttribute('x2', x);
45
+ v.setAttribute('y1', '0');
46
+ v.setAttribute('y2', '640');
47
+
48
+ // Calculate real coordinates using inverse transformation
49
+ const matrix = {"a":74.61692205196536,"c":0,"e":1274.3504330446372,"b":0,"d":-74.61692205196536,"f":-1096.3784143904065};
50
+ // Manually invert and apply the affine transform
51
+ // Since we only use translate and scale, we can directly compute:
52
+ // x' = (x - tx) / sx
53
+ // y' = (y - ty) / sy
54
+ const sx = matrix.a;
55
+ const sy = matrix.d;
56
+ const tx = matrix.e;
57
+ const ty = matrix.f;
58
+ const realPoint = {
59
+ x: (x - tx) / sx,
60
+ y: (y - ty) / sy // Flip y back since we used negative scale
61
+ }
62
+
63
+ coords.textContent = `(${realPoint.x.toFixed(2)}, ${realPoint.y.toFixed(2)})`;
64
+ coords.setAttribute('x', (x + 5).toString());
65
+ coords.setAttribute('y', (y - 5).toString());
66
+ });
67
+ document.currentScript.parentElement.addEventListener('mouseleave', () => {
68
+ document.currentScript.parentElement.getElementById('crosshair').style.display = 'none';
69
+ });
70
+ ]]></script></svg>
@@ -0,0 +1,164 @@
1
+ {
2
+ "chips": [
3
+ {
4
+ "chipId": "schematic_component_16",
5
+ "center": {
6
+ "x": -13.9425,
7
+ "y": -18.14
8
+ },
9
+ "width": 5.199999999999999,
10
+ "height": 2,
11
+ "pins": [
12
+ {
13
+ "pinId": "schematic_port_83",
14
+ "x": -11.342500000000001,
15
+ "y": -17.29
16
+ },
17
+ {
18
+ "pinId": "schematic_port_84",
19
+ "x": -11.342500000000001,
20
+ "y": -17.490000000000002
21
+ },
22
+ {
23
+ "pinId": "schematic_port_85",
24
+ "x": -11.342500000000001,
25
+ "y": -17.69
26
+ },
27
+ {
28
+ "pinId": "schematic_port_86",
29
+ "x": -11.342500000000001,
30
+ "y": -18.04
31
+ },
32
+ {
33
+ "pinId": "schematic_port_87",
34
+ "x": -11.342500000000001,
35
+ "y": -18.240000000000002
36
+ },
37
+ {
38
+ "pinId": "schematic_port_88",
39
+ "x": -11.342500000000001,
40
+ "y": -18.59
41
+ },
42
+ {
43
+ "pinId": "schematic_port_89",
44
+ "x": -11.342500000000001,
45
+ "y": -18.79
46
+ },
47
+ {
48
+ "pinId": "schematic_port_90",
49
+ "x": -11.342500000000001,
50
+ "y": -18.990000000000002
51
+ }
52
+ ],
53
+ "sectionId": "usb"
54
+ },
55
+ {
56
+ "chipId": "schematic_component_17",
57
+ "center": {
58
+ "x": -9.580000000000002,
59
+ "y": -18.515
60
+ },
61
+ "width": 1.084999999999999,
62
+ "height": 0.6000000000000014,
63
+ "pins": [
64
+ {
65
+ "pinId": "schematic_port_91",
66
+ "x": -9.797500000000001,
67
+ "y": -18.215,
68
+ "_facingDirection": "y+"
69
+ },
70
+ {
71
+ "pinId": "schematic_port_92",
72
+ "x": -9.797500000000001,
73
+ "y": -18.815,
74
+ "_facingDirection": "y-"
75
+ }
76
+ ],
77
+ "sectionId": "usb"
78
+ },
79
+ {
80
+ "chipId": "schematic_component_18",
81
+ "center": {
82
+ "x": -9.580000000000002,
83
+ "y": -20.325000000000003
84
+ },
85
+ "width": 1.084999999999999,
86
+ "height": 0.6000000000000014,
87
+ "pins": [
88
+ {
89
+ "pinId": "schematic_port_93",
90
+ "x": -9.797500000000001,
91
+ "y": -20.025000000000002,
92
+ "_facingDirection": "y+"
93
+ },
94
+ {
95
+ "pinId": "schematic_port_94",
96
+ "x": -9.797500000000001,
97
+ "y": -20.625000000000004,
98
+ "_facingDirection": "y-"
99
+ }
100
+ ],
101
+ "sectionId": "usb"
102
+ }
103
+ ],
104
+ "directConnections": [],
105
+ "netConnections": [
106
+ {
107
+ "netId": "GND",
108
+ "netLabelWidth": 0.42,
109
+ "netLabelHeight": 0.48,
110
+ "pinIds": [
111
+ "schematic_port_90",
112
+ "schematic_port_92",
113
+ "schematic_port_94"
114
+ ]
115
+ },
116
+ {
117
+ "netId": "D_MINUS",
118
+ "netLabelWidth": 0.96,
119
+ "pinIds": ["schematic_port_85"]
120
+ },
121
+ {
122
+ "netId": "D_PLUS",
123
+ "netLabelWidth": 0.84,
124
+ "pinIds": ["schematic_port_84"]
125
+ },
126
+ {
127
+ "netId": "VBUS",
128
+ "netLabelWidth": 0.42,
129
+ "netLabelHeight": 0.6,
130
+ "pinIds": ["schematic_port_83"]
131
+ },
132
+ {
133
+ "netId": "CC1",
134
+ "netLabelWidth": 0.48,
135
+ "pinIds": ["schematic_port_86", "schematic_port_91"]
136
+ },
137
+ {
138
+ "netId": "CC2",
139
+ "netLabelWidth": 0.48,
140
+ "pinIds": ["schematic_port_87", "schematic_port_93"]
141
+ }
142
+ ],
143
+ "textBoxes": [
144
+ {
145
+ "chipId": "schematic_component_16",
146
+ "center": {
147
+ "x": -16.0225,
148
+ "y": -17.025000000000002
149
+ },
150
+ "width": 0.35999999999999943,
151
+ "height": 0.25,
152
+ "text": "U3"
153
+ }
154
+ ],
155
+ "availableNetLabelOrientations": {
156
+ "D_MINUS": ["x-", "x+"],
157
+ "D_PLUS": ["x-", "x+"],
158
+ "GND": ["y-"],
159
+ "VBUS": ["y+"],
160
+ "CC1": ["x-", "x+"],
161
+ "CC2": ["x-", "x+"]
162
+ },
163
+ "maxMspPairDistance": 2.4
164
+ }
@@ -0,0 +1,95 @@
1
+ import { expect, test } from "bun:test"
2
+ import { SchematicTracePipelineSolver } from "lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver"
3
+ import type { SolvedTracePath } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver"
4
+ import inputProblem from "./assets/repro-rp2040-usb-cc2-ground-overlap.input.json"
5
+
6
+ const EPS = 1e-6
7
+
8
+ const pathsHavePositiveLengthCollinearOverlap = (
9
+ first: SolvedTracePath,
10
+ second: SolvedTracePath,
11
+ ) => {
12
+ for (
13
+ let firstIndex = 0;
14
+ firstIndex < first.tracePath.length - 1;
15
+ firstIndex++
16
+ ) {
17
+ const firstStart = first.tracePath[firstIndex]!
18
+ const firstEnd = first.tracePath[firstIndex + 1]!
19
+ const firstIsVertical = Math.abs(firstStart.x - firstEnd.x) < EPS
20
+ const firstIsHorizontal = Math.abs(firstStart.y - firstEnd.y) < EPS
21
+
22
+ for (
23
+ let secondIndex = 0;
24
+ secondIndex < second.tracePath.length - 1;
25
+ secondIndex++
26
+ ) {
27
+ const secondStart = second.tracePath[secondIndex]!
28
+ const secondEnd = second.tracePath[secondIndex + 1]!
29
+ const secondIsVertical = Math.abs(secondStart.x - secondEnd.x) < EPS
30
+ const secondIsHorizontal = Math.abs(secondStart.y - secondEnd.y) < EPS
31
+
32
+ if (
33
+ firstIsVertical &&
34
+ secondIsVertical &&
35
+ Math.abs(firstStart.x - secondStart.x) < EPS
36
+ ) {
37
+ const overlapLength =
38
+ Math.min(
39
+ Math.max(firstStart.y, firstEnd.y),
40
+ Math.max(secondStart.y, secondEnd.y),
41
+ ) -
42
+ Math.max(
43
+ Math.min(firstStart.y, firstEnd.y),
44
+ Math.min(secondStart.y, secondEnd.y),
45
+ )
46
+ if (overlapLength > EPS) return true
47
+ }
48
+
49
+ if (
50
+ firstIsHorizontal &&
51
+ secondIsHorizontal &&
52
+ Math.abs(firstStart.y - secondStart.y) < EPS
53
+ ) {
54
+ const overlapLength =
55
+ Math.min(
56
+ Math.max(firstStart.x, firstEnd.x),
57
+ Math.max(secondStart.x, secondEnd.x),
58
+ ) -
59
+ Math.max(
60
+ Math.min(firstStart.x, firstEnd.x),
61
+ Math.min(secondStart.x, secondEnd.x),
62
+ )
63
+ if (overlapLength > EPS) return true
64
+ }
65
+ }
66
+ }
67
+
68
+ return false
69
+ }
70
+
71
+ test("avoids RP2040 USB-C CC2 label connector overlapping GND", () => {
72
+ const solver = new SchematicTracePipelineSolver(inputProblem as any)
73
+
74
+ solver.solve()
75
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
76
+
77
+ const traces = solver.netLabelTraceCollisionSolver!.getOutput().traces
78
+ const cc2LabelConnector = traces.find(
79
+ (trace) =>
80
+ trace.userNetId === "CC2" &&
81
+ trace.mspPairId.startsWith("available-net-orientation-"),
82
+ )
83
+
84
+ expect(cc2LabelConnector).toBeDefined()
85
+
86
+ const overlappingDifferentNetTraceIds = traces
87
+ .filter(
88
+ (trace) =>
89
+ trace.globalConnNetId !== cc2LabelConnector!.globalConnNetId &&
90
+ pathsHavePositiveLengthCollinearOverlap(trace, cc2LabelConnector!),
91
+ )
92
+ .map((trace) => trace.mspPairId)
93
+
94
+ expect(overlappingDifferentNetTraceIds).toEqual([])
95
+ })