code wiki / (root) / nx_autorig_creature_gate.nx

nx_autorig_creature_gate.nx

buildroot/runtime/nx_autorig_creature_gate.nx

26123 B425 linesdepth 7pulls 17 transitivereach 0 importersview sourcekind gate/prooftopic autorig
docsdependenciesstructsconstsfunctions

about

nx_autorig_creature_gate.nx -- THE ARCHETYPE-FREE PROOF: the SAME one-call auto-rig, with NO hint, rigs a dragon- like quadruped (body + 4 legs + tail + neck) AND a biped (torso + 2 legs + 2 arms + head) and finds each one's limb topology from the VOLUME alone. This is the Infinigen-style everything-is-math requirement (operator 2026-09-05: "quickly auto rig a dragon vs a human vs whatever"): no humanoid template, no archetype flag, no learned model -- a medial-radius field and farthest-point peeling read the creature's own geometry. FIXTURES are watertight CSG unions of boxes through nx_csg_scene (N-ary fold, marching tetrahedra), because two overlapping CLOSED meshes carry internal walls that split the interior (banked lesson from the T fixture); an SDF union has none. Every expected number below is DERIVED from the fixture's own construction (a body built with six appendages must peel six limbs; a leg built to z=-36 mm must be reached below -30 mm), never a magic bar. The anti-vacuity tooth is that the two counts DIFFER: a skeletoniser returning a constant would pass every per-fixture tooth and fail that one. MEASURED (2026-09-05/06): the dragon peeled exactly 6 on every run. The first biped peeled 7, not 5, and TWO stories were refuted by instruments before the third was read off one: not the shoulder ledges (a flush head also gave 7), not the torso corners (the peel arithmetic puts them 1-3 cells inside the claimed cubes) -- the LEAF readout showed the left leg peeled three times down one corner column while the right leg peeled once, and the only asymmetry between 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 real geometry, and a fixture must carry no degenerate shared plane; the shouldered variant stays as a MONOTONE tooth. license_tier: ORIGINAL expect_exit: 0

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_nxa.nx nx_csg_scene.nx nx_autorig_mesh.nx nx_autorig_creature_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_nxa.nxnx_csg_scene.nxnx_autorig_mesh.nx

imported by: nobody (leaf or entry point)

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

main 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 ↻ sys_mkdir sys_mmap ↻ ct_dragon nx_csg_scene_new sys_mmap ↻ ct_box nx_sdf_make sys_mmap ↻ nx_csg_scene_add ct_write_scene nx_csg_extract_scene sys_mmap ↻ nx_csg_scene_field nx_csg_scene_eval_i nx_sdf_eval nx_cos_turn_q10 nx_sin_turn_q10 nx_csg_combine_k nx_csg_combine nx_csg_smin

structs

none

consts

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
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
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
75const BP_TORSO_HX: i64 = 9
76const BP_TORSO_HY: i64 = 7
77const BP_TORSO_HZ: i64 = 20
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
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
184const BT_LEG_H: i64 = 5
185const BT_LEG_X: i64 = 5

functions

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 }
called by 1: ct_leaves calls 1: sys_write
115func ct_box(s: *NxCsgScene, cx: i64, cy: i64, cz: i64, hx: i64, hy: i64, hz: i64) -> i64
120func ct_write_scene(s: *NxCsgScene, lox: i64, loy: i64, loz: i64, hix: i64, hiy: i64, hiz: i64, path: *u8, out: *i64) -> i64
149func ct_dragon(path: *u8, out: *i64) -> i64
161func ct_biped_body(s: *NxCsgScene) -> i64
called by 2: ct_bipedct_biped_shouldered calls 1: ct_box
169func ct_biped(path: *u8, out: *i64) -> i64
175func ct_biped_shouldered(path: *u8, out: *i64) -> i64
186func ct_biped_touching(path: *u8, out: *i64) -> i64
196func ct_open(path: *u8, lp: *i64) -> i64
called by 1: main calls 1: sys_read_file
201func ct_nj(b: *u8, flen: i64) -> i64
207func ct_jw(b: *u8, flen: i64, j: i64, word: i64) -> i64
213func ct_leg_quadrants(b: *u8, flen: i64, zbar: i64, use_y: i64) -> i64
called by 1: main calls 3: ct_njsys_mmapct_jw
230func ct_reach2(b: *u8, flen: i64, wa: i64, bara: i64, dira: i64, wb: i64, barb: i64, dirb: i64) -> i64
called by 1: main calls 2: ct_njct_jw
246func ct_arm_sides(b: *u8, flen: i64, xbar: i64, zmin: i64) -> i64
called by 1: main calls 2: ct_njct_jw
262func ct_skin_badsum(b: *u8, flen: i64) -> i64
called by 1: main calls 2: nxa_findnxa_tag4
282func ct_leaves(b: *u8, flen: i64, tag: *u8) -> i64
called by 1: main calls 5: ct_njsys_mmapct_jwctwgv_num
304func main() -> i64