nx_rigbench_lib_t21.nx
buildroot/runtime/nx_rigbench_lib_t21.nx
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
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
| 26 | const RB_PLAY: *u8 = "/volume1/homes/elderwesto/nishihost/nx_nxa_play.elf" |
| 27 | const RB_EXIT_OK: i64 = 0 |
| 28 | const RB_EXIT_USAGE: i64 = 2 |
| 29 | const RB_EXIT_ABSTAIN: i64 = 3 |
| 30 | const RB_EXIT_REFUSE: i64 = 4 |
| 31 | const RB_CELLS_DEFAULT: i64 = 96 |
| 32 | const RB_POSE_DEFAULT: i64 = 1 |
| 33 | const RB_W_PARENT: i64 = 0 |
| 34 | const RB_W_X: i64 = 1 |
| 35 | const RB_W_Y: i64 = 2 |
| 36 | const RB_W_Z: i64 = 3 |
| 37 | const RB_SKIN_WORDS: i64 = 8 |
| 38 | const RB_SKIN_INF: i64 = 4 |
| 39 | const RB_Q12: i64 = 4096 |
| 40 | const RB_PERMIL: i64 = 1000 |
| 41 | const RB_PATH_CAP: i64 = 4096 |
| 42 | const RB_ARGV_SLOTS: i64 = 8 |
| 43 | const RB_WORD_BYTES: i64 = 8 |
| 44 | const RB_CAPTURE_CAP: i64 = 65536 |
| 45 | const RB_NO_TIMEOUT: i64 = 0 |
| 46 | const RB_SLASH: i64 = 47 |
| 47 | const RB_WFULL: *u8 = "1000" |
| 48 | const RB_NXA_PER_TENTH: i64 = 10 // NXA 0.01 mm -> NXMESH input tenths of a mm |
| 49 | const RB_MAGIC: *u8 = "NXMSH2" |
| 50 | const RB_MAGIC_LEN: i64 = 6 |
| 51 | const RB_MAGIC_FIELD: i64 = 8 |
| 52 | const RB_UMM_PER_MM: i64 = 100 |
| 53 | const RB_P95_NUM: i64 = 95 |
| 54 | const RB_P95_DEN: i64 = 100 |
| 249 | const RB_R_ART_JOINTS: i64 = 0 |
| 250 | const RB_R_ART_LEAVES: i64 = 1 |
| 251 | const RB_R_OUR_JOINTS: i64 = 2 |
| 252 | const RB_R_OUR_LIMBS: i64 = 3 |
| 253 | const RB_R_BONE_MEAN_UMM: i64 = 4 |
| 254 | const RB_R_COVERED_PERMIL: i64 = 5 |
| 255 | const RB_R_SPURIOUS_PERMIL: i64 = 6 |
| 256 | const RB_R_JOINT_ERR_MEAN_UMM: i64 = 7 |
| 257 | const RB_R_JOINT_ERR_MAX_UMM: i64 = 8 |
| 258 | const RB_R_VERTS: i64 = 9 |
| 259 | const RB_R_W_L1_MEAN_PERMIL: i64 = 10 |
| 260 | const RB_R_TOP1_MATCH_PERMIL: i64 = 11 |
| 261 | const RB_R_POSES: i64 = 12 |
| 262 | const RB_R_PLAY_A_RC: i64 = 13 |
| 263 | const RB_R_PLAY_O_RC: i64 = 14 |
| 264 | const RB_R_MD_MAX_0P1MM: i64 = 15 |
| 265 | const RB_R_MD_P95_0P1MM: i64 = 16 |
| 266 | const RB_R_MD_REFUSED: i64 = 17 |
| 267 | const RB_R_PLAY_A_MAXDISP_UMM: i64 = 18 |
| 268 | const RB_R_PLAY_O_MAXDISP_UMM: i64 = 19 |
| 269 | const RB_R_DEFORM_POSE: i64 = 22 // the pose rb_run auto-selected for the deformation leg, -1 when it abstained |
| 270 | const RB_R_DEFORM_JOINTS: i64 = 23 // joints that pose moved on the ARTIST play (the non-vacuity witness the gate reads) |
| 271 | const RB_R_MD_SCALE_DIV: i64 = 24 // the integer divisor rb_md_normalize applied before md_measure; 1 = no-op |
| 272 | const RB_XYZ9_BYTES: i64 = 4096 // one page holds the nine coordinates nm_put_tri writes |
| 273 | const RB_BBOX_BYTES: i64 = 4096 // one page holds a three-axis bound |
| 274 | const RB_COORD_MAX: i64 = 1 << 62 // above any coordinate the ruler can hold: the bound's starting value |
| 275 | const RB_R_ART_TOP1_DISTINCT: i64 = 20 // how many distinct joints the ARTIST skin uses as a strongest influence |
| 276 | const RB_R_OUR_TOP1_DISTINCT: i64 = 21 // ...and how many OURS uses: the instrument for the helper-joint hypothesis |
| 277 | const RB_R_WORDS: i64 = 25 |
functions
| 56 | func rbw(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } sys_write(1, s, n); return 0 } |
| 57 | func rbn(v: i64) -> i64 |
| 70 | func rb_kv(k: *u8, v: i64) -> i64 { rbw(k); rbn(v); rbw("\n" as *u8); return 0 } |
| 71 | func rb_atoi(s: *u8) -> i64 called by 1: main |
| 77 | func rb_abs(v: i64) -> i64 { if v < 0 { return 0 - v } return v } called by 1: rb_skin_l1 |
| 79 | func rb_itoa(out: *u8, v: i64) -> i64 called by 1: rb_run |
| 89 | func rb_after(buf: *u8, n: i64, key: *u8) -> i64 called by 1: rb_run |
| 110 | func rb_join(dir: *u8, name: *u8) -> *u8 |
| 120 | func rb_dirname(path: *u8, out: *u8) -> i64 called by 1: rb_play |
| 131 | func rb_write_bare(b: *u8, flen: i64, outp: *u8) -> i64 |
| 144 | func rb_jw(w: *i64, swo: i64, j: i64, word: i64) -> i64 { return w[swo + 1 + j * CS_JOINT_WORDS + word] } |
| 145 | func rb_dist(w1: *i64, s1: i64, j1: i64, w2: *i64, s2: i64, j2: i64) -> i64 |
| 152 | func rb_mean_bone(w: *i64, swo: i64, nj: i64) -> i64 |
| 164 | func rb_leaves(w: *i64, swo: i64, nj: i64) -> i64 |
| 176 | func rb_play(inp: *u8, pose: *u8, outp: *u8, cap: *u8, olen: *i64) -> i64 |
| 185 | func rb_nxmesh(b: *u8, flen: i64) -> *u8 |
| 217 | func rb_skin_l1(wa: *i64, ka: i64, wo: *i64, ko: i64, v: i64, nj: i64, dense: *i64) -> i64 |
| 239 | func rb_top1(w: *i64, ko: i64, v: i64) -> i64 called by 1: rb_run |
| 279 | func rb_run(rigged: *u8, workdir: *u8, pose_id: i64, cells: i64, rep: *i64) -> i64 |
| 455 | func rb_md_extent(m: *u8, lo: *i64, hi: *i64) -> i64 |
| 475 | func rb_md_scale(m: *u8, kdiv: i64) -> i64 |
| 493 | func rb_md_normalize(mA: *u8, mO: *u8) -> i64 |
| 511 | func rb_report(rep: *i64) -> i64 |