code wiki / _hdl_build / nx_geo_join.nx
nx_geo_join.nx
buildroot/runtime/_hdl_build/nx_geo_join.nx
about
nx_geo_join.nx -- LIB: GEO-013 SPATIAL JOIN (point-in-which-polygon), INTEGER-EXACT. The PostGIS
ST_Contains-join staple: assign each of N query points to the polygon (from a pool of M) that
contains it. Composes the GEO-001 exact ray-cast predicate, here as a pooled, base-offset variant
`geo_pip_off` so many polygons share one flat vertex buffer (pool + per-polygon offset/count).
EXCEED ANGLE (measured, not asserted): the containment test is the same integer cross-multiplied
ray-cast as GEO-001 -- ZERO floating point -> the point->polygon assignment is EXACT and
DETERMINISTIC on edges/vertices, where float spatial joins (Turf/Shapely/PostGIS) can drop or
double-count boundary points. Overflow-safe for Earth coords in i64.
(geo_pip_off restates GEO-001's ray-cast for the pooled layout; if a 3rd caller needs it, extract a
shared base-offset primitive into nx_geo per the DRY rule.) license_tier: ORIGINAL
dependencies 1 imports · 1 importers
imports: nx_syscalls.nx
imported by: nx_geo_join_gate.nx
structs
| none |
consts
| none |
functions
| 17 | func geo_pip_off(pool: *i64, base: i64, npts: i64, lat: i64, lon: i64) -> i64 called by 1: geo_locate |
| 47 | func geo_locate(pool: *i64, off: *i64, cnt: *i64, npolys: i64, lat: i64, lon: i64) -> i64 |
| 57 | func geo_spatial_join(pts: *i64, npts: i64, pool: *i64, off: *i64, cnt: *i64, npolys: i64, out: *i64) -> i64 |