@tscircuit/rectdiff 0.0.42 → 0.0.44
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/package.json +1 -1
- package/pages/features/out-of-bound-should-not-expand/arduino-uno-inner2-ground-bottom-power-out-of-bounds.page.tsx +10 -0
- package/pages/features/out-of-bound-should-not-expand/simplified-out-of-bounds-example.page.tsx +10 -0
- package/test-assets/arduino-uno-inner2-ground-bottom-power-out-of-bounds.json +9687 -0
- package/test-assets/simplified-out-of-bounds-example.json +24 -0
- package/tests/simplified-out-of-bounds-example.test.ts +33 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bounds": {
|
|
3
|
+
"minX": -5.5,
|
|
4
|
+
"maxX": 5.5,
|
|
5
|
+
"minY": -6,
|
|
6
|
+
"maxY": 6
|
|
7
|
+
},
|
|
8
|
+
"obstacles": [
|
|
9
|
+
{
|
|
10
|
+
"type": "rect",
|
|
11
|
+
"layers": ["top"],
|
|
12
|
+
"center": {
|
|
13
|
+
"x": -5.856893060790263,
|
|
14
|
+
"y": -8.275436101920713
|
|
15
|
+
},
|
|
16
|
+
"width": 2,
|
|
17
|
+
"height": 2,
|
|
18
|
+
"connectedTo": []
|
|
19
|
+
}
|
|
20
|
+
],
|
|
21
|
+
"connections": [],
|
|
22
|
+
"layerCount": 2,
|
|
23
|
+
"minTraceWidth": 0.15
|
|
24
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import simpleRouteJson from "../test-assets/simplified-out-of-bounds-example.json"
|
|
3
|
+
import { RectDiffPipeline } from "../lib/RectDiffPipeline"
|
|
4
|
+
|
|
5
|
+
test("simplified out-of-bounds fixture currently creates a generated node outside the board bounds", () => {
|
|
6
|
+
const solver = new RectDiffPipeline({ simpleRouteJson })
|
|
7
|
+
|
|
8
|
+
solver.solve()
|
|
9
|
+
|
|
10
|
+
const { meshNodes } = solver.getOutput()
|
|
11
|
+
const outsideGeneratedNodes = meshNodes.filter((node) => {
|
|
12
|
+
if (!node.capacityMeshNodeId.startsWith("new-")) return false
|
|
13
|
+
|
|
14
|
+
const minX = node.center.x - node.width / 2
|
|
15
|
+
const maxX = node.center.x + node.width / 2
|
|
16
|
+
const minY = node.center.y - node.height / 2
|
|
17
|
+
const maxY = node.center.y + node.height / 2
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
minX < simpleRouteJson.bounds.minX ||
|
|
21
|
+
maxX > simpleRouteJson.bounds.maxX ||
|
|
22
|
+
minY < simpleRouteJson.bounds.minY ||
|
|
23
|
+
maxY > simpleRouteJson.bounds.maxY
|
|
24
|
+
)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
expect(solver.solved).toBe(true)
|
|
28
|
+
expect(meshNodes.length).toBeGreaterThan(0)
|
|
29
|
+
expect(outsideGeneratedNodes.length).toBeGreaterThan(0)
|
|
30
|
+
expect(outsideGeneratedNodes[0]!.capacityMeshNodeId.startsWith("new-")).toBe(
|
|
31
|
+
true,
|
|
32
|
+
)
|
|
33
|
+
})
|