Post-A-Star Staircase Straightening

"/home/yossef/notes/git/projects/maplibra/decisions/Post-A-Star Staircase Straightening.md"

path: maplibra/decisions/Post-A-Star Staircase Straightening.md

- **fileName**: Post-A-Star Staircase Straightening
- **Created on**: 2026-06-16 00:48:42

Post-A-Star Staircase Straightening

Purpose: Documents the decision to improve visible route quality with a conservative post-A* straightening pass.

Related: ../Home.md, ../modules/Route Smoothing.md, ../modules/Pathfinding.md, ../flows/Route Computation.md

Decision

Use a post-A* walkable straightener before the existing smoothing pipeline to reduce shallow grid staircases.

Context

Graph generation samples walkable polygons on a local grid and connects nearby nodes. A* can therefore return a valid but stair-stepped route, especially across angled or open walkable areas.

The route in the browser screenshot was a good example: the path was valid, but not how a person would naturally walk through the open area.

Why This First

Long visibility edges or Theta* would likely produce better native paths, but they affect graph size, worker routing, binary routing, WASM parity, and startup behavior.

The first implementation intentionally avoids changing graph generation or route search. It only rewrites the rendered per-floor coordinate sequence when the direct segment is explicitly validated as walkable.

Implementation

The helper is straightenWalkableStaircase() in src/pathfinding/route-smoothing-enhanced.js.

It:

src/pathfinding/route-features.js then validates the full straightened route with isRouteSegmentWalkable() before replacing the working segment.

Tradeoffs

Benefits:

Costs:

Tests

Future Work