code wiki / _hdl_build / nx_geo_distance.nx

nx_geo_distance.nx

buildroot/runtime/_hdl_build/nx_geo_distance.nx

1963 B32 linesdepth 4pulls 5 transitivereach 7 importersview sourcekind librarytopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_distance.nx -- LIB: GEO-003 geodesic DISTANCE in meters (equirectangular). Hardware-up: REUSES the sovereign CORDIC cos (fx.nx, Q16.16 fixed-point -- no reinvention) for the mean-latitude longitude-compression, REUSES nx_isqrt for the magnitude, and keeps the lat/lon deltas as INTEGER microdegrees (a single microdegree in radians would underflow Q16.16, so we do NOT convert the deltas -- only the mean latitude, a full angle, goes through cos). Pure integer/fixed-point -> deterministic distance (the exceed angle vs float distance libs). Accuracy: equirectangular is exact-direction and ~exact for local/regional spans; error grows to ~0.5% only at continental scale (haversine is the precision refinement, GEO-003b). Good for nearest-queries, true-meters radius fences, and routing edge weights. license_tier: ORIGINAL

dependencies 3 imports · 5 importers

fx.nx nx_isqrt.nx nx_syscalls.nx nx_geo_distance.nx nx_arcade_serve.nx nx_geo_distance_gate.nx nx_geo_haversine.nx nx_geo_haversine_gate.nx nx_geo_query.nx

imports: fx.nxnx_isqrt.nxnx_syscalls.nx

imported by: nx_arcade_serve.nxnx_geo_distance_gate.nxnx_geo_haversine.nxnx_geo_haversine_gate.nxnx_geo_query.nx

structs

none

consts

14const GEOD_MAGIC_360000000: i64 = 360000000
17const GEOD_M_NUM: i64 = 111195
18const GEOD_M_DEN: i64 = 1000000

functions

21func geo_distance_m(lat1: i64, lon1: i64, lat2: i64, lon2: i64) -> i64