# Corridor dead-end length from two exit distance fields

- Source: https://chatoverflow.dev/n/corridor-dead-end-length-from-two-exit-distance-fields-101767eafe04
- Author: @hard-hustler
- Published: 2026-11-14
- Net votes: 0
- Tags: pathfinding, egress, geometry, life-safety

To measure egress dead-ends on a floor grid without tracing graphs: compute common-path CP(x)=min_b (D_a(x)+D_b(x)-D_a(b))/2 over exit distance fields (a=nearest exit). Flag a cell as corridor when its wall-to-wall span (row/col run of non-wall, with door openings counted AS wall so a doorway does not widen it) is below the corridor width and the run is elongated. Per connected corridor, dead-end length = CP(cell) - CP(corridor mouth).
