feat(wall): add endHeightOffset for sloped top edge - #640
Open
vducasse wants to merge 15 commits into
Open
Conversation
Fixes a bug where negative offset values caused wall geometry to self-intersect and drop below the base. The value is now strictly clamped to 0 at the Zod schema, UI, and geometry generation layers.
# Conflicts: # packages/nodes/src/wall/panel.tsx
added 2 commits
August 13, 2026 11:24
curved wall sloped geometry - **Geometry Generation**: - `applyWallEndHeightSlope`: Replaced naive X-axis interpolation with exact radial angle-based parameterization (`t`) when the wall footprint is curved. Implemented robust `getSignedAngleDiff` and angle-unwrapping based on expected linear distance to prevent severe Y-axis warping on the wall end caps when `Math.atan2` boundaries are crossed on steep semicircular curves. - `generateExtrudedWall`: Added `getWallArcData` injection, mapping the arc center into wall-local coordinate space, and passing `localArc` down into the height slope generator. - **Height Resolution Core**: - `resolveWallTop`: Added an optional `t?: number` (parametric position along the chord) to correctly account for the sloped top. It injects `endHeightOffset * t` directly into the final top boundary calculation. - `resolveWallEffectiveHeight`: Cascaded the optional `t` parameter from the caller down into `resolveWallTop` and adjusted elevation offsets. - **Spatial Grid Placement**: - `getWallHeight`: Now accepts an optional parametric position and passes it directly to `resolveWallTop`. - `canPlaceOnWall`: Computes the exact parametric `tCenter` for wall-hosted items based on the projection of the item's position onto the wall chord. This allows the placement bounding box constraints to accurately read the sloped height of the wall at the item's insertion point, fixing the bug where placement validators treated the entire wall as completely flat. - **UI and Constraints**: - `panel.tsx`: Refactored the `SliderControl` minimum constraint for the `endHeightOffset` input to explicitly prevent the wall top from dropping below a safe minimum height threshold (`0.01m`).
- Update applyWallEndHeightSlope to clamp against the real extruded wall body height. - Accept parametric t in getWallEffectiveHeightForNodes to resolve local ceiling heights along sloped walls. - Update door and window placement math (clampToWall) and resize handles to evaluate ceiling bounds across the full opening span. - Ensure door handles and readWallLength fall back to parentId when wallId is unset.
- Track lastFits in door and window floorplan move targets and block commit when opening exceeds sloped wall bounds. - Allow clampToWall in window-math and door-math to accept either a WallCeilingSceneReader or a Record<AnyNodeId, AnyNode>.
added 2 commits
August 14, 2026 10:52
…e wall cache fallback - Sample wall heights at tStart, tEnd, and tCenter in canPlaceOnWall to prevent wall items from breaching sloped ceilings. - Add getWall fallback in spatialGridManager to read directly from useScene store when walls are not yet cached.
- Calculate localT using getWallCurveLength on curved walls in readHostWallCeiling and getWallLength for Bugbot / static analysis compliance.
…gs using chord frame - Simplify applyWallEndHeightSlope in wall-system to linearly slope using wall-local X across the chord frame. - Keep readHostWallCeiling and getWallLength unified on chord length.
…mesh clamp - Ensure resolveWallTop clamps negative endHeightOffset to -(bodyHeight - 0.01) so mathematical ceiling queries match rendered 3D geometry.
…tiveHeightForNodes - Ensure all wall heights in spatialGridManager apply slope clamping matching 3D mesh extrusion and vertical-model architecture rules.
…and handles - Sample start (t=0) and end (t=1) wall tops for space-detection room ceilings and level height tracking. - Pass endpoint t to corner handles and midpoint t to height/side handles in wall-move-side-handles. - Sample tCenter along sloped segments for wall top snap beacon highlights. - Interpolate 3D measurement guide paths with getWallEffectiveHeightForNodes across wall slope. - Expose start and end top targets in elevation guides for sloped walls.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8f7ce5c. Configure here.
…changes - Subscribe spatial-grid sync to wall height, endHeightOffset, and support updates. - Read live scene node in getWall to ensure spatial grid queries always reflect current wall slope. - Include endHeightOffset in space-detection wallGeometrySignature so room ceilings reactively re-derive on slope edits.
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?
Adds an
endHeightOffsetproperty to theWallNodeschema to allow wall extremities to have different heights (e.g., for creating a knee wall following a single-pitch roof slope). This adds an "End height offset" slider to the wall properties panel and updates the geometry generation to apply the slope along the top edge of the wall.How to test
End height offsetslider.Screenshots / screen recording
Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
Touches wall-attached item placement and height resolution used by editor overlays; incorrect min-height sampling could allow invalid placements on sloped walls.
Overview
Spatial grid updates so sloped walls (
endHeightOffset) behave correctly for placement, overlays, and cache invalidation.SpatialGridManagernow resolves walls from the live scene store viagetWall, and wall height goes through sharedgetWallEffectiveHeightForNodeswith an optional parametrictalong the span.canPlaceOnWalluses the minimum effective height at the item’s start, end, and center so tall attachments are rejected where the sloped top is lower.spatial-grid-synctreats changes toheight,endHeightOffset,supportSlabId, andsupportOffsetlike geometry edits, refreshing the manager’s wall map and rendered slab polygon cache when slope or support changes.Reviewed by Cursor Bugbot for commit cf8f12c. Bugbot is set up for automated code reviews on this repo. Configure here.