code wiki / _hdl_build / nx_geo_hull_gate.nx

nx_geo_hull_gate.nx

buildroot/runtime/_hdl_build/nx_geo_hull_gate.nx

4172 B90 linesdepth 3pulls 4 transitivereach 0 importersview sourcekind gate/prooftopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_hull_gate.nx -- GATE for GEO-012 convex hull (integer-exact monotone chain). Input: the 4 corners of a 4e6-microdeg square PLUS an interior point and a collinear bottom-edge point. Proves: hull_size == 4 : interior + collinear points are excluded (minimal exact hull) has_interior == 0 : the interior point (idx 4) is not a hull vertex has_collinear == 0 : the collinear edge point (idx 5) is not a hull vertex hull_area2 == 3.2e13 : the hull encloses EXACTLY the square's doubled area (2 * (4e6)^2) -- cross-checked by REUSING GEO-010 geo_area2, so the hull is provably the right polygon without hard-coding a vertex order hull_orient == +1 : counter-clockwise (the monotone-chain output orientation) n2 == 2 : degenerate hull of 2 points returns both Evidence -> knowledge/status/geo_hull.log (GEOHULLGATE authored=organ ... verdict=GREEN). license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_geo_hull.nx nx_geo_area.nx nx_syscalls.nx nx_geo_hull_gate.nx

imports: nx_geo_hull.nxnx_geo_area.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 ghl_set geo_convex_hull sys_mmap ↻ geo_cmp_lonlat geo_cross3 geo_area2 geo_signed_area2 geo_orientation geo_signed_area2 ↻ ghl_emit ghl_w sys_write ghl_wn sys_mmap ↻ sys_write ↻ sys_openat_append sys_close

structs

none

consts

18const GHL_LOG: *u8 = "knowledge/status/geo_hull.log"

functions

20func ghl_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: ghl_emit calls 1: sys_write
21func ghl_wn(fd: i64, v: i64) -> i64 { let bb: *u8 = sys_mmap(28); var m: i64=v; if m<0 {m=0-m; sys_write(fd,"-" as *u8,1)}; let t: *u8 = sys_mmap(28); var k: i64=0; if m==0 {t[0]=48;k=1}; while m>0 {t[k]=(48+(m%10)) as u8; m=m/10; k=k+1}; var i: i64=0; while i<k {bb[i]=t[k-1-i]; i=i+1}; sys_write(fd, bb, k); return 0 }
called by 1: ghl_emit calls 2: sys_mmapsys_write
23func ghl_set(p: *i64, i: i64, lat: i64, lon: i64) -> i64 { p[i * 2] = lat; p[i * 2 + 1] = lon; return 0 }
called by 1: main
25func ghl_emit(fd: i64, hsz: i64, area2: i64, orient: i64, hasI: i64, hasC: i64, n2: i64, ok: i64) -> i64
called by 1: main calls 2: ghl_wghl_wn
36func main() -> i64