code wiki / (root) / nx_handcheck.nx

nx_handcheck.nx

buildroot/runtime/nx_handcheck.nx

33646 B734 linesdepth 3pulls 4 transitivereach 1 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_handcheck.nx -- THE HAND STRUCTURE JUDGE over an NXA SKEL (operator 2026-09-01: "the hands are bad"). It is the SIBLING OF nx_footcheck and deliberately mirrors its contract -- check / selftest, one measured report, one predicate made of things a hand IS rather than a blended score -- because two judges for two ends of the same limb must not have two different shapes. WHY IT EXISTS: the hands were the ONE named character defect in this estate with NO instrument at all. nx_clipcheck measures limb-vs-torso and limb-vs-floor; nx_footcheck measures the distal foot; nothing measured a hand. Grading therefore depended entirely on the operator's eye. THE STRUCTURAL PROBLEM, AND WHY THIS IS NOT NAME MATCHING: NXA's SKEL carries NO JOINT NAMES, by design (nx_nxa_joints.nx states it and quotes nx_nxa_rig_emit: "SKEL carries no names by design"). So a hand cannot be looked up -- it must be DERIVED FROM TOPOLOGY. A hand is the only place on a humanoid where three or more TERMINAL SIMPLE CHAINS hang off one attachment. That is what this organ finds. Nothing here knows a joint index, so the judge keeps working when joints are added or reordered ahead of it -- the same structural stance nx_footcheck takes with its rotation. THE ANATOMICAL CANON IS CITED, NOT DIALLED. Buryanov and Kotiuk, "Proportions of Hand Segments", Int. J. Morphol. 28(3):755-758, 2010 (open access; mirror knowledge/fetched/cmp_handcheck_buryanov2010.pdf, sha256 ec2a49be..., 66 adult hands by X-ray with a radiopaque ruler and no scaling error). Their Table I lengths in mm, reconstructed and then INDEPENDENTLY CONFIRMED by their own Table II ratio row for every one of the five rays -- two instruments inside one document agreeing: ray distal medial proximal metacarpal Tab.II ratio (pd:pm:pp:m) I 21.67 -- 31.57 46.22 1 : -- : 1.5 : 2.1 II 15.82 22.38 39.78 68.12 1 : 1.4 : 2.5 : 4.3 III 17.40 26.33 44.63 64.60 1 : 1.5 : 2.6 : 3.7 IV 17.30 25.65 41.37 58.00 1 : 1.5 : 2.4 : 3.4 V 15.96 18.11 32.74 53.69 1 : 1.1 : 2.1 : 3.4 TWO LAWS FALL OUT OF THAT TABLE AND BOTH ARE ENFORCED HERE: (1) MONOTONIC DISTAL SHORTENING -- proximal > medial > distal holds in ALL FIVE rays without exception. It is dimensionless, so it survives any stylisation of hand size. It is the STRICT clause here and it needs no tolerance at all. (2) PHALANX COUNT -- four fingers carry THREE phalanges and the thumb carries TWO (the paper's medial column is empty for ray I, and its text names "even different phalanges numbers"). In a rig a chain of L joints spans L-1 bones, so a finger is a 4-joint chain and a thumb a 3-joint chain. DECLARED IMPRECISION -- name it or the next reader trusts it as exact: - v1 measures the BIND SKELETON. It does NOT read SKIN weights, so it cannot yet say whether the hand is a distinct skinned region or fused to the forearm; and it does NOT read POSE or ANIM, so

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_nxa.nx nx_gate_verdict.nx nx_handcheck.nx nx_handcheck_gate.nx

imports: nx_syscalls.nxnx_nxa.nxnx_gate_verdict.nx

imported by: nx_handcheck_gate.nx

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

main hc_streq hc_gate gv_ctr 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 ↻ gv_head gv_puts sys_write ↻ hc_teeth sys_mmap ↻ hc_fx_good sys_mmap ↻ hc_setj hc_measure sys_mmap ↻ hc_children hc_hub_digits hc_chain hc_only_child hc_chain ↻ hc_dist hc_isqrt hc_isqrt ↻ hc_fx_bad sys_mmap ↻ hc_setj ↻

structs

none

consts

62const HC_WPJ: i64 = 8 // SKEL record: [parent][x][y][z][qx][qy][qz][qw]
63const HC_MAXJ: i64 = 4096
64const HC_MAXD: i64 = 24 // digit chains tracked per hub
65const HC_MAXH: i64 = 8 // hubs tracked
66const HC_MAXCH: i64 = 24 // joints tracked per digit chain
67const HC_Q: i64 = 1000
68const HC_BIG: i64 = 1000000000
70const HC_MIN_CHAIN: i64 = 2
72const HC_MIN_HUB_DIGITS: i64 = 3
74const HC_DIGITS_CANON: i64 = 5
75const HC_FINGER_BONES: i64 = 3
76const HC_THUMB_BONES: i64 = 2
77const HC_MIN_3BONE: i64 = 4
82const HC_R_PPPM_MAX: i64 = 2600
83const HC_R_PMPD_MAX: i64 = 2600
86const HC_THUMB_OPP_MIN: i64 = 150
89const HC_FUSE_PERMIL: i64 = 100
92const HC_HAND_MIN_H01: i64 = 150
93const HC_OUT: i64 = 32
94const HC_NEWTON: i64 = 64
95const HC_SQRTCAP: i64 = 65536

functions

97func hc_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n }
called by 1: hc_puts
98func hc_puts(s: *u8) -> i64 { sys_write(1, s, hc_slen(s)); return 0 }
99func hc_pn(v: i64) -> i64
112func hc_streq(a: *u8, b: *u8) -> i64
called by 1: main
120func hc_isqrt(v: i64) -> i64
called by 2: hc_disthc_measure
134func hc_dist(W: *i64, sw: i64, a: i64, b: i64) -> i64
called by 1: hc_measure calls 1: hc_isqrt
145func hc_children(W: *i64, sw: i64, nj: i64, NC: *i64) -> i64
called by 2: hc_measurehc_dump
157func hc_only_child(W: *i64, sw: i64, nj: i64, j: i64) -> i64
called by 1: hc_chain
169func hc_chain(W: *i64, sw: i64, nj: i64, NC: *i64, d: i64, CH: *i64) -> i64
186func hc_hub_digits(W: *i64, sw: i64, nj: i64, NC: *i64, j: i64, CH: *i64) -> i64
called by 2: hc_measurehc_dump calls 1: hc_chain
206func hc_measure(W: *i64, sw: i64, nj: i64, out: *i64) -> i64
432func hc_ok(out: *i64) -> i64
441func hc_report(out: *i64) -> i64
called by 1: main calls 3: hc_putshc_pnhc_ok
470func hc_setj(W: *i64, sw: i64, j: i64, p: i64, x: i64, y: i64, z: i64) -> i64
485func hc_fx_good(nout: *i64) -> *i64
called by 1: hc_teeth calls 2: sys_mmaphc_setj
511func hc_fx_bad(nout: *i64) -> *i64
called by 1: hc_teeth calls 2: sys_mmaphc_setj
531func hc_fx_leg(nout: *i64) -> *i64
called by 1: hc_teeth calls 2: sys_mmaphc_setj
543func hc_fx_foot(nout: *i64) -> *i64
called by 1: hc_teeth calls 2: sys_mmaphc_setj
563func hc_dump(W: *i64, sw: i64, nj: i64) -> i64
588func hc_teeth(ctr: *i64) -> i64
677func hc_gate() -> i64
685func hc_load(path: *u8, lp: *i64, swp: *i64, njp: *i64) -> *u8
called by 1: main calls 3: sys_read_filenxa_findnxa_tag4
696func main(argc: i64, argv: *i64) -> i64