code wiki / (root) / nx_autorig_creature_gate.nx

nx_autorig_creature_gate.nx source

↩ module page · 425 lines · 26123 B

1// nx_autorig_creature_gate.nx -- THE ARCHETYPE-FREE PROOF: the SAME one-call auto-rig, with NO hint, rigs a dragon- 2// like quadruped (body + 4 legs + tail + neck) AND a biped (torso + 2 legs + 2 arms + head) and finds each one's 3// limb topology from the VOLUME alone. This is the Infinigen-style everything-is-math requirement (operator 4// 2026-09-05: "quickly auto rig a dragon vs a human vs whatever"): no humanoid template, no archetype flag, no 5// learned model -- a medial-radius field and farthest-point peeling read the creature's own geometry. 6// FIXTURES are watertight CSG unions of boxes through nx_csg_scene (N-ary fold, marching tetrahedra), because 7// two overlapping CLOSED meshes carry internal walls that split the interior (banked lesson from the T fixture); 8// an SDF union has none. Every expected number below is DERIVED from the fixture's own construction (a body 9// built with six appendages must peel six limbs; a leg built to z=-36 mm must be reached below -30 mm), never 10// a magic bar. The anti-vacuity tooth is that the two counts DIFFER: a skeletoniser returning a constant 11// would pass every per-fixture tooth and fail that one. 12// MEASURED (2026-09-05/06): the dragon peeled exactly 6 on every run. The first biped peeled 7, not 5, and TWO stories 13// were refuted by instruments before the third was read off one: not the shoulder ledges (a flush head also gave 7), not 14// the torso corners (the peel arithmetic puts them 1-3 cells inside the claimed cubes) -- the LEAF readout showed the 15// left leg peeled three times down one corner column while the right leg peeled once, and the only asymmetry between 16// two mirrored legs was the plane x=0 they shared (see BP_LEG_X below). A derived count must be derived from the union's 17// real geometry, and a fixture must carry no degenerate shared plane; the shouldered variant stays as a MONOTONE tooth. 18// license_tier: ORIGINAL expect_exit: 0 19import "nx_syscalls.nx" 20import "nx_gate_verdict.nx" 21import "nx_nxa.nx" 22import "nx_csg_scene.nx" 23import "nx_autorig_mesh.nx" 24 25const CT_DIR: *u8 = "/tmp/nx_autorig_creature_gate" 26const CT_MODE_DIR: i64 = 493 27const CT_MM_Q14: i64 = 16384 // SDF unit: 1 mm = 16384 (Q14) 28const CT_NXA_PER_MM: i64 = 100 // NXA unit: 0.01 mm 29const CT_RES: i64 = 56 // marching grid per axis; ~2 mm cells over the fixture boxes 30const CT_CELLS: i64 = 96 // bone-heat/curveskel voxel grid along the longest axis (the conf default) 31const CT_SCENE_CAP: i64 = 8 32const CT_SKIN_SUM: i64 = 4096 33// SKEL row words after the row's parent word, and the reach-test vocabulary -- named so no reader parses a bare digit 34const CT_W_PARENT: i64 = 0 35const CT_W_X: i64 = 1 36const CT_W_Y: i64 = 2 37const CT_W_Z: i64 = 3 38const CT_ABOVE: i64 = 1 // ct_reach2 direction: the joint must lie ABOVE the bar 39const CT_BELOW: i64 = 0 - 1 // ...or BELOW it 40const CT_NO_BAR: i64 = 0 - 10000 // a bar below every coordinate in these fixtures: the paired condition always holds 41const CT_QUAD_X_ONLY: i64 = 0 // ct_leg_quadrants: split by the sign of x only (a biped's two legs) 42const CT_QUAD_XY: i64 = 1 // ...or by the signs of x and y (a quadruped's four legs) 43const CT_QUAD_X_BIT: i64 = 1 // the x sign contributes bit 0 of the quadrant index, the y sign bit 1 44const CT_QUAD_Y_BIT: i64 = 2 45// DRAGON-like: body 60x26x26 mm at the origin; four legs 10 mm square hanging to z=-36; tail along -x to -64; neck up to z=30 46const DR_BODY_HX: i64 = 30 47const DR_BODY_HY: i64 = 13 48const DR_BODY_HZ: i64 = 13 49const DR_LEG_H: i64 = 5 50const DR_LEG_HZ: i64 = 14 51const DR_LEG_X: i64 = 18 52const DR_LEG_Y: i64 = 8 53const DR_LEG_CZ: i64 = 0 - 22 // spans z -36..-8: overlaps the body bottom (z=-13) by 5 mm 54const DR_TAIL_CX: i64 = 0 - 46 // spans x -64..-28: overlaps the body end (x=-30) by 2 mm 55const DR_TAIL_HX: i64 = 18 56const DR_TAIL_H: i64 = 5 57const DR_TAIL_CZ: i64 = 4 58const DR_NECK_CX: i64 = 32 // spans x 27..37, z 6..30: overlaps the body corner region 59const DR_NECK_H: i64 = 5 60const DR_NECK_CZ: i64 = 18 61const DR_NECK_HZ: i64 = 12 62const DR_LO_X: i64 = 0 - 70 63const DR_LO_Y: i64 = 0 - 20 64const DR_LO_Z: i64 = 0 - 42 65const DR_HI_X: i64 = 44 66const DR_HI_Y: i64 = 20 67const DR_HI_Z: i64 = 36 68const DR_LIMBS: i64 = 6 // DERIVED: four legs + tail + neck were built 69const DR_LEGS: i64 = 4 // DERIVED: four legs were built, one per (x,y) sign-quadrant 70const DR_LEG_REACH_Z: i64 = 0 - 3000 // a leg built to -36 mm must carry a joint below -30 mm (0.01 mm units) 71const DR_TAIL_REACH_X: i64 = 0 - 5500 // a tail built to -64 mm must carry a joint beyond -55 mm 72const DR_NECK_REACH_Z: i64 = 2400 // a neck built to +30 mm must carry a joint above +24 mm 73const DR_NECK_MIN_X: i64 = 2000 // ...and only the neck lives at x > 20 mm above the body top 74// BIPED: torso 18x14x40 mm; two legs 10 mm square to z=-54; two arms out along +-x to |x|=34 (T-pose); head to z=31 75const BP_TORSO_HX: i64 = 9 76const BP_TORSO_HY: i64 = 7 77const BP_TORSO_HZ: i64 = 20 78// LEGS SEPARATED BY A 4 mm GAP, NEVER TOUCHING. MEASURED 2026-09-06 by the leaf readout: with the two leg boxes sharing 79// the plane x=0, the RIGHT leg peeled once (its foot) while the LEFT leg peeled THREE times down one corner column 80// (leaves at z=-51, -35, -25) -- 7 limbs, identical with or without shoulder ledges. Two adjacent boxes in an SDF union 81// put a zero-field plane exactly on a grid plane; the marcher emits a one-sided internal wall there and one limb's 82// first peel under-claims its cross-section. The dragon's legs never touch and peeled cleanly. A fixture must not 83// carry a degenerate shared plane; the peeler's robustness to touching limbs is a named rung on this board. 84const BP_LEG_H: i64 = 4 85const BP_LEG_HZ: i64 = 18 86const BP_LEG_X: i64 = 6 87const BP_LEG_CZ: i64 = 0 - 36 // spans z -54..-18: overlaps the torso bottom (z=-20) by 2 mm 88const BP_ARM_CX: i64 = 20 // spans x 6..34: overlaps the torso side (x=9) by 3 mm 89const BP_ARM_HX: i64 = 14 90const BP_ARM_H: i64 = 4 91const BP_ARM_CZ: i64 = 14 92const BP_HEAD_HX: i64 = 9 // FLUSH with the torso in x and y: the construction then has exactly five protrusions 93const BP_HEAD_HY: i64 = 7 94const BP_HEAD_HZ: i64 = 6 95const BP_HEAD_CZ: i64 = 25 // spans z 19..31: overlaps the torso top (z=20) by 1 mm 96// SHOULDERED variant: a 12 mm head on the 18 mm torso leaves two 3 mm shoulder ledges outboard of the head. MEASURED 97// 2026-09-05 on the first run: the peeler found them as two extra limbs (7, not 5) -- the torso is only 14 mm deep, so the 98// root radius is 6 mm and a ledge 7 mm from the arm axis is a protrusion by the volume's own arithmetic. That is the 99// clavicle, not a defect, and the tooth for it is MONOTONE (more protrusions never yield fewer limbs), never a count. 100const BS_HEAD_H: i64 = 6 101const BP_LO_X: i64 = 0 - 40 102const BP_LO_Y: i64 = 0 - 14 103const BP_LO_Z: i64 = 0 - 60 104const BP_HI_X: i64 = 40 105const BP_HI_Y: i64 = 14 106const BP_HI_Z: i64 = 37 107const BP_LIMBS: i64 = 5 // DERIVED: two legs + two arms + a flush head column were built 108const BP_SIDES: i64 = 2 // DERIVED: one leg and one arm per side 109const BP_LEG_REACH_Z: i64 = 0 - 4500 // legs built to -54 mm must carry a joint below -45 mm 110const BP_ARM_REACH_X: i64 = 2800 // arms built to |x|=34 mm must carry a joint beyond |x|=28 mm 111const BP_ARM_MIN_Z: i64 = 500 // ...above z=5 mm, which excludes the legs 112const BP_HEAD_REACH_Z: i64 = 2500 // a head built to +31 mm must carry a joint above +25 mm 113 114func ctw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } 115func ct_box(s: *NxCsgScene, cx: i64, cy: i64, cz: i64, hx: i64, hy: i64, hz: i64) -> i64 { 116 let p: *NxSdfPrim = nx_sdf_make(NX_SDF_BOX, cx * CT_MM_Q14, cy * CT_MM_Q14, cz * CT_MM_Q14, hx * CT_MM_Q14, hy * CT_MM_Q14, hz * CT_MM_Q14) 117 return nx_csg_scene_add(s, p, NX_CSG_UNION, 0) 118} 119// extract a scene over its box and write it as an NXA (VERT + TRIS, 0.01 mm); out[0]=nv out[1]=nt; returns bytes 120func ct_write_scene(s: *NxCsgScene, lox: i64, loy: i64, loz: i64, hix: i64, hiy: i64, hiz: i64, path: *u8, out: *i64) -> i64 { 121 let m: *NxMesh = nx_csg_extract_scene(s, lox * CT_MM_Q14, loy * CT_MM_Q14, loz * CT_MM_Q14, hix * CT_MM_Q14, hiy * CT_MM_Q14, hiz * CT_MM_Q14, CT_RES) 122 let nv: i64 = m.n_verts as i64 123 let nt: i64 = m.n_tris as i64 124 out[0] = nv; out[1] = nt 125 if nv < 1 { return 0 - 1 } 126 if nt < 1 { return 0 - 1 } 127 let vert: *i64 = sys_mmap((1 + nv * 3) * 8 + 64) as *i64 128 let tris: *i64 = sys_mmap((1 + nt * 3) * 8 + 64) as *i64 129 vert[0] = nv; tris[0] = nt 130 var i: i64 = 0 131 while i < nv { 132 vert[1 + i*3] = m.verts[i*4] * CT_NXA_PER_MM / CT_MM_Q14 133 vert[1 + i*3 + 1] = m.verts[i*4 + 1] * CT_NXA_PER_MM / CT_MM_Q14 134 vert[1 + i*3 + 2] = m.verts[i*4 + 2] * CT_NXA_PER_MM / CT_MM_Q14 135 i = i + 1 136 } 137 var t: i64 = 0 138 while t < nt { 139 tris[1 + t*3] = m.indices[t*3]; tris[1 + t*3 + 1] = m.indices[t*3 + 1]; tris[1 + t*3 + 2] = m.indices[t*3 + 2] 140 t = t + 1 141 } 142 let tags: *i64 = sys_mmap(64) as *i64 143 let ptrs: *i64 = sys_mmap(64) as *i64 144 let wls: *i64 = sys_mmap(64) as *i64 145 tags[0] = nxa_tag4("VERT" as *u8); ptrs[0] = vert as i64; wls[0] = 1 + nv*3 146 tags[1] = nxa_tag4("TRIS" as *u8); ptrs[1] = tris as i64; wls[1] = 1 + nt*3 147 return bh_nxa_write(path, 2, tags, ptrs, wls) 148} 149func ct_dragon(path: *u8, out: *i64) -> i64 { 150 let s: *NxCsgScene = nx_csg_scene_new(CT_SCENE_CAP) 151 ct_box(s, 0, 0, 0, DR_BODY_HX, DR_BODY_HY, DR_BODY_HZ) 152 ct_box(s, DR_LEG_X, DR_LEG_Y, DR_LEG_CZ, DR_LEG_H, DR_LEG_H, DR_LEG_HZ) 153 ct_box(s, DR_LEG_X, 0 - DR_LEG_Y, DR_LEG_CZ, DR_LEG_H, DR_LEG_H, DR_LEG_HZ) 154 ct_box(s, 0 - DR_LEG_X, DR_LEG_Y, DR_LEG_CZ, DR_LEG_H, DR_LEG_H, DR_LEG_HZ) 155 ct_box(s, 0 - DR_LEG_X, 0 - DR_LEG_Y, DR_LEG_CZ, DR_LEG_H, DR_LEG_H, DR_LEG_HZ) 156 ct_box(s, DR_TAIL_CX, 0, DR_TAIL_CZ, DR_TAIL_HX, DR_TAIL_H, DR_TAIL_H) 157 ct_box(s, DR_NECK_CX, 0, DR_NECK_CZ, DR_NECK_H, DR_NECK_H, DR_NECK_HZ) 158 return ct_write_scene(s, DR_LO_X, DR_LO_Y, DR_LO_Z, DR_HI_X, DR_HI_Y, DR_HI_Z, path, out) 159} 160// the biped body without its head; the two variants differ only in the head box they add 161func ct_biped_body(s: *NxCsgScene) -> i64 { 162 ct_box(s, 0, 0, 0, BP_TORSO_HX, BP_TORSO_HY, BP_TORSO_HZ) 163 ct_box(s, BP_LEG_X, 0, BP_LEG_CZ, BP_LEG_H, BP_LEG_H, BP_LEG_HZ) 164 ct_box(s, 0 - BP_LEG_X, 0, BP_LEG_CZ, BP_LEG_H, BP_LEG_H, BP_LEG_HZ) 165 ct_box(s, BP_ARM_CX, 0, BP_ARM_CZ, BP_ARM_HX, BP_ARM_H, BP_ARM_H) 166 ct_box(s, 0 - BP_ARM_CX, 0, BP_ARM_CZ, BP_ARM_HX, BP_ARM_H, BP_ARM_H) 167 return 0 168} 169func ct_biped(path: *u8, out: *i64) -> i64 { 170 let s: *NxCsgScene = nx_csg_scene_new(CT_SCENE_CAP) 171 ct_biped_body(s) 172 ct_box(s, 0, 0, BP_HEAD_CZ, BP_HEAD_HX, BP_HEAD_HY, BP_HEAD_HZ) 173 return ct_write_scene(s, BP_LO_X, BP_LO_Y, BP_LO_Z, BP_HI_X, BP_HI_Y, BP_HI_Z, path, out) 174} 175func ct_biped_shouldered(path: *u8, out: *i64) -> i64 { 176 let s: *NxCsgScene = nx_csg_scene_new(CT_SCENE_CAP) 177 ct_biped_body(s) 178 ct_box(s, 0, 0, BP_HEAD_CZ, BS_HEAD_H, BS_HEAD_H, BS_HEAD_H) 179 return ct_write_scene(s, BP_LO_X, BP_LO_Y, BP_LO_Z, BP_HI_X, BP_HI_Y, BP_HI_Z, path, out) 180} 181// TOUCHING-LEGS variant, kept as the NEG-CONTROL for the touching-limbs rung: two 10 mm legs sharing the plane x=0, 182// exactly the construction that peeled 7 on 2026-09-06. Real characters have touching limbs everywhere (thighs, 183// fingers, an arm against a torso), so this is the fixture the peeler must pass, never a curiosity to design around. 184const BT_LEG_H: i64 = 5 185const BT_LEG_X: i64 = 5 186func ct_biped_touching(path: *u8, out: *i64) -> i64 { 187 let s: *NxCsgScene = nx_csg_scene_new(CT_SCENE_CAP) 188 ct_box(s, 0, 0, 0, BP_TORSO_HX, BP_TORSO_HY, BP_TORSO_HZ) 189 ct_box(s, BT_LEG_X, 0, BP_LEG_CZ, BT_LEG_H, BT_LEG_H, BP_LEG_HZ) 190 ct_box(s, 0 - BT_LEG_X, 0, BP_LEG_CZ, BT_LEG_H, BT_LEG_H, BP_LEG_HZ) 191 ct_box(s, BP_ARM_CX, 0, BP_ARM_CZ, BP_ARM_HX, BP_ARM_H, BP_ARM_H) 192 ct_box(s, 0 - BP_ARM_CX, 0, BP_ARM_CZ, BP_ARM_HX, BP_ARM_H, BP_ARM_H) 193 ct_box(s, 0, 0, BP_HEAD_CZ, BP_HEAD_HX, BP_HEAD_HY, BP_HEAD_HZ) 194 return ct_write_scene(s, BP_LO_X, BP_LO_Y, BP_LO_Z, BP_HI_X, BP_HI_Y, BP_HI_Z, path, out) 195} 196func ct_open(path: *u8, lp: *i64) -> i64 { 197 let b: *u8 = sys_read_file(path, lp) 198 if (b as i64) == 0 { return 0 } 199 return b as i64 200} 201func ct_nj(b: *u8, flen: i64) -> i64 { 202 let o: i64 = nxa_find(b, flen, nxa_tag4("SKEL" as *u8)) 203 if o < 0 { return 0 - 1 } 204 let w: *i64 = b as *i64 205 return w[o] 206} 207func ct_jw(b: *u8, flen: i64, j: i64, word: i64) -> i64 { 208 let o: i64 = nxa_find(b, flen, nxa_tag4("SKEL" as *u8)) 209 let w: *i64 = b as *i64 210 return w[o + 1 + j * CS_JOINT_WORDS + word] 211} 212// count the sign-quadrants (x,y) that hold at least one joint with z below zbar: 1..4 213func ct_leg_quadrants(b: *u8, flen: i64, zbar: i64, use_y: i64) -> i64 { 214 let nj: i64 = ct_nj(b, flen) 215 let q: *i64 = sys_mmap(64) as *i64 216 q[0] = 0; q[1] = 0; q[2] = 0; q[3] = 0 217 var j: i64 = 0 218 while j < nj { 219 if ct_jw(b, flen, j, CT_W_Z) < zbar { 220 var idx: i64 = 0 221 if ct_jw(b, flen, j, CT_W_X) < 0 { idx = idx + CT_QUAD_X_BIT } 222 if use_y == CT_QUAD_XY { if ct_jw(b, flen, j, CT_W_Y) < 0 { idx = idx + CT_QUAD_Y_BIT } } 223 q[idx] = 1 224 } 225 j = j + 1 226 } 227 return q[0] + q[1] + q[2] + q[3] 228} 229// does any joint satisfy: word-a compared against bar-a (dir CT_BELOW / CT_ABOVE) AND word-b against bar-b 230func ct_reach2(b: *u8, flen: i64, wa: i64, bara: i64, dira: i64, wb: i64, barb: i64, dirb: i64) -> i64 { 231 let nj: i64 = ct_nj(b, flen) 232 var j: i64 = 0 233 while j < nj { 234 let va: i64 = ct_jw(b, flen, j, wa) 235 let vb: i64 = ct_jw(b, flen, j, wb) 236 var oka: i64 = 0 237 var okb: i64 = 0 238 if dira < 0 { if va < bara { oka = 1 } } else { if va > bara { oka = 1 } } 239 if dirb < 0 { if vb < barb { okb = 1 } } else { if vb > barb { okb = 1 } } 240 if oka == 1 { if okb == 1 { return 1 } } 241 j = j + 1 242 } 243 return 0 244} 245// arms: any joint with |x| beyond bar and z above zmin 246func ct_arm_sides(b: *u8, flen: i64, xbar: i64, zmin: i64) -> i64 { 247 let nj: i64 = ct_nj(b, flen) 248 var l: i64 = 0 249 var r: i64 = 0 250 var j: i64 = 0 251 while j < nj { 252 let x: i64 = ct_jw(b, flen, j, CT_W_X) 253 let z: i64 = ct_jw(b, flen, j, CT_W_Z) 254 if z > zmin { 255 if x > xbar { r = 1 } 256 if x < 0 - xbar { l = 1 } 257 } 258 j = j + 1 259 } 260 return l + r 261} 262func ct_skin_badsum(b: *u8, flen: i64) -> i64 { 263 let w: *i64 = b as *i64 264 let kwo: i64 = nxa_find(b, flen, nxa_tag4("SKIN" as *u8)) 265 let vwo: i64 = nxa_find(b, flen, nxa_tag4("VERT" as *u8)) 266 if kwo < 0 { return 0 - 1 } 267 if vwo < 0 { return 0 - 1 } 268 let nv: i64 = w[vwo] 269 var bad: i64 = 0 270 var i: i64 = 0 271 while i < nv { 272 let ko: i64 = kwo + 1 + i*8 273 if w[ko+4] + w[ko+5] + w[ko+6] + w[ko+7] != CT_SKIN_SUM { bad = bad + 1 } 274 i = i + 1 275 } 276 return bad 277} 278 279// print every LEAF joint (a joint no other joint names as parent) in whole mm -- where each peeled limb ENDS. This is 280// the instrument: a limb count says how many, only the leaves say where, and a wrong count guessed from a story is 281// exactly the defect an instrument exists to prevent. Returns the leaf count (each limb ends in one leaf). 282func ct_leaves(b: *u8, flen: i64, tag: *u8) -> i64 { 283 let nj: i64 = ct_nj(b, flen) 284 if nj < 1 { return 0 } 285 let isp: *i64 = sys_mmap(nj * 8 + 64) as *i64 286 var j: i64 = 0 287 while j < nj { isp[j] = 0; j = j + 1 } 288 j = 0 289 while j < nj { let p: i64 = ct_jw(b, flen, j, CT_W_PARENT); if p >= 0 { if p < nj { isp[p] = 1 } } j = j + 1 } 290 ctw(" LEAVES " as *u8); ctw(tag); ctw(" (mm):" as *u8) 291 var n: i64 = 0 292 j = 0 293 while j < nj { 294 if isp[j] == 0 { 295 ctw(" j" as *u8); gv_num(j); ctw("=(" as *u8); gv_num(ct_jw(b, flen, j, CT_W_X) / CT_NXA_PER_MM); ctw("," as *u8); gv_num(ct_jw(b, flen, j, CT_W_Y) / CT_NXA_PER_MM); ctw("," as *u8); gv_num(ct_jw(b, flen, j, CT_W_Z) / CT_NXA_PER_MM); ctw(")" as *u8) 296 n = n + 1 297 } 298 j = j + 1 299 } 300 ctw(" leaves=" as *u8); gv_num(n); ctw("\n" as *u8) 301 return n 302} 303 304func main() -> i64 { 305 let ctr: *i64 = gv_ctr() 306 gv_head("nx_autorig_creature_gate -- the same one-call auto-rig, with no hint, rigs a dragon-like quadruped and a biped from their volumes alone: each peels the limb count it was built with, every limb tip is reached by a joint, both skins are sound, the two topologies differ, and adding shoulder ledges to the biped adds limbs, never removes them" as *u8) 307 sys_mkdir(CT_DIR, CT_MODE_DIR) 308 let mo: *i64 = sys_mmap(32) as *i64 309 let crep: *i64 = sys_mmap(CR_WORDS*8) as *i64 310 let brep: *i64 = sys_mmap(BR_WORDS*8) as *i64 311 let lp: *i64 = sys_mmap(16) as *i64 312 let p_dr: *u8 = "/tmp/nx_autorig_creature_gate/dragon.nxa" 313 let p_drS: *u8 = "/tmp/nx_autorig_creature_gate/dragon_skel.nxa" 314 let p_drK: *u8 = "/tmp/nx_autorig_creature_gate/dragon_skinned.nxa" 315 let p_bp: *u8 = "/tmp/nx_autorig_creature_gate/biped.nxa" 316 let p_bpS: *u8 = "/tmp/nx_autorig_creature_gate/biped_skel.nxa" 317 let p_bpK: *u8 = "/tmp/nx_autorig_creature_gate/biped_skinned.nxa" 318 let p_bs: *u8 = "/tmp/nx_autorig_creature_gate/biped_shouldered.nxa" 319 let p_bsS: *u8 = "/tmp/nx_autorig_creature_gate/biped_shouldered_skel.nxa" 320 let p_bsK: *u8 = "/tmp/nx_autorig_creature_gate/biped_shouldered_skinned.nxa" 321 322 // ---- DRAGON-like ---- 323 let wdr: i64 = ct_dragon(p_dr, mo) 324 let drNv: i64 = mo[0] 325 let drNt: i64 = mo[1] 326 let rcDr: i64 = amesh_run(p_dr, p_drS, p_drK, CT_CELLS, crep, brep) 327 cs_report(crep, p_dr, p_drS) 328 let drLimbs: i64 = crep[CR_LIMBS] 329 let drJoints: i64 = crep[CR_JOINTS] 330 let drBranches: i64 = crep[CR_BRANCHES] 331 let drMixed: i64 = brep[BR_MIXED] 332 let bdr: i64 = ct_open(p_drK, lp) 333 let fdr: i64 = lp[0] 334 ct_leaves(bdr as *u8, fdr, "dragon" as *u8) 335 gv_check("T1 dragon fixture-reached-the-condition: the seven-box CSG union meshed watertight (verts and tris present) and the one-call auto-rig returned OK on it with no archetype hint" as *u8, ((wdr > 0) as i64) * ((drNv > 0) as i64) * ((drNt > 0) as i64) * ((rcDr == AM_EXIT_OK) as i64) * ((bdr != 0) as i64), ctr) 336 gv_check_eq("T2 dragon TOPOLOGY FROM THE VOLUME: the skeleton peels exactly the six limbs the body was built with (four legs, tail, neck) -- derived from the construction, not a magic bar" as *u8, drLimbs, DR_LIMBS, ctr) 337 let drQuad: i64 = ct_leg_quadrants(bdr as *u8, fdr, DR_LEG_REACH_Z, CT_QUAD_XY) 338 gv_check_eq("T3 dragon every leg reached: a joint sits below -30 mm in all four (x,y) sign-quadrants, one per leg built to -36 mm" as *u8, drQuad, DR_LEGS, ctr) 339 let drTail: i64 = ct_reach2(bdr as *u8, fdr, CT_W_X, DR_TAIL_REACH_X, CT_BELOW, CT_W_Z, CT_NO_BAR, CT_ABOVE) 340 let drNeck: i64 = ct_reach2(bdr as *u8, fdr, CT_W_Z, DR_NECK_REACH_Z, CT_ABOVE, CT_W_X, DR_NECK_MIN_X, CT_ABOVE) 341 gv_check("T4 dragon tail and neck reached: a joint beyond x=-55 mm (the tail built to -64) and a joint above z=+24 mm at x>20 mm (the neck built to +30)" as *u8, drTail * drNeck, ctr) 342 let drBad: i64 = ct_skin_badsum(bdr as *u8, fdr) 343 gv_check("T5 dragon skin sound: every vertex's four weights sum to 4096 and the geodesic solve blended at least one vertex" as *u8, ((drBad == 0) as i64) * ((drMixed > 0) as i64), ctr) 344 345 // ---- BIPED, flush head ---- 346 let wbp: i64 = ct_biped(p_bp, mo) 347 let bpNv: i64 = mo[0] 348 let bpNt: i64 = mo[1] 349 let rcBp: i64 = amesh_run(p_bp, p_bpS, p_bpK, CT_CELLS, crep, brep) 350 cs_report(crep, p_bp, p_bpS) 351 let bpLimbs: i64 = crep[CR_LIMBS] 352 let bpJoints: i64 = crep[CR_JOINTS] 353 let bpBranches: i64 = crep[CR_BRANCHES] 354 let bpMixed: i64 = brep[BR_MIXED] 355 let bbp: i64 = ct_open(p_bpK, lp) 356 let fbp: i64 = lp[0] 357 ct_leaves(bbp as *u8, fbp, "biped" as *u8) 358 gv_check("T6 biped fixture-reached-the-condition: the six-box CSG union meshed watertight and the one-call auto-rig returned OK on it with no archetype hint" as *u8, ((wbp > 0) as i64) * ((bpNv > 0) as i64) * ((bpNt > 0) as i64) * ((rcBp == AM_EXIT_OK) as i64) * ((bbp != 0) as i64), ctr) 359 gv_check_eq("T7 biped TOPOLOGY FROM THE VOLUME: the skeleton peels exactly the five limbs the body was built with (two legs, two arms, head column) -- the head is flush with the torso so the union has exactly five protrusions" as *u8, bpLimbs, BP_LIMBS, ctr) 360 let bpLegs: i64 = ct_leg_quadrants(bbp as *u8, fbp, BP_LEG_REACH_Z, CT_QUAD_X_ONLY) 361 let bpArms: i64 = ct_arm_sides(bbp as *u8, fbp, BP_ARM_REACH_X, BP_ARM_MIN_Z) 362 let bpHead: i64 = ct_reach2(bbp as *u8, fbp, CT_W_Z, BP_HEAD_REACH_Z, CT_ABOVE, CT_W_X, CT_NO_BAR, CT_ABOVE) 363 gv_check("T8 biped every limb reached: a joint below -45 mm on each leg side, a joint beyond |x|=28 mm above z=5 mm on each arm side, and a joint above +25 mm for the head" as *u8, ((bpLegs == BP_SIDES) as i64) * ((bpArms == BP_SIDES) as i64) * bpHead, ctr) 364 let bpBad: i64 = ct_skin_badsum(bbp as *u8, fbp) 365 gv_check("T9 biped skin sound: every vertex's four weights sum to 4096 and the geodesic solve blended at least one vertex" as *u8, ((bpBad == 0) as i64) * ((bpMixed > 0) as i64), ctr) 366 367 // ---- the discriminator ---- 368 gv_check("T10 anti-vacuity: the dragon and the biped receive DIFFERENT limb counts from identical code with no hint -- a skeletoniser that returned a constant would pass every per-fixture tooth above and fail this one" as *u8, ((drLimbs != bpLimbs) as i64) * ((drLimbs > 0) as i64) * ((bpLimbs > 0) as i64), ctr) 369 370 // ---- BIPED, shouldered: the same body with a narrower head, i.e. two extra protrusions ---- 371 let wbs: i64 = ct_biped_shouldered(p_bs, mo) 372 let rcBs: i64 = amesh_run(p_bs, p_bsS, p_bsK, CT_CELLS, crep, brep) 373 cs_report(crep, p_bs, p_bsS) 374 let bsLimbs: i64 = crep[CR_LIMBS] 375 let bsJoints: i64 = crep[CR_JOINTS] 376 let bbs: i64 = ct_open(p_bsK, lp) 377 let fbs: i64 = lp[0] 378 ct_leaves(bbs as *u8, fbs, "shouldered" as *u8) 379 let bsLegs: i64 = ct_leg_quadrants(bbs as *u8, fbs, BP_LEG_REACH_Z, CT_QUAD_X_ONLY) 380 let bsArms: i64 = ct_arm_sides(bbs as *u8, fbs, BP_ARM_REACH_X, BP_ARM_MIN_Z) 381 let bsHead: i64 = ct_reach2(bbs as *u8, fbs, CT_W_Z, BP_HEAD_REACH_Z, CT_ABOVE, CT_W_X, CT_NO_BAR, CT_ABOVE) 382 gv_check("T11 MONOTONE IN PROTRUSIONS: the shouldered biped (a 12 mm head leaving two 3 mm shoulder ledges) peels AT LEAST as many limbs as the flush one from identical code while every designed limb is still reached -- adding protrusions never removes a limb; MEASURED: 3 mm ledges sit under the 6 mm root-radius stop bar and add none, so the claim is monotone, never strict" as *u8, ((wbs > 0) as i64) * ((rcBs == AM_EXIT_OK) as i64) * ((bsLimbs >= bpLimbs) as i64) * ((bsLegs == BP_SIDES) as i64) * ((bsArms == BP_SIDES) as i64) * bsHead, ctr) 383 384 // ---- TOUCHING-LEGS neg-control: the construction that peeled 7 must now peel exactly 5 ---- 385 let p_bt: *u8 = "/tmp/nx_autorig_creature_gate/biped_touching.nxa" 386 let p_btS: *u8 = "/tmp/nx_autorig_creature_gate/biped_touching_skel.nxa" 387 let p_btK: *u8 = "/tmp/nx_autorig_creature_gate/biped_touching_skinned.nxa" 388 let wbt: i64 = ct_biped_touching(p_bt, mo) 389 let rcBt: i64 = amesh_run(p_bt, p_btS, p_btK, CT_CELLS, crep, brep) 390 cs_report(crep, p_bt, p_btS) 391 let btLimbs: i64 = crep[CR_LIMBS] 392 let btJoints: i64 = crep[CR_JOINTS] 393 let bbt: i64 = ct_open(p_btK, lp) 394 let fbt: i64 = lp[0] 395 ct_leaves(bbt as *u8, fbt, "touching" as *u8) 396 let btLegs: i64 = ct_leg_quadrants(bbt as *u8, fbt, BP_LEG_REACH_Z, CT_QUAD_X_ONLY) 397 let btArms: i64 = ct_arm_sides(bbt as *u8, fbt, BP_ARM_REACH_X, BP_ARM_MIN_Z) 398 let btHead: i64 = ct_reach2(bbt as *u8, fbt, CT_W_Z, BP_HEAD_REACH_Z, CT_ABOVE, CT_W_X, CT_NO_BAR, CT_ABOVE) 399 gv_check("T12 neg-control-touching-limbs: the biped whose two legs SHARE the plane x=0 (the construction that peeled 7 on 2026-09-06, one leg three times) peels exactly the five limbs it was built with once bh_flood strips the zero-thickness wall the marcher emits on that shared plane (26-step census d4..d7, stripped to INTERIOR), with both legs, both arms and the head reached; the abutting legs still peel as two tubes because the claim radius follows the block's thinner axis, so a grooved-thigh fixture remains the honest control for REAL touching limbs" as *u8, ((wbt > 0) as i64) * ((rcBt == AM_EXIT_OK) as i64) * ((btLimbs == BP_LIMBS) as i64) * ((btLegs == BP_SIDES) as i64) * ((btArms == BP_SIDES) as i64) * btHead, ctr) 400 401 gv_values_head() 402 gv_kv("biped_touching_limbs" as *u8, btLimbs) 403 gv_kv("biped_touching_joints" as *u8, btJoints) 404 gv_kv("biped_touching_leg_sides" as *u8, btLegs) 405 gv_kv("dragon_verts" as *u8, drNv) 406 gv_kv("dragon_tris" as *u8, drNt) 407 gv_kv("dragon_limbs" as *u8, drLimbs) 408 gv_kv("dragon_joints" as *u8, drJoints) 409 gv_kv("dragon_branches" as *u8, drBranches) 410 gv_kv("dragon_leg_quadrants" as *u8, drQuad) 411 gv_kv("dragon_skin_bad_sum" as *u8, drBad) 412 gv_kv("biped_verts" as *u8, bpNv) 413 gv_kv("biped_tris" as *u8, bpNt) 414 gv_kv("biped_limbs" as *u8, bpLimbs) 415 gv_kv("biped_joints" as *u8, bpJoints) 416 gv_kv("biped_branches" as *u8, bpBranches) 417 gv_kv("biped_leg_sides" as *u8, bpLegs) 418 gv_kv("biped_arm_sides" as *u8, bpArms) 419 gv_kv("biped_skin_bad_sum" as *u8, bpBad) 420 gv_kv("biped_shouldered_limbs" as *u8, bsLimbs) 421 gv_kv("biped_shouldered_joints" as *u8, bsJoints) 422 gv_kv("biped_shouldered_leg_sides" as *u8, bsLegs) 423 gv_kv("biped_shouldered_arm_sides" as *u8, bsArms) 424 return gv_verdict("nx_autorig_creature_gate" as *u8, ctr, "archetype-free auto-rig: a dragon-like quadruped and two bipeds rigged from their volumes by one call with no hint, limb topology derived from construction and monotone in protrusions" as *u8) 425}