@tscircuit/rectdiff 0.0.30 → 0.0.31
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 +381 -0
- package/dist/index.js +2764 -0
- package/lib/fixtures/twoNodeExpansionFixture.ts +1 -1
- package/lib/solvers/GapFillSolver/ExpandEdgesToEmptySpaceSolver.ts +2 -4
- package/lib/solvers/GapFillSolver/FindSegmentsWithAdjacentEmptySpaceSolver.ts +1 -3
- package/lib/solvers/GapFillSolver/GapFillSolverPipeline.ts +2 -6
- package/lib/solvers/RectDiffExpansionSolver/RectDiffExpansionSolver.ts +2 -5
- package/lib/solvers/RectDiffGridSolverPipeline/RectDiffGridSolverPipeline.ts +5 -8
- 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/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/package.json +7 -12
|
@@ -2,7 +2,7 @@ import RBush from "rbush"
|
|
|
2
2
|
import type { RectDiffExpansionSolverInput } from "../solvers/RectDiffExpansionSolver/RectDiffExpansionSolver"
|
|
3
3
|
import type { SimpleRouteJson } from "../types/srj-types"
|
|
4
4
|
import type { XYRect } from "../rectdiff-types"
|
|
5
|
-
import type { RTreeRect } from "
|
|
5
|
+
import type { RTreeRect } from "lib/types/capacity-mesh-types"
|
|
6
6
|
import { buildZIndexMap } from "../solvers/RectDiffSeedingSolver/layers"
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseSolver } from "@tscircuit/solver-utils"
|
|
2
|
-
import type { CapacityMeshNode } from "
|
|
2
|
+
import type { CapacityMeshNode } from "lib/types/capacity-mesh-types"
|
|
3
3
|
import type { SegmentWithAdjacentEmptySpace } from "./FindSegmentsWithAdjacentEmptySpaceSolver"
|
|
4
4
|
import type { GraphicsObject } from "graphics-debug"
|
|
5
5
|
import RBush from "rbush"
|
|
@@ -7,7 +7,7 @@ import { EDGE_MAP, EDGES } from "./edge-constants"
|
|
|
7
7
|
import { getBoundsFromCorners } from "./getBoundsFromCorners"
|
|
8
8
|
import type { Bounds } from "@tscircuit/math-utils"
|
|
9
9
|
import { midpoint, segmentToBoxMinDistance } from "@tscircuit/math-utils"
|
|
10
|
-
import type { XYRect } from "
|
|
10
|
+
import type { XYRect } from "lib/rectdiff-types"
|
|
11
11
|
|
|
12
12
|
const EPS = 1e-4
|
|
13
13
|
|
|
@@ -212,8 +212,6 @@ export class ExpandEdgesToEmptySpaceSolver extends BaseSolver {
|
|
|
212
212
|
rects: [],
|
|
213
213
|
points: [],
|
|
214
214
|
lines: [],
|
|
215
|
-
infiniteLines: [],
|
|
216
|
-
polygons: [],
|
|
217
215
|
circles: [],
|
|
218
216
|
arrows: [],
|
|
219
217
|
texts: [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BaseSolver } from "@tscircuit/solver-utils"
|
|
2
2
|
import Flatbush from "flatbush"
|
|
3
3
|
import type { GraphicsObject, NinePointAnchor } from "graphics-debug"
|
|
4
|
-
import type { CapacityMeshNode } from "
|
|
4
|
+
import type { CapacityMeshNode } from "lib/types/capacity-mesh-types"
|
|
5
5
|
import { projectToUncoveredSegments } from "./projectToUncoveredSegments"
|
|
6
6
|
import { EDGES } from "./edge-constants"
|
|
7
7
|
import { visuallyOffsetLine } from "./visuallyOffsetLine"
|
|
@@ -139,8 +139,6 @@ export class FindSegmentsWithAdjacentEmptySpaceSolver extends BaseSolver {
|
|
|
139
139
|
rects: [],
|
|
140
140
|
points: [],
|
|
141
141
|
lines: [],
|
|
142
|
-
infiniteLines: [],
|
|
143
|
-
polygons: [],
|
|
144
142
|
circles: [],
|
|
145
143
|
arrows: [],
|
|
146
144
|
texts: [],
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
definePipelineStep,
|
|
4
4
|
type PipelineStep,
|
|
5
5
|
} from "@tscircuit/solver-utils"
|
|
6
|
-
import type { CapacityMeshNode } from "
|
|
6
|
+
import type { CapacityMeshNode } from "lib/types/capacity-mesh-types"
|
|
7
7
|
import type { GraphicsObject } from "graphics-debug"
|
|
8
8
|
import { FindSegmentsWithAdjacentEmptySpaceSolver } from "./FindSegmentsWithAdjacentEmptySpaceSolver"
|
|
9
9
|
import { ExpandEdgesToEmptySpaceSolver } from "./ExpandEdgesToEmptySpaceSolver"
|
|
10
|
-
import type { XYRect } from "
|
|
10
|
+
import type { XYRect } from "lib/rectdiff-types"
|
|
11
11
|
|
|
12
12
|
type GapFillSolverInput = {
|
|
13
13
|
meshNodes: CapacityMeshNode[]
|
|
@@ -73,8 +73,6 @@ export class GapFillSolverPipeline extends BasePipelineSolver<GapFillSolverInput
|
|
|
73
73
|
rects: [],
|
|
74
74
|
points: [],
|
|
75
75
|
lines: [],
|
|
76
|
-
infiniteLines: [],
|
|
77
|
-
polygons: [],
|
|
78
76
|
circles: [],
|
|
79
77
|
arrows: [],
|
|
80
78
|
texts: [],
|
|
@@ -105,8 +103,6 @@ export class GapFillSolverPipeline extends BasePipelineSolver<GapFillSolverInput
|
|
|
105
103
|
rects: [],
|
|
106
104
|
points: [],
|
|
107
105
|
lines: [],
|
|
108
|
-
infiniteLines: [],
|
|
109
|
-
polygons: [],
|
|
110
106
|
circles: [],
|
|
111
107
|
arrows: [],
|
|
112
108
|
texts: [],
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
import { BaseSolver } from "@tscircuit/solver-utils"
|
|
2
2
|
import type { GraphicsObject } from "graphics-debug"
|
|
3
|
-
import type {
|
|
4
|
-
CapacityMeshNode,
|
|
5
|
-
RTreeRect,
|
|
6
|
-
} from "../../types/capacity-mesh-types"
|
|
3
|
+
import type { CapacityMeshNode, RTreeRect } from "lib/types/capacity-mesh-types"
|
|
7
4
|
import { expandRectFromSeed } from "../../utils/expandRectFromSeed"
|
|
8
5
|
import { finalizeRects } from "../../utils/finalizeRects"
|
|
9
6
|
import { resizeSoftOverlaps } from "../../utils/resizeSoftOverlaps"
|
|
10
7
|
import { rectsToMeshNodes } from "./rectsToMeshNodes"
|
|
11
8
|
import type { XYRect, Candidate3D, Placed3D } from "../../rectdiff-types"
|
|
12
|
-
import type { Obstacle } from "
|
|
9
|
+
import type { Obstacle } from "lib/types/srj-types"
|
|
13
10
|
import RBush from "rbush"
|
|
14
11
|
import { rectToTree } from "../../utils/rectToTree"
|
|
15
12
|
import { sameTreeRect } from "../../utils/sameTreeRect"
|
|
@@ -7,14 +7,11 @@ import type {
|
|
|
7
7
|
Obstacle,
|
|
8
8
|
SimpleRouteConnection,
|
|
9
9
|
SimpleRouteJson,
|
|
10
|
-
} from "
|
|
11
|
-
import type { GridFill3DOptions, XYRect } from "
|
|
12
|
-
import type {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
} from "../../types/capacity-mesh-types"
|
|
16
|
-
import { RectDiffSeedingSolver } from "../RectDiffSeedingSolver/RectDiffSeedingSolver"
|
|
17
|
-
import { RectDiffExpansionSolver } from "../RectDiffExpansionSolver/RectDiffExpansionSolver"
|
|
10
|
+
} from "lib/types/srj-types"
|
|
11
|
+
import type { GridFill3DOptions, XYRect } from "lib/rectdiff-types"
|
|
12
|
+
import type { CapacityMeshNode, RTreeRect } from "lib/types/capacity-mesh-types"
|
|
13
|
+
import { RectDiffSeedingSolver } from "lib/solvers/RectDiffSeedingSolver/RectDiffSeedingSolver"
|
|
14
|
+
import { RectDiffExpansionSolver } from "lib/solvers/RectDiffExpansionSolver/RectDiffExpansionSolver"
|
|
18
15
|
import type { GraphicsObject } from "graphics-debug"
|
|
19
16
|
import RBush from "rbush"
|
|
20
17
|
import { buildObstacleIndexesByLayer } from "./buildObstacleIndexes"
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import type { SimpleRouteJson } from "
|
|
1
|
+
import type { SimpleRouteJson } from "lib/types/srj-types"
|
|
2
2
|
import RBush from "rbush"
|
|
3
|
-
import { computeInverseRects } from "
|
|
3
|
+
import { computeInverseRects } from "lib/solvers/RectDiffSeedingSolver/computeInverseRects"
|
|
4
4
|
import {
|
|
5
5
|
buildZIndexMap,
|
|
6
6
|
obstacleToXYRect,
|
|
7
7
|
obstacleZs,
|
|
8
|
-
} from "
|
|
9
|
-
import type { XYRect } from "
|
|
10
|
-
import type { RTreeRect } from "
|
|
11
|
-
import { padRect } from "
|
|
8
|
+
} from "lib/solvers/RectDiffSeedingSolver/layers"
|
|
9
|
+
import type { XYRect } from "lib/rectdiff-types"
|
|
10
|
+
import type { RTreeRect } from "lib/types/capacity-mesh-types"
|
|
11
|
+
import { padRect } from "lib/utils/padRect"
|
|
12
12
|
|
|
13
13
|
export const buildObstacleIndexesByLayer = (params: {
|
|
14
14
|
srj: SimpleRouteJson
|
|
@@ -16,12 +16,12 @@ import { computeCandidates3D } from "./computeCandidates3D"
|
|
|
16
16
|
import { computeEdgeCandidates3D } from "./computeEdgeCandidates3D"
|
|
17
17
|
import { longestFreeSpanAroundZ } from "./longestFreeSpanAroundZ"
|
|
18
18
|
import { allLayerNode } from "../../utils/buildHardPlacedByLayer"
|
|
19
|
-
import { isFullyOccupiedAtPoint } from "
|
|
19
|
+
import { isFullyOccupiedAtPoint } from "lib/utils/isFullyOccupiedAtPoint"
|
|
20
20
|
import { resizeSoftOverlaps } from "../../utils/resizeSoftOverlaps"
|
|
21
|
-
import { getColorForZLayer } from "
|
|
21
|
+
import { getColorForZLayer } from "lib/utils/getColorForZLayer"
|
|
22
22
|
import RBush from "rbush"
|
|
23
|
-
import type { RTreeRect } from "
|
|
24
|
-
import { rectToTree } from "
|
|
23
|
+
import type { RTreeRect } from "lib/types/capacity-mesh-types"
|
|
24
|
+
import { rectToTree } from "lib/utils/rectToTree"
|
|
25
25
|
|
|
26
26
|
export type RectDiffSeedingSolverInput = {
|
|
27
27
|
simpleRouteJson: SimpleRouteJson
|
|
@@ -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 "lib/types/capacity-mesh-types"
|
|
7
7
|
const quantize = (value: number, precision = 1e-6) =>
|
|
8
8
|
Math.round(value / precision) * precision
|
|
9
9
|
|
|
@@ -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 "lib/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 "lib/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"
|
|
@@ -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 "lib/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 "lib/rectdiff-types"
|
|
2
|
+
import type { RTreeRect } from "lib/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 "lib/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
package/package.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/rectdiff",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.31",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "./lib/index.ts",
|
|
7
|
-
"types": "./lib/index.ts",
|
|
8
|
-
"exports": {
|
|
9
|
-
".": "./lib/index.ts"
|
|
10
|
-
},
|
|
5
|
+
"main": "dist/index.js",
|
|
11
6
|
"scripts": {
|
|
12
7
|
"start": "cosmos",
|
|
13
8
|
"build": "tsup-node ./lib/index.ts --format esm --dts",
|
|
@@ -19,6 +14,8 @@
|
|
|
19
14
|
"devDependencies": {
|
|
20
15
|
"@biomejs/biome": "^2.3.5",
|
|
21
16
|
"@react-hook/resize-observer": "^2.0.2",
|
|
17
|
+
"@tscircuit/math-utils": "^0.0.29",
|
|
18
|
+
"@tscircuit/solver-utils": "^0.0.9",
|
|
22
19
|
"@types/bun": "latest",
|
|
23
20
|
"@types/rbush": "^4.0.0",
|
|
24
21
|
"@types/react": "^18",
|
|
@@ -27,6 +24,8 @@
|
|
|
27
24
|
"@vitejs/plugin-react": "^4",
|
|
28
25
|
"biome": "^0.3.3",
|
|
29
26
|
"bun-match-svg": "^0.0.14",
|
|
27
|
+
"graphics-debug": "^0.0.76",
|
|
28
|
+
"rbush": "^4.0.1",
|
|
30
29
|
"react": "18",
|
|
31
30
|
"react-cosmos": "^6.2.3",
|
|
32
31
|
"react-cosmos-plugin-vite": "^6.2.0",
|
|
@@ -40,10 +39,6 @@
|
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"D": "^1.0.0",
|
|
43
|
-
"flatbush": "^4.5.
|
|
44
|
-
"@tscircuit/math-utils": "^0.0.36",
|
|
45
|
-
"@tscircuit/solver-utils": "^0.0.19",
|
|
46
|
-
"graphics-debug": "^0.0.91",
|
|
47
|
-
"rbush": "^4.0.1"
|
|
42
|
+
"flatbush": "^4.5.0"
|
|
48
43
|
}
|
|
49
44
|
}
|