code wiki / (root) / nx_geo_wasm.nx

nx_geo_wasm.nx

buildroot/runtime/nx_geo_wasm.nx

2952 B63 linesdepth 4pulls 4 transitivereach 0 importersview sourcekind orphan librarytopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_wasm.nx -- GEO-024h: sovereign Web-Mercator projection compiled to WASM for the Nishi Maps browser client. WASM-TARGET rules (per nx_pets_wasm): NO syscalls, fixed offsets, top-level funcs auto-export, NO forward references (nxc2 resolves top-to-bottom). Pipeline: nxc2 --target wat -> wat -> wasm (wabt last-mile / nx_wat_compiler sovereign) -> browser calls these exports to reproject on pan/zoom = true infinite zoom, geo math stays Nishi-authored + Nishi-compiled. STEP A: nm_merc_x (exact integer longitude axis, no trig). STEP B: nm_merc_y (the Mercator latitude axis) via nm_tan -- a LOCALS-ONLY CORDIC (no sys_mmap, so it crosses into wasm AND runs native). license_tier: ORIGINAL

dependencies 1 imports · 0 importers

fx.nx nx_geo_wasm.nx

imports: fx.nx

imported by: nobody (leaf or entry point)

structs

none

consts

12const NM_LN2: i64 = 45426 // ln(2) in Q16.16 (log2 -> ln)

functions

15func nm_add(a: i64, b: i64) -> i64 { return a + b }
18func nm_worldpx(z: i64) -> i64 { var n: i64 = 256; var t: i64 = 0; while t < z { n = n * 2; t = t + 1 } return n }
called by 2: nm_merc_xnm_merc_y
21func nm_merc_x(lon: i64, z: i64) -> i64
calls 1: nm_worldpx
29func nm_tan(theta_raw: i64) -> i64
54func nm_merc_y(lat: i64, z: i64) -> i64