code wiki / _hdl_build / nx_geo_hilbert.nx
nx_geo_hilbert.nx
buildroot/runtime/_hdl_build/nx_geo_hilbert.nx
about
nx_geo_hilbert.nx -- GEO-005: Hilbert space-filling-curve cell ordering, the S2/H3 superiority
target. The geohash (GEO-002) interleaves lon/lat bits = a Z-ORDER (Morton) curve, which has
BOUNDARY DISCONTINUITIES: consecutive indices can map to cells far apart (a jump at every quadrant
seam), so a range-scan over an index window can miss/overshoot spatially-near cells. The Hilbert
curve's DEFINING PROPERTY: consecutive indices are ALWAYS spatially adjacent (Manhattan distance
exactly 1) -- no discontinuities. PURE-INTEGER (division/modulo, NO bitwise -- the geohash's
no-float discipline + dodges the shift/or miscompile landmine), exact + deterministic. A grid of
n=2^order cells per axis maps bijectively to [0, n*n) Hilbert indices.
EXCEED is MEASURED, not asserted: hilbert_max_jump==1 vs zorder_max_jump>1 on the SAME grid.
dependencies 1 imports · 0 importers
imports: nx_syscalls.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| none |
functions
| 12 | func gh_w(fd: i64, s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(fd, s, n); return 0 } |
| 13 | func gh_n(fd: i64, v: i64) -> i64 |
| 19 | func gh_abs(a: i64) -> i64 { if a < 0 { return 0 - a } return a } called by 1: main |
| 21 | func hil_rot(size: i64, xb: *i64, yb: *i64, rx: i64, ry: i64) -> i64 |
| 29 | func hil_xy2d(n: i64, x: i64, y: i64) -> i64 |
| 49 | func hil_d2xy(n: i64, d: i64, xb: *i64, yb: *i64) -> i64 |
| 65 | func mort_z2xy(z: i64, order: i64, xb: *i64, yb: *i64) -> i64 called by 1: main |
| 81 | func main(argc: i64, argv: *i64) -> i64 |