core: shared pure plan-footprint math for spatial-grid and MCP - #600
Open
ActArtech wants to merge 2 commits into
Open
core: shared pure plan-footprint math for spatial-grid and MCP#600ActArtech wants to merge 2 commits into
ActArtech wants to merge 2 commits into
Conversation
Extract rotation-aware XZ footprint AABB/corners and expand-then-intersect gap overlap into packages/core/lib/plan-footprint. Spatial-grid and alignment-anchors delegate to it. Export via @pascal-app/core/plan-footprint and spatial-grid. Design note documents one source and gap call-site rules after pascalorg#569.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Extracts rotation-aware plan (XZ) footprint math into a pure, Node-safe core module so spatial-grid, alignment anchors, and (later) MCP layout clearance share one formula after #569.
packages/core/src/lib/plan-footprint.ts: corners, AABB, expand-then-intersect gap overlap, scaled item helper (null for wall/ceiling hosts)@pascal-app/core/plan-footprint(pure) and re-export from@pascal-app/core/spatial-gridwiki/architecture/plan-footprint.md(one source; packing gap ~0.08 vs check/verifygap: 0)Out of scope: rewiring MCP
furnish_room/verify_scene/ door keep-outs to call these helpers (follow-up).How to test
bun test packages/core/src/lib/plan-footprint.test.ts— expect all passbun test packages/core/src/services/alignment-anchors.test.ts— still greenbun run --cwd packages/core build—tsc --buildcleanbun run check packages/core/src/lib/plan-footprint.ts packages/core/src/lib/plan-footprint.test.ts packages/core/src/hooks/spatial-grid/spatial-grid-manager.ts packages/core/src/services/alignment-anchors.ts@pascal-app/core/plan-footprintand@pascal-app/core/spatial-gridand confirmplanFootprintAABBreturns the same boxScreenshots / screen recording
N/A — non-visual change (pure geometry helpers + tests + wiki note).
Checklist
bun test/bun run --cwd packages/core buildbun run checkon changed files)wiki/architecture/plan-footprint.md)mainbranchNote
Medium Risk
Unifies alignment and floor-collision footprint math (intentionally); wrong rotation convention would affect placement, snapping, and future MCP clearance, though tests and delegation to prior spatial-grid formulas mitigate that.
Overview
Introduces
packages/core/src/lib/plan-footprint.tsas the single pure XZ source for rotation-aware footprint corners, conservative AABBs, expand-then-intersect overlap with configurable gap, and a scaledplanFootprintAABBForItemhelper (null for wall/ceiling hosts).Spatial-grid and alignment-anchors stop inlining duplicate math and delegate to this module; the spatial-grid entry also re-exports the helpers. A new
@pascal-app/core/plan-footprintpackage export targets Node/MCP callers without pulling the grid manager.Adds unit tests for rotation, corner/AABB parity, gap semantics, and item scaling; documents the module in
wiki/architecture/plan-footprint.md. MCP furnish/verify rewires are explicitly out of scope.Reviewed by Cursor Bugbot for commit 6384a73. Bugbot is set up for automated code reviews on this repo. Configure here.