code wiki / (root) / nx_visual_hull.nx

nx_visual_hull.nx

buildroot/runtime/nx_visual_hull.nx

7349 B168 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind librarytopic visual
docsdependenciesstructsconstsfunctions

about

nx_visual_hull.nx -- SILHOUETTE -> 3D FORM. Builds a signed field by intersecting the back- projections of N silhouettes (the visual hull), which surface_nets then polygonizes into a mesh. This is the missing rung between a photograph and geometry. The ecosystem could decode JPEG (nx_jpeg_decode_rgb), polygonize a field (nx_isosurf), render a mesh (nx_trimesh) and import OBJ (nx_obj_import) -- but had no way to turn images INTO a field. Verified absent before writing: every `carve` in the corpus is terrain/geology. ★VIEWS MUST DIFFER IN ANGLE. An anterior and a posterior photograph project along the SAME axis and therefore yield the SAME silhouette outline (mirrored) -- that is ONE shape constraint, not two, however many images you have. Front + LATERAL is what constrains a form. Anterior/posterior pairs are still valuable, but for per-surface ALBEDO, not for shape. ★CSG: the visual hull is an INTERSECTION of back-projected silhouette prisms, and intersection of signed distance fields is max(). Each view is folded in with max, so views can be added incrementally and in any order. Caller supplies cos/sin of the view yaw in Q10 (1024 = 1.0) so this organ needs no trig table and stays exact for the axis-aligned cases that matter (front 1024/0, lateral 0/1024). license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_syscalls.nx nx_visual_hull.nx nx_hull_mesh.nx nx_visual_hull_gate.nx

imports: nx_syscalls.nx

imported by: nx_hull_mesh.nxnx_visual_hull_gate.nx

structs

none

consts

23const VH_BIG: i64 = 1000000
24const VH_Q: i64 = 1024

functions

26func vh_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: vh_bg_mask
27func vh_min(a: i64, b: i64) -> i64 { if a < b { return a } return b }
called by 1: vh_sdf2d
28func vh_max(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 1: vh_carve_view
33func vh_bg_mask(rgb: *u8, w: i64, h: i64, tol: i64, mask: *u8) -> i64
called by 2: mainmain calls 3: sys_mmapvh_abssys_munmap
74func vh_sdf2d(mask: *u8, w: i64, h: i64, out: *i64) -> i64
called by 2: mainmain calls 3: sys_mmapvh_minsys_munmap
121func vh_samp(f: *i64, w: i64, h: i64, x: i64, y: i64) -> i64
called by 1: vh_carve_view
136func vh_carve_view(f2d: *i64, w: i64, h: i64, cyaw: i64, syaw: i64,
called by 2: mainmain calls 2: vh_sampvh_max