@tscircuit/schematic-trace-solver 0.0.7 → 0.0.9
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 +5 -5
- package/dist/index.js +488 -344
- package/lib/solvers/NetLabelPlacementSolver/NetLabelPlacementSolver.ts +29 -0
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver.ts +199 -465
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/SingleNetLabelPlacementSolver_visualize.ts +89 -0
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/anchors.ts +11 -0
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/collisions.ts +45 -0
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/geometry.ts +48 -0
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/host.ts +64 -0
- package/lib/solvers/NetLabelPlacementSolver/SingleNetLabelPlacementSolver/solvePortOnlyPin.ts +177 -0
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceLinesSolver.ts +24 -3
- package/lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver.ts +38 -3
- package/package.json +1 -1
- package/site/SchematicTraceLinesSolver/SchematicTraceLinesSolver01.page.tsx +122 -0
- package/site/components/GenericSolverDebugger.tsx +16 -0
- package/site/examples/example01-basic.page.tsx +2 -2
- package/site/examples/example04-single-symbol.page.tsx +46 -0
- package/tests/solvers/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver_repro01.json +88 -0
- package/tests/solvers/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver_repro01.test.ts +16 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { PipelineDebugger } from "../components/PipelineDebugger"
|
|
2
|
+
import type { InputProblem } from "lib/types/InputProblem"
|
|
3
|
+
|
|
4
|
+
const inputProblem: InputProblem = {
|
|
5
|
+
chips: [
|
|
6
|
+
{
|
|
7
|
+
chipId: "schematic_component_0",
|
|
8
|
+
center: {
|
|
9
|
+
x: 0,
|
|
10
|
+
y: 0,
|
|
11
|
+
},
|
|
12
|
+
width: 0.8935117710000002,
|
|
13
|
+
height: 1.1601665819999987,
|
|
14
|
+
pins: [
|
|
15
|
+
{
|
|
16
|
+
pinId: "Q1.1",
|
|
17
|
+
x: 0.30397715550000004,
|
|
18
|
+
y: 0.5519248499999994,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
pinId: "Q1.2",
|
|
22
|
+
x: 0.31067575550000137,
|
|
23
|
+
y: -0.5519248499999994,
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
pinId: "Q1.3",
|
|
27
|
+
x: -0.41859744450000014,
|
|
28
|
+
y: -0.10250625000000019,
|
|
29
|
+
},
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
],
|
|
33
|
+
directConnections: [],
|
|
34
|
+
netConnections: [
|
|
35
|
+
{
|
|
36
|
+
netId: "V3_3",
|
|
37
|
+
pinIds: ["Q1.1", "Q1.2"],
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
availableNetLabelOrientations: {
|
|
41
|
+
V3_3: ["y+"],
|
|
42
|
+
},
|
|
43
|
+
maxMspPairDistance: 2,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export default () => <PipelineDebugger inputProblem={inputProblem} />
|
package/tests/solvers/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver_repro01.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"chipMap": {
|
|
3
|
+
"schematic_component_0": {
|
|
4
|
+
"chipId": "schematic_component_0",
|
|
5
|
+
"center": {
|
|
6
|
+
"x": 0,
|
|
7
|
+
"y": 0
|
|
8
|
+
},
|
|
9
|
+
"width": 0.8935117710000002,
|
|
10
|
+
"height": 1.1601665819999987,
|
|
11
|
+
"pins": [
|
|
12
|
+
{
|
|
13
|
+
"pinId": "Q1.1",
|
|
14
|
+
"x": 0.30397715550000004,
|
|
15
|
+
"y": 0.5800832909999993
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"pinId": "Q1.2",
|
|
19
|
+
"x": 0.31067575550000137,
|
|
20
|
+
"y": -0.5800832909999993
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"pinId": "Q1.3",
|
|
24
|
+
"x": -0.4467558855000001,
|
|
25
|
+
"y": -0.10250625000000019
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"pins": [
|
|
31
|
+
{
|
|
32
|
+
"pinId": "Q1.1",
|
|
33
|
+
"x": 0.30397715550000004,
|
|
34
|
+
"y": 0.5800832909999993,
|
|
35
|
+
"_facingDirection": "y+",
|
|
36
|
+
"chipId": "schematic_component_0"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"pinId": "Q1.2",
|
|
40
|
+
"x": 0.31067575550000137,
|
|
41
|
+
"y": -0.5800832909999993,
|
|
42
|
+
"_facingDirection": "y-",
|
|
43
|
+
"chipId": "schematic_component_0"
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"guidelines": [],
|
|
47
|
+
"inputProblem": {
|
|
48
|
+
"chips": [
|
|
49
|
+
{
|
|
50
|
+
"chipId": "schematic_component_0",
|
|
51
|
+
"center": {
|
|
52
|
+
"x": 0,
|
|
53
|
+
"y": 0
|
|
54
|
+
},
|
|
55
|
+
"width": 0.8935117710000002,
|
|
56
|
+
"height": 1.1601665819999987,
|
|
57
|
+
"pins": [
|
|
58
|
+
{
|
|
59
|
+
"pinId": "Q1.1",
|
|
60
|
+
"x": 0.30397715550000004,
|
|
61
|
+
"y": 0.5800832909999993
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"pinId": "Q1.2",
|
|
65
|
+
"x": 0.31067575550000137,
|
|
66
|
+
"y": -0.5800832909999993
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"pinId": "Q1.3",
|
|
70
|
+
"x": -0.4467558855000001,
|
|
71
|
+
"y": -0.10250625000000019
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
],
|
|
76
|
+
"directConnections": [],
|
|
77
|
+
"netConnections": [
|
|
78
|
+
{
|
|
79
|
+
"netId": "V3_3",
|
|
80
|
+
"pinIds": ["Q1.1", "Q1.2"]
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
"availableNetLabelOrientations": {
|
|
84
|
+
"V3_3": ["y+"]
|
|
85
|
+
},
|
|
86
|
+
"maxMspPairDistance": 2
|
|
87
|
+
}
|
|
88
|
+
}
|
package/tests/solvers/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver_repro01.test.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { test, expect } from "bun:test"
|
|
2
|
+
import input from "./SchematicTraceSingleLineSolver_repro01.json"
|
|
3
|
+
import { SchematicTraceSingleLineSolver } from "lib/solvers/SchematicTraceLinesSolver/SchematicTraceSingleLineSolver/SchematicTraceSingleLineSolver"
|
|
4
|
+
|
|
5
|
+
test("SchematicTraceSingleLineSolver_repro01", () => {
|
|
6
|
+
const solver = new SchematicTraceSingleLineSolver(input as any)
|
|
7
|
+
solver.solve()
|
|
8
|
+
|
|
9
|
+
// The solver should fail because it cannot find a path around the chip
|
|
10
|
+
// without guidelines to help navigate around it
|
|
11
|
+
expect(solver.failed).toBe(true)
|
|
12
|
+
expect(solver.error).toBe(
|
|
13
|
+
"No more candidate elbows, everything had collisions",
|
|
14
|
+
)
|
|
15
|
+
expect(solver.solvedTracePath).toBe(null)
|
|
16
|
+
})
|