code wiki / _hdl_build / nx_articulate_gate.nx
nx_articulate_gate.nx
buildroot/runtime/_hdl_build/nx_articulate_gate.nx
about
nx_articulate_gate.nx -- ★R9: ARTICULATED (rigged) assets. A 2-bone-per-leg skeleton with forward kinematics,
proven by the defining articulation property + a walk animation:
T1 ★HIERARCHY (FK): rotating the HIP (thigh) moves the whole leg (knee AND foot); rotating the KNEE (shin)
moves ONLY the lower bone (the foot moves, the knee joint does NOT) -- parent drives subtree, child doesn't
T2 POSE CONTROL: the same creature in a bent pose renders visibly different from standing
T3 ★WALK CYCLE: animating the joints produces distinct, PERIODIC frames (a gait -- skeletal animation)
T4 determinism + a walk-cycle strip knowledge/nx_articulate.png (6 frames of a walking creature)
license_tier: ORIGINAL expect_exit: 0
dependencies 4 imports · 0 importers
imports: nx_syscalls.nxnx_itrig.nxnx_png.nxnx_creaturegen.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 19 | const YAW: i64 = 6434 // ~90deg side view: leg swing (fore/aft in Z) is visible |
| 20 | const THA: i64 = 1500 // thigh swing amplitude (it4096) |
| 21 | const SHA: i64 = 1100 // shin bend amplitude |
functions
| 14 | func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 15 | func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 } |
| 16 | func d3(a: *i64, ai: i64, b: *i64, bi: i64) -> i64 { let dx: i64=a[ai]-b[bi]; let dy: i64=a[ai+1]-b[bi+1]; let dz: i64=a[ai+2]-b[bi+2]; var s: i64=dx*dx+dy*dy+dz*dz; if s<=0 {return 0} var r: i64=s; var q: i64=(r+1)/2; while q<r {r=q; q=(r+s/r)/2} return r } called by 1: main |
| 17 | func L1i(a: *i64, b: *i64, n: i64) -> i64 { var s: i64=0; var i: i64=0; while i<n { var d: i64=(a[i]&255)-(b[i]&255); if d<0{d=0-d} s=s+d; i=i+1 } return s } called by 1: main |
| 23 | func main() -> i64 |