code wiki / (root) / nx_rigbench_lib_t21.nx

nx_rigbench_lib_t21.nx

buildroot/runtime/nx_rigbench_lib_t21.nx

25225 B535 linesdepth 5pulls 15 transitivereach 1 importersview sourcekind benchtopic rigbench
docsdependenciesstructsconstsfunctions

about

nx_rigbench_lib.nx -- LIB: THE REAL-CHARACTER REFEREE FOR THE AUTO-RIG (dcc DC16 rung M2): score the sovereign auto-rig against an ARTIST rig on the same mesh, in the artist's own units, with the artist's own pose. Three legs, each a number no story can replace: A. SKELETON -- the bare mesh (VERT+TRIS only) goes through nx_curveskel; every artist joint's distance to the nearest joint of ours is measured, and an artist joint counts as COVERED when one of ours lies within the artist rig's OWN mean bone length (derived from that rig, never picked). The reverse names our SPURIOUS joints (farther than a bone length from every artist joint). Our limb count is reported beside the artist's leaf count. B. WEIGHTS -- the artist SKELETON is held fixed and nx_boneheat re-weights the mesh (bh_run REPLACES the SKIN section in place and keeps every other section); per-vertex L1 between our four influences and the artist's, as a permil of the NXA weight scale, plus the fraction of vertices whose strongest joint agrees. C. DEFORMATION, the referee-grade number -- the artist's own POSE is played by the SERVED nx_nxa_play twice, once with the artist's weights and once with ours, and md_measure (the estate's one mesh ruler) judges the two posed skins against each other: max and p95 surface deviation. When the rig carries no POSE this leg ABSTAINS (exit 3) rather than acquits; A and B still print. UNITS: NXA 0.01 mm; md_measure reports 0.1 mm for a mesh fed in millimetres (measured 2026-09-06); the report says which. Usage: nx_rigbench <rigged.nxa> <workdir> [pose_id] [cells] Exits: 0 ok | 2 usage | 3 abstain | 4 refuse license_tier: ORIGINAL expect_exit: 0

dependencies 7 imports · 1 importers

nx_rigbench_motion_t21.nx nx_syscalls.nx nx_nxa.nx nx_curveskel_lib.nx nx_tool_run.nx nx_nxmesh_lib.nx nx_mmdev_lib.nx nx_rigbench_lib_t21.nx nx_rigbench_t21.nx

imports: nx_rigbench_motion_t21.nxnx_syscalls.nxnx_nxa.nxnx_curveskel_lib.nxnx_tool_run.nxnx_nxmesh_lib.nxnx_mmdev_lib.nx

imported by: nx_rigbench_t21.nx

structs

none

consts

26const RB_PLAY: *u8 = "/volume1/homes/elderwesto/nishihost/nx_nxa_play.elf"
27const RB_EXIT_OK: i64 = 0
28const RB_EXIT_USAGE: i64 = 2
29const RB_EXIT_ABSTAIN: i64 = 3
30const RB_EXIT_REFUSE: i64 = 4
31const RB_CELLS_DEFAULT: i64 = 96
32const RB_POSE_DEFAULT: i64 = 1
33const RB_W_PARENT: i64 = 0
34const RB_W_X: i64 = 1
35const RB_W_Y: i64 = 2
36const RB_W_Z: i64 = 3
37const RB_SKIN_WORDS: i64 = 8
38const RB_SKIN_INF: i64 = 4
39const RB_Q12: i64 = 4096
40const RB_PERMIL: i64 = 1000
41const RB_PATH_CAP: i64 = 4096
42const RB_ARGV_SLOTS: i64 = 8
43const RB_WORD_BYTES: i64 = 8
44const RB_CAPTURE_CAP: i64 = 65536
45const RB_NO_TIMEOUT: i64 = 0
46const RB_SLASH: i64 = 47
47const RB_WFULL: *u8 = "1000"
48const RB_NXA_PER_TENTH: i64 = 10 // NXA 0.01 mm -> NXMESH input tenths of a mm
49const RB_MAGIC: *u8 = "NXMSH2"
50const RB_MAGIC_LEN: i64 = 6
51const RB_MAGIC_FIELD: i64 = 8
52const RB_UMM_PER_MM: i64 = 100
53const RB_P95_NUM: i64 = 95
54const RB_P95_DEN: i64 = 100
249const RB_R_ART_JOINTS: i64 = 0
250const RB_R_ART_LEAVES: i64 = 1
251const RB_R_OUR_JOINTS: i64 = 2
252const RB_R_OUR_LIMBS: i64 = 3
253const RB_R_BONE_MEAN_UMM: i64 = 4
254const RB_R_COVERED_PERMIL: i64 = 5
255const RB_R_SPURIOUS_PERMIL: i64 = 6
256const RB_R_JOINT_ERR_MEAN_UMM: i64 = 7
257const RB_R_JOINT_ERR_MAX_UMM: i64 = 8
258const RB_R_VERTS: i64 = 9
259const RB_R_W_L1_MEAN_PERMIL: i64 = 10
260const RB_R_TOP1_MATCH_PERMIL: i64 = 11
261const RB_R_POSES: i64 = 12
262const RB_R_PLAY_A_RC: i64 = 13
263const RB_R_PLAY_O_RC: i64 = 14
264const RB_R_MD_MAX_0P1MM: i64 = 15
265const RB_R_MD_P95_0P1MM: i64 = 16
266const RB_R_MD_REFUSED: i64 = 17
267const RB_R_PLAY_A_MAXDISP_UMM: i64 = 18
268const RB_R_PLAY_O_MAXDISP_UMM: i64 = 19
269const RB_R_DEFORM_POSE: i64 = 22 // the pose rb_run auto-selected for the deformation leg, -1 when it abstained
270const RB_R_DEFORM_JOINTS: i64 = 23 // joints that pose moved on the ARTIST play (the non-vacuity witness the gate reads)
271const RB_R_MD_SCALE_DIV: i64 = 24 // the integer divisor rb_md_normalize applied before md_measure; 1 = no-op
272const RB_XYZ9_BYTES: i64 = 4096 // one page holds the nine coordinates nm_put_tri writes
273const RB_BBOX_BYTES: i64 = 4096 // one page holds a three-axis bound
274const RB_COORD_MAX: i64 = 1 << 62 // above any coordinate the ruler can hold: the bound's starting value
275const RB_R_ART_TOP1_DISTINCT: i64 = 20 // how many distinct joints the ARTIST skin uses as a strongest influence
276const RB_R_OUR_TOP1_DISTINCT: i64 = 21 // ...and how many OURS uses: the instrument for the helper-joint hypothesis
277const RB_R_WORDS: i64 = 25

functions

56func rbw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 }
57func rbn(v: i64) -> i64
called by 1: rb_kv calls 2: sys_mmapsys_write
70func rb_kv(k: *u8, v: i64) -> i64 { rbw(k); rbn(v); rbw("\n" as *u8); return 0 }
71func rb_atoi(s: *u8) -> i64
called by 1: main
77func rb_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v }
called by 1: rb_skin_l1
79func rb_itoa(out: *u8, v: i64) -> i64
called by 1: rb_run
89func rb_after(buf: *u8, n: i64, key: *u8) -> i64
called by 1: rb_run
110func rb_join(dir: *u8, name: *u8) -> *u8
called by 1: rb_run calls 1: sys_mmap
120func rb_dirname(path: *u8, out: *u8) -> i64
called by 1: rb_play
131func rb_write_bare(b: *u8, flen: i64, outp: *u8) -> i64
144func rb_jw(w: *i64, swo: i64, j: i64, word: i64) -> i64 { return w[swo + 1 + j * CS_JOINT_WORDS + word] }
145func rb_dist(w1: *i64, s1: i64, j1: i64, w2: *i64, s2: i64, j2: i64) -> i64
called by 2: rb_mean_bonerb_run calls 1: rb_jw
152func rb_mean_bone(w: *i64, swo: i64, nj: i64) -> i64
called by 1: rb_run calls 2: rb_jwrb_dist
164func rb_leaves(w: *i64, swo: i64, nj: i64) -> i64
called by 1: rb_run calls 2: sys_mmaprb_jw
176func rb_play(inp: *u8, pose: *u8, outp: *u8, cap: *u8, olen: *i64) -> i64
185func rb_nxmesh(b: *u8, flen: i64) -> *u8
217func rb_skin_l1(wa: *i64, ka: i64, wo: *i64, ko: i64, v: i64, nj: i64, dense: *i64) -> i64
called by 1: rb_run calls 1: rb_abs
239func rb_top1(w: *i64, ko: i64, v: i64) -> i64
called by 1: rb_run
279func rb_run(rigged: *u8, workdir: *u8, pose_id: i64, cells: i64, rep: *i64) -> i64
455func rb_md_extent(m: *u8, lo: *i64, hi: *i64) -> i64
475func rb_md_scale(m: *u8, kdiv: i64) -> i64
493func rb_md_normalize(mA: *u8, mO: *u8) -> i64
511func rb_report(rep: *i64) -> i64
called by 1: main calls 1: rb_kv