Skip to content

core: shared pure plan-footprint math for spatial-grid and MCP - #600

Open
ActArtech wants to merge 2 commits into
pascalorg:mainfrom
ActArtech:feat/core-plan-footprint
Open

core: shared pure plan-footprint math for spatial-grid and MCP#600
ActArtech wants to merge 2 commits into
pascalorg:mainfrom
ActArtech:feat/core-plan-footprint

Conversation

@ActArtech

@ActArtech ActArtech commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

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.

  • Add packages/core/src/lib/plan-footprint.ts: corners, AABB, expand-then-intersect gap overlap, scaled item helper (null for wall/ceiling hosts)
  • Spatial-grid manager and alignment-anchors delegate to it (no third parallel AABB path)
  • Export @pascal-app/core/plan-footprint (pure) and re-export from @pascal-app/core/spatial-grid
  • Design note: wiki/architecture/plan-footprint.md (one source; packing gap ~0.08 vs check/verify gap: 0)
  • Unit tests for rotation, scale, gap semantics, corner/AABB parity

Out of scope: rewiring MCP furnish_room / verify_scene / door keep-outs to call these helpers (follow-up).

How to test

  1. bun test packages/core/src/lib/plan-footprint.test.ts — expect all pass
  2. bun test packages/core/src/services/alignment-anchors.test.ts — still green
  3. bun run --cwd packages/core buildtsc --build clean
  4. Optional: bun 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
  5. Optional smoke: import from @pascal-app/core/plan-footprint and @pascal-app/core/spatial-grid and confirm planFootprintAABB returns the same box

Screenshots / screen recording

N/A — non-visual change (pure geometry helpers + tests + wiki note).

Checklist

  • I've tested this locally with bun test / bun run --cwd packages/core build
  • My code follows the existing code style (bun run check on changed files)
  • I've updated relevant documentation (wiki/architecture/plan-footprint.md)
  • This PR targets the main branch

Note

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.ts as the single pure XZ source for rotation-aware footprint corners, conservative AABBs, expand-then-intersect overlap with configurable gap, and a scaled planFootprintAABBForItem helper (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-footprint package 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.

alaa541 added 2 commits August 5, 2026 02:38
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants