code wiki / (root) / nx_clipcheck.nx

nx_clipcheck.nx

buildroot/runtime/nx_clipcheck.nx

21277 B479 linesdepth 4pulls 8 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_clipcheck.nx -- THE ANIMATION CLIPPING RULER (debt 1786578438; operator 2026-08-12: evaluate art/realism/quality/CLIPPING). Measures, per ANIM key of a chn-2 NXA clip, how deep tracked limb joints penetrate (a) the TORSO CAPSULE and (b) the FLOOR plane -- the two gross clipping classes the eye reports as "arm through chest" and "foot through ground". Joint world position per key = bind + dt (the wire's dt lanes ARE world displacement, mm -> 0.01mm x100), exactly the player's apply contract -- no quat math needed for JOINT CENTERS. DECLARED IMPRECISION (imprecision named or the next reader trusts it as exact): - torso = ONE vertical capsule at the spine-band centroid, radius CC_TORSO_R (data below), span 40..80 permil of stature; limbs = points with radius CC_LIMB_R. Real flesh is neither. - ELIGIBILITY: only joints whose BIND already sits OUTSIDE torso_r+limb_r+grace are measured (wrists/elbows/fingertips/ankles) -- hips/shoulders bind INSIDE the capsule and would be permanent false positives (the bind pose is the clean control by construction). - v1 measures limb-vs-TORSO and vs-FLOOR only, NOT limb-vs-limb. THE BVH LANE (2026-08-13, debt 1786598036) -- the MOCAP-SELF-CLEARANCE CONTROL, the two-instruments law applied to the retarget: the SAME capsule measure over the mocap SOURCE skeleton (FK via nx_bvhfk_lib -- the proven incumbent, never a re-implementation). If the source clips the same capsule at the same keys, the retarget is faithful and the residual is ruler coarseness; if the source is clean, the gap belongs to the emitter. DECLARED: - the reference NXA supplies the STATURE BRIDGE (BVH declares no unit; source positions are scaled so both skeletons share a stature) -- proportions are the subject, not absolute size. - axes are MEASURED from the rest pose: up = bone-length-weighted alignment (a T-pose span exceeds its height, so extent misdetects up); side = widest remaining extent; ambiguous alignment REFUSES rather than guessing gravity. - root POSITIONAL channels are ZEROED per frame: the nxa emitter lane is rotations-only / in-place BY DESIGN, so the control mirrors its subject. Rest pose (all channels zero) is the bind analog for eligibility. Keys were emitted 1:1 from frames, so key == frame. - measures every parser-exposed joint whose rest pose sits outside capsule+grace (the NXA lane measures tracked joints; both predicates are "rest/bind outside"). usage: nx_clipcheck <clip.nxa> [detail <key> <joint>] | bvh <clip.bvh> <ref.nxa> [up=x|y|z] exit: 0 CLEAN (worst <= CC_TOL_MM) | 1 CLIP (worst key+joint NAMED) | 4 refuse (parse) license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 5 imports · 1 importers

nx_syscalls.nx nx_nxa.nx nx_clipcap_lib.nx nx_bvh_lib.nx nx_bvhfk_lib.nx nx_clipcheck.nx nx_clipcheck_gate.nx

imports: nx_syscalls.nxnx_nxa.nxnx_clipcap_lib.nxnx_bvh_lib.nxnx_bvhfk_lib.nx

imported by: nx_clipcheck_gate.nx

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

main cc_puts sys_write cc_slen cc_streq 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 ↻ cc_scan_bvh sys_mmap ↻ sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_munmap sys_close cc_puts ↻ nxa_find nxa_section_entry nxa_magic nxa_check2 nxa_tag4 cc_axis_skel b_parse sys_mmap ↻ b_hierarchy sys_mmap ↻

structs

none

consts

39const CC_MAGIC_1000000: i64 = 1000000
40const CC_MAGIC_32767: i64 = 32767
41const CC_MAGIC_65536: i64 = 65536
42const CC_TOL_MM: i64 = 10 // verdict tolerance, mm; capsule GEOMETRY lives in nx_clipcap_lib

functions

44func cc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: cc_puts
45func cc_puts(s: *u8) -> i64 { sys_write(1, s, cc_slen(s)); return 0 }
46func cc_pn(v: i64) -> i64
59func cc_atoi(s: *u8) -> i64
called by 1: main
69func cc_streq(a: *u8, b: *u8) -> i64
called by 1: main
78func cc_sgn16(w: i64) -> i64
called by 2: cc_scan_nxacc_probe
88func cc_meas(px: i64, py: i64, pz: i64, j: i64, key: i64, AX: *i64, R: *i64) -> i64
called by 3: cc_scan_nxacc_scan_bvhmain calls 1: cc_pseg
104func cc_scan_nxa(path: *u8, R: *i64) -> i64
158func cc_scan_bvh(bpath: *u8, npath: *u8, upHint: i64, R: *i64) -> i64
355func cc_probe(path: *u8, pkey: i64, pjoint: i64) -> i64
417func main(argc: i64, argv: *i64) -> i64