@tscircuit/rectdiff 0.0.33 → 0.0.35
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/components/SolverDebugger3d.tsx +64 -10
- package/lib/RectDiffPipeline.ts +23 -0
- package/lib/fixtures/twoNodeExpansionFixture.ts +1 -1
- package/lib/solvers/GapFillSolver/ExpandEdgesToEmptySpaceSolver.ts +2 -2
- package/lib/solvers/GapFillSolver/FindSegmentsWithAdjacentEmptySpaceSolver.ts +1 -1
- package/lib/solvers/GapFillSolver/GapFillSolverPipeline.ts +2 -2
- package/lib/solvers/OuterLayerContainmentMergeSolver/OuterLayerContainmentMergeSolver.ts +311 -0
- package/lib/solvers/RectDiffExpansionSolver/RectDiffExpansionSolver.ts +5 -2
- package/lib/solvers/RectDiffGridSolverPipeline/RectDiffGridSolverPipeline.ts +8 -5
- package/lib/solvers/RectDiffGridSolverPipeline/buildObstacleIndexes.ts +6 -6
- package/lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver.ts +4 -4
- package/lib/solvers/RectDiffSeedingSolver/computeCandidates3D.ts +1 -1
- package/lib/solvers/RectDiffSeedingSolver/computeEdgeCandidates3D.ts +1 -1
- package/lib/solvers/RectDiffSeedingSolver/longestFreeSpanAroundZ.ts +1 -1
- package/lib/types/capacity-mesh-types.ts +1 -1
- package/lib/types/srj-types.ts +1 -0
- package/lib/utils/expandRectFromSeed.ts +1 -1
- package/lib/utils/finalizeRects.ts +1 -1
- package/lib/utils/isFullyOccupiedAtPoint.ts +1 -1
- package/lib/utils/isSelfRect.ts +1 -1
- package/lib/utils/rectToTree.ts +2 -2
- package/lib/utils/renderObstacleClearance.ts +1 -1
- package/lib/utils/resizeSoftOverlaps.ts +1 -1
- package/lib/utils/sameTreeRect.ts +1 -1
- package/lib/utils/searchStrip.ts +1 -1
- package/lib/utils/z-filter.ts +43 -0
- package/package.json +6 -2
- package/tests/solver/arduino-uno-inner2-ground-bottom-power/__snapshots__/arduino-uno-inner2-ground-bottom-power.snap.svg +1 -1
- package/tests/solver/arduino-uno-inner2-ground-inner1-power/__snapshots__/arduino-uno-inner2-ground-inner1-power.snap.svg +3 -3
- package/tests/solver/bugreport08-e3ec95/__snapshots__/bugreport08-e3ec95.snap.svg +1 -1
- package/tests/solver/bugreport22-2a75ce/__snapshots__/bugreport22-2a75ce.snap.svg +1 -1
- package/tests/solver/bugreport24-05597c/__snapshots__/bugreport24-05597c.snap.svg +1 -1
- package/tests/solver/repros/merge-single-layer-node/__snapshots__/merge-single-layer-node.snap.svg +44 -0
- package/tests/z-filter.test.ts +33 -0
- package/dist/index.d.ts +0 -381
- package/dist/index.js +0 -2764
|
@@ -3,7 +3,7 @@ import { EPS, distancePointToRectEdges } from "../../utils/rectdiff-geometry"
|
|
|
3
3
|
import { isFullyOccupiedAtPoint } from "../../utils/isFullyOccupiedAtPoint"
|
|
4
4
|
import { longestFreeSpanAroundZ } from "./longestFreeSpanAroundZ"
|
|
5
5
|
import type RBush from "rbush"
|
|
6
|
-
import type { RTreeRect } from "
|
|
6
|
+
import type { RTreeRect } from "../../types/capacity-mesh-types"
|
|
7
7
|
const quantize = (value: number, precision = 1e-6) =>
|
|
8
8
|
Math.round(value / precision) * precision
|
|
9
9
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RTreeRect } from "
|
|
1
|
+
import type { RTreeRect } from "../../types/capacity-mesh-types"
|
|
2
2
|
import type { XYRect } from "../../rectdiff-types"
|
|
3
3
|
import { clamp, containsPoint } from "../../utils/rectdiff-geometry"
|
|
4
4
|
import type RBush from "rbush"
|
package/lib/types/srj-types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type RBush from "rbush"
|
|
2
2
|
import type { XYRect } from "../rectdiff-types"
|
|
3
3
|
import { EPS, gt, gte, lt, lte, overlaps } from "./rectdiff-geometry"
|
|
4
|
-
import type { RTreeRect } from "
|
|
4
|
+
import type { RTreeRect } from "../types/capacity-mesh-types"
|
|
5
5
|
import { isSelfRect } from "./isSelfRect"
|
|
6
6
|
import {
|
|
7
7
|
searchStripDown,
|
package/lib/utils/isSelfRect.ts
CHANGED
package/lib/utils/rectToTree.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { XYRect } from "
|
|
2
|
-
import type { RTreeRect } from "
|
|
1
|
+
import type { XYRect } from "../rectdiff-types"
|
|
2
|
+
import type { RTreeRect } from "../types/capacity-mesh-types"
|
|
3
3
|
|
|
4
4
|
export const rectToTree = (
|
|
5
5
|
rect: XYRect,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RTreeRect } from "
|
|
1
|
+
import type { RTreeRect } from "../types/capacity-mesh-types"
|
|
2
2
|
import type { Placed3D } from "../rectdiff-types"
|
|
3
3
|
import { overlaps, subtractRect2D, EPS } from "./rectdiff-geometry"
|
|
4
4
|
import type RBush from "rbush"
|
package/lib/utils/searchStrip.ts
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export function normalizeZValues(zValues: number[]): number[] {
|
|
2
|
+
return [...new Set(zValues)].sort((a, b) => a - b)
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function parseZFilterInput(input: string): number[] | null {
|
|
6
|
+
const zValues: number[] = []
|
|
7
|
+
let current = ""
|
|
8
|
+
|
|
9
|
+
for (const char of input) {
|
|
10
|
+
if (char >= "0" && char <= "9") {
|
|
11
|
+
current += char
|
|
12
|
+
continue
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (char === "," || char === " " || char === "\t" || char === "\n") {
|
|
16
|
+
if (char === ",") {
|
|
17
|
+
if (current === "") return null
|
|
18
|
+
zValues.push(Number(current))
|
|
19
|
+
current = ""
|
|
20
|
+
}
|
|
21
|
+
continue
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return null
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (current !== "") zValues.push(Number(current))
|
|
28
|
+
if (zValues.length === 0) return null
|
|
29
|
+
|
|
30
|
+
return normalizeZValues(zValues)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function matchesExactZFilter(
|
|
34
|
+
zValues: number[],
|
|
35
|
+
selectedZValues: number[] | null,
|
|
36
|
+
): boolean {
|
|
37
|
+
if (!selectedZValues) return true
|
|
38
|
+
|
|
39
|
+
const normalized = normalizeZValues(zValues)
|
|
40
|
+
if (normalized.length !== selectedZValues.length) return false
|
|
41
|
+
|
|
42
|
+
return normalized.every((z, index) => z === selectedZValues[index])
|
|
43
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/rectdiff",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.35",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "
|
|
5
|
+
"main": "lib/index.ts",
|
|
6
|
+
"types": "lib/index.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./lib/index.ts"
|
|
9
|
+
},
|
|
6
10
|
"scripts": {
|
|
7
11
|
"start": "cosmos",
|
|
8
12
|
"build": "tsup-node ./lib/index.ts --format esm --dts",
|