@tscircuit/rectdiff 0.0.28 → 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/.github/workflows/bun-pver-release.yml +24 -45
- package/lib/RectDiffPipeline.ts +0 -46
- 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/types/srj-types.ts +0 -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 -8
- package/pages/repro/merge-single-layer-node.page.tsx +17 -0
- package/tests/__snapshots__/board-outline.snap.svg +2 -2
- package/tests/solver/__snapshots__/rectDiffGridSolverPipeline.snap.svg +1 -1
- package/tests/solver/both-points-equivalent/__snapshots__/both-points-equivalent.snap.svg +1 -1
- package/tests/solver/bugreport01-be84eb/__snapshots__/bugreport01-be84eb.snap.svg +1 -1
- package/tests/solver/bugreport02-bc4361/__snapshots__/bugreport02-bc4361.snap.svg +1 -1
- package/tests/solver/bugreport03-fe4a17/__snapshots__/bugreport03-fe4a17.snap.svg +1 -1
- package/tests/solver/bugreport07-d3f3be/__snapshots__/bugreport07-d3f3be.snap.svg +1 -1
- package/tests/solver/bugreport08-e3ec95/__snapshots__/bugreport08-e3ec95.snap.svg +1 -1
- package/tests/solver/bugreport09-618e09/__snapshots__/bugreport09-618e09.snap.svg +1 -1
- package/tests/solver/bugreport10-71239a/__snapshots__/bugreport10-71239a.snap.svg +1 -1
- package/tests/solver/bugreport11-b2de3c/__snapshots__/bugreport11-b2de3c.snap.svg +1 -1
- package/tests/solver/bugreport12-35ce1c/__snapshots__/bugreport12-35ce1c.snap.svg +1 -1
- package/tests/solver/bugreport13-b9a758/__snapshots__/bugreport13-b9a758.snap.svg +1 -1
- package/tests/solver/bugreport16-d95f38/__snapshots__/bugreport16-d95f38.snap.svg +1 -1
- package/tests/solver/bugreport19/__snapshots__/bugreport19.snap.svg +1 -1
- package/tests/solver/bugreport20-obstacle-clipping/__snapshots__/bugreport20-obstacle-clipping.snap.svg +1 -1
- package/tests/solver/bugreport21-board-outline/__snapshots__/bugreport21-board-outline.snap.svg +2 -2
- package/tests/solver/bugreport22-2a75ce/__snapshots__/bugreport22-2a75ce.snap.svg +1 -1
- package/tests/solver/bugreport23-LGA15x4/__snapshots__/bugreport23-LGA15x4.snap.svg +1 -1
- package/tests/solver/bugreport24-05597c/__snapshots__/bugreport24-05597c.snap.svg +1 -1
- package/tests/solver/bugreport25-4b1d55/__snapshots__/bugreport25-4b1d55.snap.svg +1 -1
- package/tests/solver/bugreport36-bf8303/__snapshots__/bugreport36-bf8303.snap.svg +1 -1
- package/tests/solver/interaction/__snapshots__/interaction.snap.svg +1 -1
- package/tests/solver/multi-point/__snapshots__/multi-point.snap.svg +1 -1
- package/tests/solver/no-better-path/__snapshots__/no-better-path.snap.svg +1 -1
- package/tests/solver/repros/merge-single-layer-node/merge-single-layer-node.json +861 -0
- package/tests/solver/{bugreport50-multi-support-layer-merge/bugreport50-multi-support-layer-merge.test.ts → repros/merge-single-layer-node/merge-single-layer-node.test.ts} +7 -42
- package/tests/solver/transitivity/__snapshots__/transitivity.snap.svg +2 -2
- package/tsconfig.json +5 -1
- package/vite.config.ts +4 -0
- package/dist/index.d.ts +0 -427
- package/dist/index.js +0 -3319
- package/lib/solvers/AdjacentLayerContainmentMergeSolver/AdjacentLayerContainmentMergeSolver.ts +0 -456
- package/lib/solvers/OuterLayerContainmentMergeSolver/OuterLayerContainmentMergeSolver.ts +0 -314
- package/pages/bugreports/bugreport50-multi-support-layer-merge.page.tsx +0 -19
- package/pages/pour.page.tsx +0 -18
- package/test-assets/bugreport49-634662.json +0 -412
- package/tests/outer-layer-containment-merge-solver.test.ts +0 -73
- package/tests/solver/bugreport49-634662/__snapshots__/bugreport49-634662.snap.svg +0 -44
- package/tests/solver/bugreport49-634662/bugreport49-634662.test.ts +0 -130
- package/tests/solver/bugreport50-multi-support-layer-merge/__snapshots__/bugreport50-multi-support-layer-merge.snap.svg +0 -44
- package/tests/solver/bugreport50-multi-support-layer-merge/bugreport50-multi-support-layer-merge.json +0 -972
|
@@ -4,7 +4,6 @@ on:
|
|
|
4
4
|
push:
|
|
5
5
|
branches:
|
|
6
6
|
- main
|
|
7
|
-
- '!version-bumps/**'
|
|
8
7
|
workflow_dispatch:
|
|
9
8
|
|
|
10
9
|
env:
|
|
@@ -14,39 +13,35 @@ env:
|
|
|
14
13
|
jobs:
|
|
15
14
|
publish:
|
|
16
15
|
runs-on: ubuntu-latest
|
|
16
|
+
if: ${{ !(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'v')) }}
|
|
17
17
|
steps:
|
|
18
18
|
- uses: actions/checkout@v4
|
|
19
|
+
with:
|
|
20
|
+
token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
19
21
|
- name: Setup bun
|
|
20
22
|
uses: oven-sh/setup-bun@v2
|
|
21
23
|
with:
|
|
22
|
-
bun-version:
|
|
23
|
-
- uses: actions/setup-node@
|
|
24
|
+
bun-version: 1.3.1
|
|
25
|
+
- uses: actions/setup-node@v3
|
|
24
26
|
with:
|
|
25
27
|
node-version: 20
|
|
26
28
|
registry-url: https://registry.npmjs.org/
|
|
27
29
|
- run: npm install -g pver
|
|
28
|
-
- run: bun install
|
|
30
|
+
- run: bun install
|
|
29
31
|
- run: bun run build
|
|
30
32
|
- run: pver release --no-push-main
|
|
31
33
|
env:
|
|
32
34
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
33
35
|
GITHUB_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
34
36
|
|
|
35
|
-
- name: Get package version
|
|
36
|
-
id: package-version
|
|
37
|
-
run: |
|
|
38
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
39
|
-
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
|
40
|
-
|
|
41
|
-
|
|
42
37
|
- name: Create Pull Request
|
|
43
38
|
id: create-pr
|
|
44
|
-
uses: peter-evans/create-pull-request@
|
|
39
|
+
uses: peter-evans/create-pull-request@v5
|
|
45
40
|
with:
|
|
46
41
|
commit-message: "chore: bump version"
|
|
47
|
-
title: "chore: bump version
|
|
42
|
+
title: "chore: bump version"
|
|
48
43
|
body: "Automated package update"
|
|
49
|
-
branch: version
|
|
44
|
+
branch: bump-version-${{ github.run_number }}
|
|
50
45
|
base: main
|
|
51
46
|
token: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
52
47
|
committer: tscircuitbot <githubbot@tscircuit.com>
|
|
@@ -59,34 +54,18 @@ jobs:
|
|
|
59
54
|
env:
|
|
60
55
|
GH_TOKEN: ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}
|
|
61
56
|
|
|
62
|
-
- name: Trigger upstream repo updates
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- name: Notify release-tracker of version update
|
|
78
|
-
# Continue-on-error just in case the tracker is down
|
|
79
|
-
continue-on-error: true
|
|
80
|
-
run: |
|
|
81
|
-
VERSION=$(node -p "require('./package.json').version")
|
|
82
|
-
PACKAGE_JSON=$(cat package.json)
|
|
83
|
-
curl -X POST https://release-tracker.tscircuit.com/release_events/create \
|
|
84
|
-
-H "Content-Type: application/json" \
|
|
85
|
-
-d "{
|
|
86
|
-
\"event\": {
|
|
87
|
-
\"event_type\": \"versions_updated\",
|
|
88
|
-
\"repo\": \"tscircuit/circuit-json-to-kicad\",
|
|
89
|
-
\"version\": \"$VERSION\",
|
|
90
|
-
\"package_json\": $PACKAGE_JSON
|
|
91
|
-
}
|
|
92
|
-
}"
|
|
57
|
+
# - name: Trigger upstream repo updates
|
|
58
|
+
# if: env.UPSTREAM_REPOS && env.UPSTREAM_PACKAGES_TO_UPDATE
|
|
59
|
+
# run: |
|
|
60
|
+
# IFS=',' read -ra REPOS <<< "${{ env.UPSTREAM_REPOS }}"
|
|
61
|
+
# for repo in "${REPOS[@]}"; do
|
|
62
|
+
# if [[ -n "$repo" ]]; then
|
|
63
|
+
# echo "Triggering update for repo: $repo"
|
|
64
|
+
# curl -X POST \
|
|
65
|
+
# -H "Accept: application/vnd.github.v3+json" \
|
|
66
|
+
# -H "Authorization: token ${{ secrets.TSCIRCUIT_BOT_GITHUB_TOKEN }}" \
|
|
67
|
+
# -H "Content-Type: application/json" \
|
|
68
|
+
# "https://api.github.com/repos/tscircuit/$repo/actions/workflows/update-package.yml/dispatches" \
|
|
69
|
+
# -d "{\"ref\":\"main\",\"inputs\":{\"package_names\":\"${{ env.UPSTREAM_PACKAGES_TO_UPDATE }}\"}}"
|
|
70
|
+
# fi
|
|
71
|
+
# done
|
package/lib/RectDiffPipeline.ts
CHANGED
|
@@ -7,9 +7,7 @@ import type { SimpleRouteJson } from "./types/srj-types"
|
|
|
7
7
|
import type { GridFill3DOptions, XYRect } from "./rectdiff-types"
|
|
8
8
|
import type { CapacityMeshNode } from "./types/capacity-mesh-types"
|
|
9
9
|
import type { GraphicsObject } from "graphics-debug"
|
|
10
|
-
import { AdjacentLayerContainmentMergeSolver } from "./solvers/AdjacentLayerContainmentMergeSolver/AdjacentLayerContainmentMergeSolver"
|
|
11
10
|
import { GapFillSolverPipeline } from "./solvers/GapFillSolver/GapFillSolverPipeline"
|
|
12
|
-
import { OuterLayerContainmentMergeSolver } from "./solvers/OuterLayerContainmentMergeSolver/OuterLayerContainmentMergeSolver"
|
|
13
11
|
import { RectDiffGridSolverPipeline } from "./solvers/RectDiffGridSolverPipeline/RectDiffGridSolverPipeline"
|
|
14
12
|
import { createBaseVisualization } from "./rectdiff-visualization"
|
|
15
13
|
import { buildFinalRectDiffVisualization } from "./buildFinalRectDiffVisualization"
|
|
@@ -27,8 +25,6 @@ export interface RectDiffPipelineInput {
|
|
|
27
25
|
export class RectDiffPipeline extends BasePipelineSolver<RectDiffPipelineInput> {
|
|
28
26
|
rectDiffGridSolverPipeline?: RectDiffGridSolverPipeline
|
|
29
27
|
gapFillSolver?: GapFillSolverPipeline
|
|
30
|
-
outerLayerContainmentMergeSolver?: OuterLayerContainmentMergeSolver
|
|
31
|
-
adjacentLayerContainmentMergeSolver?: AdjacentLayerContainmentMergeSolver
|
|
32
28
|
boardVoidRects: XYRect[] | undefined
|
|
33
29
|
zIndexByName?: Map<string, number>
|
|
34
30
|
layerNames?: string[]
|
|
@@ -73,38 +69,6 @@ export class RectDiffPipeline extends BasePipelineSolver<RectDiffPipelineInput>
|
|
|
73
69
|
},
|
|
74
70
|
],
|
|
75
71
|
),
|
|
76
|
-
definePipelineStep(
|
|
77
|
-
"outerLayerContainmentMergeSolver",
|
|
78
|
-
OuterLayerContainmentMergeSolver,
|
|
79
|
-
(rectDiffPipeline: RectDiffPipeline) => [
|
|
80
|
-
{
|
|
81
|
-
meshNodes:
|
|
82
|
-
rectDiffPipeline.gapFillSolver?.getOutput().outputNodes ??
|
|
83
|
-
rectDiffPipeline.rectDiffGridSolverPipeline?.getOutput()
|
|
84
|
-
.meshNodes ??
|
|
85
|
-
[],
|
|
86
|
-
simpleRouteJson: rectDiffPipeline.inputProblem.simpleRouteJson,
|
|
87
|
-
zIndexByName: rectDiffPipeline.zIndexByName ?? new Map(),
|
|
88
|
-
obstacleClearance: rectDiffPipeline.inputProblem.obstacleClearance,
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
),
|
|
92
|
-
definePipelineStep(
|
|
93
|
-
"adjacentLayerContainmentMergeSolver",
|
|
94
|
-
AdjacentLayerContainmentMergeSolver,
|
|
95
|
-
(rectDiffPipeline: RectDiffPipeline) => [
|
|
96
|
-
{
|
|
97
|
-
meshNodes:
|
|
98
|
-
rectDiffPipeline.outerLayerContainmentMergeSolver?.getOutput()
|
|
99
|
-
.outputNodes ??
|
|
100
|
-
rectDiffPipeline.gapFillSolver?.getOutput().outputNodes ??
|
|
101
|
-
rectDiffPipeline.rectDiffGridSolverPipeline?.getOutput()
|
|
102
|
-
.meshNodes ??
|
|
103
|
-
[],
|
|
104
|
-
simpleRouteJson: rectDiffPipeline.inputProblem.simpleRouteJson,
|
|
105
|
-
},
|
|
106
|
-
],
|
|
107
|
-
),
|
|
108
72
|
]
|
|
109
73
|
|
|
110
74
|
override _setup(): void {
|
|
@@ -136,16 +100,6 @@ export class RectDiffPipeline extends BasePipelineSolver<RectDiffPipelineInput>
|
|
|
136
100
|
}
|
|
137
101
|
|
|
138
102
|
override getOutput(): { meshNodes: CapacityMeshNode[] } {
|
|
139
|
-
const adjacentLayerMergeOutput =
|
|
140
|
-
this.adjacentLayerContainmentMergeSolver?.getOutput()
|
|
141
|
-
if (adjacentLayerMergeOutput) {
|
|
142
|
-
return { meshNodes: adjacentLayerMergeOutput.outputNodes }
|
|
143
|
-
}
|
|
144
|
-
const outerLayerMergeOutput =
|
|
145
|
-
this.outerLayerContainmentMergeSolver?.getOutput()
|
|
146
|
-
if (outerLayerMergeOutput) {
|
|
147
|
-
return { meshNodes: outerLayerMergeOutput.outputNodes }
|
|
148
|
-
}
|
|
149
103
|
const gapFillOutput = this.gapFillSolver?.getOutput()
|
|
150
104
|
if (gapFillOutput) {
|
|
151
105
|
return { meshNodes: gapFillOutput.outputNodes }
|
|
@@ -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"
|
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
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tscircuit/rectdiff",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "
|
|
6
|
-
"
|
|
5
|
+
"main": "./lib/index.ts",
|
|
6
|
+
"module": "./lib/index.ts",
|
|
7
|
+
"types": "./lib/index.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./lib/index.ts"
|
|
10
|
+
},
|
|
7
11
|
"scripts": {
|
|
8
12
|
"start": "cosmos",
|
|
9
13
|
"build": "tsup-node ./lib/index.ts --format esm --dts",
|
|
@@ -15,8 +19,6 @@
|
|
|
15
19
|
"devDependencies": {
|
|
16
20
|
"@biomejs/biome": "^2.3.5",
|
|
17
21
|
"@react-hook/resize-observer": "^2.0.2",
|
|
18
|
-
"@tscircuit/math-utils": "^0.0.29",
|
|
19
|
-
"@tscircuit/solver-utils": "^0.0.9",
|
|
20
22
|
"@types/bun": "latest",
|
|
21
23
|
"@types/rbush": "^4.0.0",
|
|
22
24
|
"@types/react": "^18",
|
|
@@ -25,8 +27,6 @@
|
|
|
25
27
|
"@vitejs/plugin-react": "^4",
|
|
26
28
|
"biome": "^0.3.3",
|
|
27
29
|
"bun-match-svg": "^0.0.14",
|
|
28
|
-
"graphics-debug": "^0.0.76",
|
|
29
|
-
"rbush": "^4.0.1",
|
|
30
30
|
"react": "18",
|
|
31
31
|
"react-cosmos": "^6.2.3",
|
|
32
32
|
"react-cosmos-plugin-vite": "^6.2.0",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"D": "^1.0.0",
|
|
43
|
-
"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"
|
|
44
48
|
}
|
|
45
49
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import simpleRouteJson from "tests/solver/repros/merge-single-layer-node/merge-single-layer-node.json"
|
|
2
|
+
import { RectDiffPipeline } from "lib/RectDiffPipeline"
|
|
3
|
+
import { useMemo } from "react"
|
|
4
|
+
import { SolverDebugger3d } from "components/SolverDebugger3d"
|
|
5
|
+
|
|
6
|
+
export default () => {
|
|
7
|
+
const problem = simpleRouteJson[0]!
|
|
8
|
+
|
|
9
|
+
const solver = useMemo(() => new RectDiffPipeline(problem), [])
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<SolverDebugger3d
|
|
13
|
+
solver={solver}
|
|
14
|
+
simpleRouteJson={problem.simpleRouteJson}
|
|
15
|
+
/>
|
|
16
|
+
)
|
|
17
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="white"/><g><rect data-type="rect" data-label="node" data-x="-5" data-y="1.
|
|
1
|
+
<svg width="640" height="640" viewBox="0 0 640 640" xmlns="http://www.w3.org/2000/svg"><rect width="100%" height="100%" fill="white"/><g><rect data-type="rect" data-label="node" data-x="-5" data-y="1.1600000000000008" x="40" y="110" width="210" height="338.80000000000007" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="5" data-y="1.1600000000000008" x="390" y="110" width="210" height="338.80000000000007" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="0" data-y="4" x="250" y="110.00000000000006" width="140" height="140" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-5.48" data-y="-5.16" x="40" y="471.20000000000005" width="176.39999999999998" height="58.799999999999955" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="5.48" data-y="-5.16" x="423.6" y="471.20000000000005" width="176.39999999999998" height="58.799999999999955" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-2.4800000000000004" data-y="-4.84" x="216.39999999999998" y="448.80000000000007" width="33.60000000000002" height="81.19999999999993" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="2.4800000000000004" data-y="-4.84" x="390" y="448.80000000000007" width="33.60000000000002" height="81.19999999999993" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-5.48" data-y="-4" x="40" y="448.80000000000007" width="176.39999999999998" height="22.399999999999977" fill="#fef3c7" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="5.48" data-y="-4" x="423.6" y="448.80000000000007" width="176.39999999999998" height="22.399999999999977" fill="#fef3c7" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="6.890000000000001" data-y="-4" x="522.3000000000001" y="448.80000000000007" width="77.69999999999993" height="22.399999999999977" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-6.89" data-y="-4" x="40" y="448.80000000000007" width="77.70000000000002" height="22.399999999999977" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-5" data-y="-4" x="136.6" y="448.80000000000007" width="16.80000000000001" height="22.399999999999977" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-3.5900000000000003" data-y="-4" x="172.3" y="448.80000000000007" width="44.099999999999966" height="22.399999999999977" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="3.5900000000000007" data-y="-4" x="423.6" y="448.80000000000007" width="44.10000000000002" height="22.399999999999977" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="5" data-y="-4" x="486.6" y="448.80000000000007" width="16.799999999999955" height="22.399999999999977" fill="#dbeafe" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-5.51" data-y="-4" x="117.70000000000002" y="448.80000000000007" width="18.899999999999977" height="22.399999999999977" fill="red" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="-4.49" data-y="-4" x="153.4" y="448.80000000000007" width="18.899999999999977" height="22.399999999999977" fill="red" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="4.49" data-y="-4" x="467.70000000000005" y="448.80000000000007" width="18.899999999999977" height="22.399999999999977" fill="red" stroke="black" stroke-width="0.02857142857142857"/></g><g><rect data-type="rect" data-label="node" data-x="5.51" data-y="-4" x="503.4" y="448.80000000000007" width="18.899999999999977" height="22.399999999999977" fill="red" stroke="black" stroke-width="0.02857142857142857"/></g><g id="crosshair" style="display: none"><line id="crosshair-h" y1="0" y2="640" stroke="#666" stroke-width="0.5"/><line id="crosshair-v" x1="0" x2="640" stroke="#666" stroke-width="0.5"/><text id="coordinates" font-family="monospace" font-size="12" fill="#666"></text></g><script><![CDATA[
|
|
2
2
|
document.currentScript.parentElement.addEventListener('mousemove', (e) => {
|
|
3
3
|
const svg = e.currentTarget;
|
|
4
4
|
const rect = svg.getBoundingClientRect();
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
v.setAttribute('y2', '640');
|
|
21
21
|
|
|
22
22
|
// Calculate real coordinates using inverse transformation
|
|
23
|
-
const matrix = {"a":35,"c":0,"e":320,"b":0,"d":-35,"f":320};
|
|
23
|
+
const matrix = {"a":35,"c":0,"e":320,"b":0,"d":-35,"f":320.00000000000006};
|
|
24
24
|
// Manually invert and apply the affine transform
|
|
25
25
|
// Since we only use translate and scale, we can directly compute:
|
|
26
26
|
// x' = (x - tx) / sx
|