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