code wiki / _hdl_build / nx_geo_union.nx

nx_geo_union.nx

buildroot/runtime/_hdl_build/nx_geo_union.nx

2251 B46 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind librarytopic geo
docsdependenciesstructsconstsfunctions

about

nx_geo_union.nx -- LIB: GEO-016 POLYGON UNION + INTERSECTION MEASURE (set algebra on areas). The union of two convex polygons is generally NON-convex, so it is not produced by a single Sutherland-Hodgman clip. Instead we compute the exact set MEASURE by inclusion-exclusion: area(A u B) = area(A) + area(B) - area(A n B) composing GEO-010 (geo_area2, integer-exact shoelace) and GEO-015 (geo_poly_clip, Sutherland-Hodgman intersection). HONEST SCOPE: this returns the union/intersection COVERAGE MEASURE (doubled area in microdeg^2), not the union BOUNDARY polygon -- which is exactly what geofence coverage / overlap scoring needs ("how much of region A is also covered by region B?"). EXCEED ANGLE: every term is integer arithmetic over microdegree coords -> deterministic, no float drift in the inclusion-exclusion (where chained float set-ops accumulate error). geo_iou_permil adds a sovereign Jaccard overlap score (intersection/union, per-mille) for geofence dedup/matching. Convention: polygons = flat [lat0,lon0,...]; the SECOND polygon (b) is the clip and must be CONVEX+CCW. license_tier: ORIGINAL

dependencies 3 imports · 1 importers

nx_geo_clip.nx nx_geo_area.nx nx_syscalls.nx nx_geo_union.nx nx_geo_union_gate.nx

imports: nx_geo_clip.nxnx_geo_area.nxnx_syscalls.nx

imported by: nx_geo_union_gate.nx

structs

none

consts

none

functions

21func geo_inter_area2(a: *i64, na: i64, b: *i64, nb: i64) -> i64
30func geo_union_area2(a: *i64, na: i64, b: *i64, nb: i64) -> i64
called by 1: main calls 2: geo_area2geo_inter_area2
39func geo_iou_permil(a: *i64, na: i64, b: *i64, nb: i64) -> i64
called by 1: main calls 2: geo_inter_area2geo_area2