pathfinding
"/home/yossef/notes/git/projects/inguide/modules/pathfinding.md"
path: inguide/modules/pathfinding.md
- **fileName**: pathfinding
- **Created on**: 2026-06-16 00:48:42
pathfinding
cs# pathfinding
Purpose: A* routing engine in the MapLibre web runtime — path computation, GPS tracking, multi-floor routing.
Architecture
- Graph:
PathfinderGraph(JSON + binary typed array formats) - Engine: A* with MinHeap, 3 engines: JS, WASM, Web Worker
- Routing engines: Portal (cross-floor), Legacy (single floor), Unified (outdoor+indoor)
Key Components
| File | Role |
|---|---|
pathfinder.js |
A* impl with Haversine distance, MinHeap |
pathfinder-graph.js |
Graph data structure, floor-indexed nodes, LRU snap cache |
routing-controller.js |
Graph loading, route compute orchestration |
navigation-controller.js |
GPS tracking, follow camera, rerouting |
route-compute.js |
Portal engine route computation (preferred) |
route-features.js |
Route → GeoJSON LineStrings + connectors |
gps-tracking.js |
Live location → snap to route nodes |
route.js |
Renders route on map + notifies Android bridge |
Graph Data
- Nodes:
{ id, floorId, coords: [lng,lat], clearance, componentId } - Edges:
{ from, to, cost, type: walk/stairs/elevator/ramp/escalator } - Coordinates: WGS84 geographic
[lng, lat] - Distances: Haversine using Earth radius 6,371,008.8m
Multi-Floor Routing
- Stairs/elevator edges connect different floors
- Connector features in route output include
connectionType,connectorLabel,nextFloorId - Route path is a flat ordered array of node IDs spanning floors
Related: ./webview.md, ../flows/route-data-flow.md
continue:[[]]
before:[[]]