Wrong Door Risk
"/home/yossef/notes/git/projects/maplibra/risks/Wrong Door Risk.md"
path: maplibra/risks/Wrong Door Risk.md
- **fileName**: Wrong Door Risk
- **Created on**: 2026-06-16 00:48:42
Wrong Door Risk
Migrated from: obs_vault
Parent: ../modules/Snapping.md
This note explains how a route endpoint can choose a plausible but wrong door.
Status
Mitigated — Three fixes applied.
Likely Cause Chain
- ../modules/Doors and Rooms.md identifies the containing room from polygon geometry.
- ../modules/Doors and Rooms.md finds candidate doors from
connections.jsonand entrance nodes. - ../modules/Snapping.md ranks door candidates and snaps the door centroid to graph nodes.
- A door that intersects, touches, or sits close to multiple spaces can choose the corridor-side or neighboring-space node.
Failure Modes (Fixed)
1. Distance fallback matches neighbor doors — FIXED
doorIntersectsRoom used raw distance-to-boundary (≤1.5m) as fallback. Doors on shared walls between adjacent rooms would pass because their centroid is equidistant from both room boundaries.
Fix: Added buffered polygon containment check (buffer(roomFeature, threshold) + booleanPointInPolygon). The door centroid must fall inside the room's expanded footprint, not just near any boundary edge.
2. No room-center proximity scoring — FIXED
All door candidates were scored only by distance to user click and extra cost. Neighboring-room doors that passed the filter had no penalty.
Fix: Added room-centroid proximity penalty (0.15× distance-to-center) to getDoorSnapCandidates. Doors closer to the room center are naturally preferred.
3. Same-room routes exited through doors — FIXED
When start and target were both inside the same room, the system still tried to exit through a door and re-enter, creating unnecessary detours.
Fix: Added same-room short-circuit in getSnapCandidates. When otherPoint is in the same room polygon, skip door snapping entirely and use nearest walkable nodes.
Remaining Risk
- Door-room ownership is inferred from geometry, not from explicit metadata
- Geometry proximity can look correct even when semantic ownership is wrong
- Generic fallbacks can still produce a route, hiding that the door choice was wrong
See Also
-
continue:[[]]
before:[[]]