code wiki / _hdl_build / nx_geo_eqarea.nx

nx_geo_eqarea.nx

buildroot/runtime/_hdl_build/nx_geo_eqarea.nx

4615 B74 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_eqarea.nx -- GEO-005 (other half): EQUAL-AREA cells, the fix for the geohash's CELL-SIZE weakness. A lat/lon grid (geohash) partitions latitude by equal Δlat, but a cell's GROUND AREA = Δlon * (sin(lat_hi) - sin(lat_lo)) shrinks by cos(lat) toward the poles -- so a "uniform" geohash grid actually has cells ~7x smaller near the poles than at the equator (density bias). The CYLINDRICAL-EQUAL-AREA fix: project lat -> y = sin(lat) and partition by equal Δy. Because the spherical area element is exactly dlon * d(sin lat), equal Δlon*Δsin rectangles have EQUAL ground area at every latitude. Composes the Hilbert ordering (nx_geo_hilbert) -> equal-area cells in Hilbert order = the S2/H3 cell-uniformity target. REUSES fx.nx CORDIC sin (no float, no reinvention). EXCEED is MEASURED: lat/lon band areas vary >2x (via real fx_sin) while equal-area bands are uniform.

dependencies 3 imports · 0 importers

fx.nx nx_itoa_lib.nx nx_syscalls.nx nx_geo_eqarea.nx

imports: fx.nxnx_itoa_lib.nxnx_syscalls.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap fx_sin fx_sin_cos fx_normalize_angle fx_cordic_atan ea_deg_q16 ea_w sys_write ea_n nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_openat_append sys_close sys_exit

structs

none

consts

none

functions

14func ea_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 }
called by 1: main calls 1: sys_write
19func ea_n(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
21func ea_deg_q16(deg: i64) -> i64 { return deg * FX_TWO_PI / 360 }
called by 1: main
22func main(argc: i64, argv: *i64) -> i64