nx_meshgap.nx
buildroot/runtime/nx_meshgap.nx
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
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
structs
| none |
consts
| 48 | const MG_EXIT_FRAG: i64 = 1 |
| 49 | const MG_EXIT_USAGE: i64 = 2 |
| 50 | const MG_EXIT_UNREADABLE: i64 = 3 |
| 51 | const MG_PERMIL: i64 = 1000 |
| 52 | const MG_AXES: i64 = 3 |
| 53 | const MG_WV: i64 = 3 // words per vertex in a VERT section (x,y,z), per the NXA v1 spec |
functions
| 55 | func mgw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 56 | func mgerr(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(2, s, n); return 0 } |
| 58 | func mgn(v: i64) -> i64 |
| 78 | func mg_atoi(s: *u8) -> i64 called by 1: main |
| 91 | func mg_axis_gap(vb: *i64, nv: i64, k: i64, out: *i64) -> i64 |
| 140 | func main(argc: i64, argv: *i64) -> i64 |