code wiki / _hdl_build / nx_geo_match.nx

nx_geo_match.nx

buildroot/runtime/_hdl_build/nx_geo_match.nx

3276 B65 linesdepth 2pulls 2 transitivereach 1 importersview sourcekind librarytopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_match.nx -- LIB: GEO-023 MAP-MATCHING (snap a noisy GPS fix to a road network). For each road EDGE (a segment A->B) we project the GPS point P onto the segment (closest point), clamped to the endpoints, then pick the edge whose snapped point is nearest P. Projection parameter t = dot(P-A, B-A) / dot(B-A, B-A) clamped to [0,1]; the snapped point is A + t*(B-A). THE EXCEED ANGLE: the projection + nearest-edge choice are INTEGER and deterministic -- the snapped position and the chosen edge are reproducible to the bit (no float jitter that makes a GPS fix flip between two near-equidistant roads). Overflow-safe at any scale: the t fraction (num,den) is normalized (lockstep >>1, ratio preserved) before multiplying by the edge delta, exactly as the GEO-015 clip intersection does. Sovereign + offline; the road graph is seeded data, not a service. Convention: points/edges in microdegrees, [lat,lon]; edges = flat [alat,alon,blat,blon, ...]. license_tier: ORIGINAL

dependencies 1 imports · 1 importers

nx_syscalls.nx nx_geo_match.nx nx_geo_match_gate.nx

imports: nx_syscalls.nx

imported by: nx_geo_match_gate.nx

structs

none

consts

15const K_MAGIC_17179869184: i64 = 17179869184

functions

17func geo_mm_abs(x: i64) -> i64 { if x < 0 { return 0 - x } return x }
called by 1: geo_snap_to_segment
20func geo_snap_to_segment(alat: i64, alon: i64, blat: i64, blon: i64, plat: i64, plon: i64, out2: *i64) -> i64
called by 1: geo_map_match calls 1: geo_mm_abs
44func geo_mm_dist2(lat1: i64, lon1: i64, lat2: i64, lon2: i64) -> i64
called by 1: geo_map_match
51func geo_map_match(plat: i64, plon: i64, edges: *i64, nedges: i64, out2: *i64) -> i64