@tscircuit/schematic-trace-solver 0.0.32 → 0.0.34

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 (42) hide show
  1. package/dist/index.d.ts +24 -53
  2. package/dist/index.js +526 -847
  3. package/lib/index.ts +1 -0
  4. package/lib/solvers/MspConnectionPairSolver/MspConnectionPairSolver.ts +54 -3
  5. package/lib/solvers/MspConnectionPairSolver/doesPairCrossRestrictedCenterLines.ts +62 -0
  6. package/lib/solvers/MspConnectionPairSolver/getMspConnectionPairsFromPins.ts +7 -2
  7. package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +25 -4
  8. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver.ts +3 -10
  9. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/SchematicTraceSingleLineSolver2.ts +239 -0
  10. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/collisions.ts +57 -0
  11. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/mid.ts +97 -0
  12. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/pathOps.ts +65 -0
  13. package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver2/rect.ts +19 -0
  14. package/lib/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver.ts +14 -14
  15. package/package.json +1 -1
  16. package/site/examples/example09.page.tsx +1 -1
  17. package/site/examples/example15-rp2040-caps.page.tsx +623 -0
  18. package/site/examples/example16-core-repro51.page.tsx +107 -0
  19. package/site/examples/example17-straight-line-trace.page.tsx +165 -0
  20. package/site/examples/example18.page.tsx +181 -0
  21. package/site/examples/example19.page.tsx +169 -0
  22. package/tests/examples/__snapshots__/example01.snap.svg +29 -29
  23. package/tests/examples/__snapshots__/example02.snap.svg +13 -10
  24. package/tests/examples/__snapshots__/example04.snap.svg +12 -12
  25. package/tests/examples/__snapshots__/example05.snap.svg +38 -38
  26. package/tests/examples/__snapshots__/example06.snap.svg +14 -14
  27. package/tests/examples/__snapshots__/example08.snap.svg +29 -23
  28. package/tests/examples/__snapshots__/example09.snap.svg +119 -149
  29. package/tests/examples/__snapshots__/example11.snap.svg +39 -33
  30. package/tests/examples/__snapshots__/example12.snap.svg +32 -29
  31. package/tests/examples/__snapshots__/example13.snap.svg +87 -84
  32. package/tests/examples/__snapshots__/example15.snap.svg +800 -71
  33. package/tests/examples/__snapshots__/example16.snap.svg +40 -86
  34. package/tests/examples/__snapshots__/example17.snap.svg +190 -0
  35. package/tests/examples/__snapshots__/example18.snap.svg +235 -0
  36. package/tests/examples/__snapshots__/example19.snap.svg +195 -0
  37. package/tests/examples/example15.test.tsx +524 -82
  38. package/tests/examples/example16.test.tsx +56 -118
  39. package/tests/examples/example17.test.tsx +171 -0
  40. package/tests/examples/example18.test.tsx +187 -0
  41. package/tests/examples/example19.test.tsx +175 -0
  42. package/tests/solvers/SchematicTracePipelineSolver/SchematicTracePipelineSolver_repro03.test.ts +1 -0
@@ -0,0 +1,175 @@
1
+ import { expect } from "bun:test"
2
+ import { test } from "bun:test"
3
+ import { SchematicTracePipelineSolver, type InputProblem } from "lib/index"
4
+ import "tests/fixtures/matcher"
5
+
6
+ const inputProblem = {
7
+ chips: [
8
+ {
9
+ chipId: "schematic_component_0",
10
+ center: {
11
+ x: 0,
12
+ y: 0,
13
+ },
14
+ width: 0.4,
15
+ height: 0.8,
16
+ pins: [
17
+ {
18
+ pinId: "U1.6",
19
+ x: 0.6000000000000001,
20
+ y: -0.2,
21
+ },
22
+ {
23
+ pinId: "U1.8",
24
+ x: 0.6000000000000001,
25
+ y: 0,
26
+ },
27
+ {
28
+ pinId: "U1.1",
29
+ x: 0.6000000000000001,
30
+ y: 0.2,
31
+ },
32
+ ],
33
+ },
34
+ {
35
+ chipId: "schematic_component_1",
36
+ center: {
37
+ x: 1.4,
38
+ y: 0.55,
39
+ },
40
+ width: 0.5291665999999999,
41
+ height: 1.0583333000000001,
42
+ pins: [
43
+ {
44
+ pinId: "C2.1",
45
+ x: 1.4002733499999995,
46
+ y: -0.0012093000000001908,
47
+ },
48
+ {
49
+ pinId: "C2.2",
50
+ x: 1.3997266500000003,
51
+ y: 1.1012093000000003,
52
+ },
53
+ ],
54
+ },
55
+ {
56
+ chipId: "schematic_component_2",
57
+ center: {
58
+ x: 2.7,
59
+ y: 1.3,
60
+ },
61
+ width: 1.0583332999999997,
62
+ height: 0.388910699999999,
63
+ pins: [
64
+ {
65
+ pinId: "R1.1",
66
+ x: 2.1487093,
67
+ y: 1.3002732499999994,
68
+ },
69
+ {
70
+ pinId: "R1.2",
71
+ x: 3.2512907000000006,
72
+ y: 1.2997267500000007,
73
+ },
74
+ ],
75
+ },
76
+ {
77
+ chipId: "schematic_component_3",
78
+ center: {
79
+ x: 4.4,
80
+ y: 0,
81
+ },
82
+ width: 0.4,
83
+ height: 0.4,
84
+ pins: [
85
+ {
86
+ pinId: "JP5.1",
87
+ x: 3.8000000000000003,
88
+ y: 0,
89
+ },
90
+ ],
91
+ },
92
+ {
93
+ chipId: "schematic_component_4",
94
+ center: {
95
+ x: 4.4,
96
+ y: -0.9,
97
+ },
98
+ width: 0.4,
99
+ height: 0.4,
100
+ pins: [
101
+ {
102
+ pinId: "JP9.1",
103
+ x: 3.8000000000000003,
104
+ y: -0.9,
105
+ },
106
+ ],
107
+ },
108
+ {
109
+ chipId: "schematic_component_5",
110
+ center: {
111
+ x: 2,
112
+ y: -1.1,
113
+ },
114
+ width: 0.8843008999999997,
115
+ height: 0.5299361999999987,
116
+ pins: [
117
+ {
118
+ pinId: "JP8.1",
119
+ x: 2.4458007999999998,
120
+ y: -1.2015872704999997,
121
+ },
122
+ {
123
+ pinId: "JP8.2",
124
+ x: 2.0034928,
125
+ y: -0.8474009705000005,
126
+ },
127
+ {
128
+ pinId: "JP8.3",
129
+ x: 1.5541992,
130
+ y: -1.2014628704999997,
131
+ },
132
+ ],
133
+ },
134
+ ],
135
+ directConnections: [
136
+ {
137
+ pinIds: ["C2.1", "U1.8"],
138
+ netId: "capacitor.C2 > port.pin1 to .U1 > .pin8",
139
+ },
140
+ {
141
+ pinIds: ["C2.2", "R1.1"],
142
+ netId: "capacitor.C2 > port.pin2 to .R1 > .pin1",
143
+ },
144
+ {
145
+ pinIds: ["R1.1", "U1.1"],
146
+ netId: "resistor.R1 > port.pin1 to .U1 > .pin1",
147
+ },
148
+ {
149
+ pinIds: ["JP5.1", "R1.2"],
150
+ netId: "pinheader.JP5 > port.pin1 to .R1 > .pin2",
151
+ },
152
+ {
153
+ pinIds: ["JP9.1", "R1.2"],
154
+ netId: "pinheader.JP9 > port.pin1 to .R1 > .pin2",
155
+ },
156
+ {
157
+ pinIds: ["JP8.2", "U1.6"],
158
+ netId: "solderjumper.JP8 > port.pin2 to .U1 > .pin6",
159
+ },
160
+ ],
161
+ netConnections: [
162
+ {
163
+ netId: "PAD",
164
+ pinIds: ["R1.2", "JP5.1", "JP9.1"],
165
+ },
166
+ ],
167
+ availableNetLabelOrientations: {},
168
+ maxMspPairDistance: 5,
169
+ } as InputProblem
170
+
171
+ test("example19", () => {
172
+ const solver = new SchematicTracePipelineSolver(inputProblem)
173
+ solver.solve()
174
+ expect(solver).toMatchSolverSnapshot(import.meta.path)
175
+ })
@@ -487,4 +487,5 @@ const inputProblem: InputProblem = {
487
487
  test("SchematicTracePipelineSolver_repro03 - infinite loop fixed", () => {
488
488
  const solver = new SchematicTracePipelineSolver(inputProblem)
489
489
  solver.solve()
490
+ expect(solver.solved).toBe(true)
490
491
  })