feat(06-01): typed-array A* + turn classifier + step derivation + public exports (GREEN)
- routeAstar: allocation-free hot loop — binary heap of node indices over preallocated typed arrays (grown by doubling), typed-array g/closed/ came-from, on-demand cached haversine/maxSpeed heuristic (admissible + consistent); oneway-reverse edges never relaxed; unreachable -> null - A1 proves A* == brute-force Dijkstra on ALL 625 mini-graph pairs - classifyTurn: the one turn authority (compass convention — negative delta = left; plan's (0,40)->slight-left case contradicted its own (0,-90)/(0,90) pins, documented deviation); TURN_* constants exported for plan 07's cron projection - deriveSteps: splits at non-straight bearings or name changes; steps carry kind/name/distanceM + polyline6; depart-first, arrive-last - index.ts: engine-A named exports + ladder note updated — backend #2 is now 'engine-a' (D-01 supersedes the wasm-router note; Valhalla port infeasible + geojson-path-finder rejected, engine B = post-v1 evolution, D-02); createHttpRoutingSource deliberately absent (plan 04)
This commit is contained in:
+36
-1
@@ -4,12 +4,28 @@
|
||||
* Named exports ONLY (no default export). The package has NO exports /
|
||||
* main field (the @araharah/theme + @araharah/search precedent), so
|
||||
* consumers import the EXPLICIT SUBPATH WITH EXTENSION —
|
||||
* import { createFixtureRoutingSource } from "@araharah/routing/src/index.ts";
|
||||
* import { snapToGraph } from "@araharah/routing/src/index.ts";
|
||||
* (both tsconfigs carry allowImportingTsExtensions + bundler resolution;
|
||||
* esbuild and Vite compile the .ts source; Node 24 type-stripping handles
|
||||
* the corpus runner's relative form). A bare "@araharah/routing" specifier
|
||||
* resolves to NOTHING — never use it.
|
||||
*
|
||||
* THE BACKEND LADDER (D-01 supersedes the phase-5 "wasm-router" note):
|
||||
* #1 "fixture" — createFixtureRoutingSource: the golden-pairs demo
|
||||
* corpus (15 committed KL pairs).
|
||||
* #2 "engine-a" — the Worker-side router built on THIS plan's data
|
||||
* plane: decodeGraph + snapToGraph + routeAstar over an
|
||||
* R2-hosted CSR graph binary. Engine B (a fully
|
||||
* client-side webview router — graph on the phone) is
|
||||
* engine A's documented post-v1 evolution (D-02). The
|
||||
* Valhalla-to-JS port was ruled infeasible and
|
||||
* geojson-path-finder rejected (demo-grade: no
|
||||
* alternatives/one-ways) — recorded so neither is ever
|
||||
* re-proposed (D-02).
|
||||
* Plan 04 adds `createHttpRoutingSource` (the /api/route surface that
|
||||
* plugs engine A beneath the RoutingSource seam) — deliberately absent
|
||||
* here.
|
||||
*
|
||||
* The module reads NO environment, NO secrets, and NO network (D-05/D-12):
|
||||
* the whole routing stack is V8-native and dependency-free — fixtures ride
|
||||
* the bundle, requests never leave the caller's frame.
|
||||
@@ -28,3 +44,22 @@ export {
|
||||
getPairOrigin,
|
||||
getPairs,
|
||||
} from "./fixture-source.ts";
|
||||
export type { RoadGraph, GraphEdgeInput, GraphInput } from "./graph.ts";
|
||||
export {
|
||||
decodeGraph,
|
||||
encodeGraph,
|
||||
GRAPH_MAGIC,
|
||||
GRAPH_VERSION,
|
||||
UNNAMED_NAME_ID,
|
||||
} from "./graph.ts";
|
||||
export type { SnapResult } from "./snap.ts";
|
||||
export { snapToGraph, SNAP_BBOX_MARGIN_DEG } from "./snap.ts";
|
||||
export type { AstarResult, GuidanceTurnKind } from "./astar.ts";
|
||||
export {
|
||||
routeAstar,
|
||||
deriveSteps,
|
||||
classifyTurn,
|
||||
TURN_STRAIGHT_MAX_DEG,
|
||||
TURN_SLIGHT_MAX_DEG,
|
||||
TURN_UTURN_MIN_DEG,
|
||||
} from "./astar.ts";
|
||||
|
||||
Reference in New Issue
Block a user