code wiki / (root) / nx_meshgap.nx

nx_meshgap.nx

buildroot/runtime/nx_meshgap.nx

8068 B193 linesdepth 2pulls 3 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_meshgap.nx -- SPATIAL COHERENCE OF A MESH: does the figure hold together, or have parts flown off into empty space? WHY THIS EXISTS (measured 2026-08-23, by eye on a live page). The models page card FEMALE DARK KNIGHT renders as FRAGMENTED GEOMETRY -- the hair/helmet floats detached far above the body and stray blobs hang below it -- while EVERY NUMBER ON ITS CARD IS GREEN: 33 geometry nodes merged, rig 113 joints, 3729 clusters = 33 x 113, albedo carried, 6-chart atlas. The arithmetic closes perfectly and the picture is broken. That is the third time in one day the eye beat the teeth (a donor rendering lying flat; a 30-pixel dark blob at the horizon; now this), and the reason is always the same: every existing tooth measured a COUNT or a SUM, and no tooth measured whether the thing HOLDS TOGETHER IN SPACE. WHY MESH SPACE AND NOT PIXELS. The obvious instrument is connected-component analysis on the render. It cannot be built cheaply here -- the estate has PNG WRITERS but no decoder with an unfilter stage -- and it would be the weaker measurement anyway: a pixel silhouette depends on the camera, the renderer tier and the auto-framing, so a coherent mesh photographed badly and a fragmented mesh photographed well are indistinguishable. The mesh is the SUBJECT; the render is a projection of it. Measuring the subject is exact, load-independent, camera-independent, and catches the defect AT INGEST rather than after it reaches a page. THE MEASURE IS PARAMETER-FREE, WHICH IS THE WHOLE POINT ON A DAY WHEN AN ESTATE CENSUS MEASURED ONLY 2.56 PERCENT OF CAPACITY BOUNDS AS DERIVED. A coherent figure is spatially CONTIGUOUS: walk along any axis and you never cross a large empty void before reaching the far side. A fragmented figure has a VOID between the body and whatever flew off. So the measurement is the LARGEST INTERIOR EMPTY GAP along each axis, expressed in permil of that axis's own span -- a ratio of the mesh to itself, with no constant to pick and no units to get wrong. The bin width is DERIVED FROM THE DATA, not chosen: one bin per vertex (binwidth = span/nv, at least 1 unit), so resolution follows the mesh's own density. A void spanning thousands of bins cannot be confused with the one- or two-bin holes that ordinary sampling produces. ALL THREE AXES ARE REPORTED AND THE VERDICT TAKES THE WORST. Deliberately NOT stature-only: this organ must not inherit the axis-identification problem that has bitten three lanes today, and a part can fly off along any axis. Largest-extent-is-stature is ALSO wrong for these donors -- a T-posed rig's arm span can exceed its height -- so no axis is privileged here at all. THE BOUND IS NOT BAKED IN. With no second argument this organ MEASURES ONLY and exits 0. The caller supplies the bound, so it can be derived from a measured population (coherent donors vs fragmented ones) and live in a conf with its derivation beside it, rather than being frozen into a binary where nobody can see it.

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_nxa.nx nx_meshgap.nx

imports: nx_syscalls.nxnx_nxa.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main mgerr sys_write mg_atoi sys_mmap nxa_die sys_write ↻ sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable sys_write ↻ nxa_dump_sizes sys_write ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close nxa_find nxa_section_entry nxa_magic nxa_check2 nxa_tag4 mgw sys_write ↻ mgn sys_mmap ↻ sys_write ↻ mg_axis_gap sys_mmap ↻

structs

none

consts

48const MG_EXIT_FRAG: i64 = 1
49const MG_EXIT_USAGE: i64 = 2
50const MG_EXIT_UNREADABLE: i64 = 3
51const MG_PERMIL: i64 = 1000
52const MG_AXES: i64 = 3
53const MG_WV: i64 = 3 // words per vertex in a VERT section (x,y,z), per the NXA v1 spec

functions

55func mgw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
called by 1: main calls 1: sys_write
56func mgerr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 }
called by 1: main calls 1: sys_write
58func mgn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
78func mg_atoi(s: *u8) -> i64
called by 1: main
91func mg_axis_gap(vb: *i64, nv: i64, k: i64, out: *i64) -> i64
called by 1: main calls 1: sys_mmap
140func main(argc: i64, argv: *i64) -> i64