feat(viewer): measure shortest route along the cave#3
Conversation
The measure tool now also reports the through-the-cave distance between the two picked stations and highlights the route in the view as a fat cyan line. Route finding is single-source Dijkstra with predecessor tracking over the non-splay leg graph (src/viewer/route.ts, pure and unit-tested), early-exiting at the target. Coordinate-coincident stations are treated as one graph node: Therion .lox writes an equated station once per survey (different ids/names, same point, no joining shot), so without this the Migovec example fragments into ~600 centreline pieces and most routes come back "no route"; with it the whole 47 km system is one connected component. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deploying caveviewer with
|
| Latest commit: |
77ab47a
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0da581d2.caveviewer.pages.dev |
| Branch Preview URL: | https://feat-route-measure.caveviewer.pages.dev |
Therion names anonymous splay/wall endpoints "." or "-", but the .lox parser only treated empty names as anonymous. In the Migovec example 13,858 of 22,154 stations are such wall points: invisible (splays are hidden by default) yet pickable, so clicks near the centreline often selected one and the measure tool reported "no route" (they hang off splay-only legs). They are now anonymous and unlabelled, like anonymous stations from the other parsers — excluded from picking, search, and the survey tree. Stations genuinely NAMED with a trailing dot (e.g. "9." in the golden fixture, where the .3d agrees) stay named. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Testing feedback fix: clicks near the centreline often landed on invisible Therion "anonymous" wall points (stations named |
entranceDistances now canonicalizes coordinate-coincident stations to a single graph node, the same treatment route-finding got: Therion .lox writes an equated station once per survey with no joining shot, so the distance flood stopped at every survey boundary and 97.7% of the Migovec example coloured grey (unreachable). Now 8293 of 8294 named stations are reachable (the one remainder is genuinely isolated); coincident stations share their canonical node's distance. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Second testing-feedback fix: distance-from-entrance colouring suffered the same .lox equate fragmentation as routing — only 2.3% of the Migovec example was reachable from its entrances (the rest coloured grey). |
Resolved test/coloring.test.ts import block (main's superset wins); coloring.ts auto-merged — date mode and the equate-aware entranceDistances coexist. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Background
What Has Changed
src/viewer/route.ts: shortest path between two stations via single-source Dijkstra with predecessor tracking over the non-splay leg graph, early-exiting at the target. ~18 ms on the 22k-station Migovec model..loxwrites an equated station once per survey — different ids/names, identical coordinates, no joining shot. The Migovec example therefore fragments into ~600 centreline pieces, and most routes initially came back "no route". The route graph now treats coordinate-coincident stations (0.1 mm key) as one node, which fuses Migovec into a single 7,725-station connected component. Verified: a pair that previously failed now reports 424.9 m along the cave vs 134.1 m straight line.test/route.test.ts(chain summing, loop shortest-way with reversed leg orientation, splay exclusion, disconnection, equate connectivity, self-route, bad ids). 71/71 passing.Note for a follow-up
The same
.loxfragmentation affects the distance-from-entrance colour mode (entranceDistancesincoloring.ts) — large parts of.loxmodels colour grey/unreachable today. Deliberately not fixed here to avoid conflicting with #2; worth the same canonicalization in a follow-up.Screenshots/Video
Checklist
🤖 Generated with Claude Code