code wiki / _hdl_build / nx_geo_buffer.nx

nx_geo_buffer.nx

buildroot/runtime/_hdl_build/nx_geo_buffer.nx

1843 B37 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind librarytopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_buffer.nx -- LIB: GEO-017 BUFFER / OFFSET MEASURE (Minkowski sum of a convex polygon with a disk of radius r). For a CONVEX polygon the buffered area has the exact closed form area(P (+) disk_r) = area(P) + perimeter(P)*r + pi*r^2 (the straight edges sweep rectangles of total area perimeter*r; the corners sweep wedges that sum to one full disk pi*r^2). We compute this MEASURE in integer arithmetic, doubled to match GEO-010: buffer_area2 = geo_area2(P) + 2*perimeter*r + 2*pi*r^2, 2*pi*r^2 ~ 710*r^2/113 (pi ~ 355/113). HONEST SCOPE: this returns the buffer COVERAGE MEASURE (doubled microdeg^2), not the rounded buffer BOUNDARY polygon. It is DETERMINISTIC integer arithmetic; the only inexactness is pi via the 355/113 rational (error ~2.7e-7) and nx_isqrt's floor on non-perfect-square edge lengths -- no float drift. This is the "expand a geofence by R meters" coverage query. Convention: poly = flat [lat0,lon0,...], r in the same microdeg units. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_geo_area.nx nx_isqrt.nx nx_syscalls.nx nx_geo_buffer.nx nx_geo_buffer_gate.nx

imports: nx_geo_area.nxnx_isqrt.nxnx_syscalls.nx

imported by: nx_geo_buffer_gate.nx

structs

none

consts

none

functions

18func geo_perimeter(poly: *i64, npts: i64) -> i64
called by 2: geo_buffer_area2main calls 1: nx_isqrt
33func geo_buffer_area2(poly: *i64, npts: i64, r: i64) -> i64
called by 1: main calls 2: geo_area2geo_perimeter