code wiki / (root) / nx_bvhfk_lib.nx

nx_bvhfk_lib.nx

buildroot/runtime/nx_bvhfk_lib.nx

7215 B186 linesdepth 3pulls 5 transitivereach 3 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_bvhfk_lib.nx -- SHARED BVH FORWARD-KINEMATICS CORE (fk_eval + integer matrix substrate). Extracted 2026-08-13 when the SECOND consumer appeared (nx_clipcheck's bvh self-clearance control lane needs world positions per frame) rather than copy-pasting the FK into it -- Rule 15, and the standing law: EXTRACT THE FIX, DON'T RE-TYPE IT. The functions below are MOVED VERBATIM from nx_bvhfk.nx; that organ's KAT (bone-length isometry proven on real third-party mocap) remains the proof that this extraction is value-identical. SEMANTICS (BVH is specific and easy to get subtly wrong): world_rot[j] = world_rot[parent] * R_local[j] world_pos[j] = world_pos[parent] + world_rot[parent] * offset[j] R_local is the product of that joint's rotation channels IN THE ORDER THE FILE LISTS THEM (commonly ZXY, but the file decides -- never the convention). The root additionally consumes its position channels as a translation. UNITS: positions in file units x B_SCALE (1000) -- BVH does not state its unit; the convention is centimetres, so we do not claim mm. Angles arrive as millidegrees and are converted to the it_* integer-trig circle (25736 units) -- never to floats. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 3 imports · 2 importers

nx_bvh_lib.nx nx_itrig.nx nx_vecmath.nx nx_bvhfk_lib.nx nx_bvhfk.nx nx_clipcheck.nx

imports: nx_bvh_lib.nxnx_itrig.nxnx_vecmath.nx

imported by: nx_bvhfk.nxnx_clipcheck.nx

structs

none

consts

24const FK_ONE: i64 = 65536 // matrices carry fx16, not the trig table's fx12 -- see fk_ortho
25const FK_TRIGUP: i64 = 16 // it_* tables are x4096; lift to x65536 for matmul headroom
26const FK_HALF: i64 = 32768 // round-to-nearest, not truncate-toward-zero
27const FK_CIRCLE: i64 = 25736
28const FK_MDEG: i64 = 360000

functions

30func fk_ang(md: i64) -> i64
called by 1: fk_axis
37func fk_ident(m: *i64) -> i64
called by 1: fk_eval
44func fk_axis(code: i64, md: i64, m: *i64) -> i64
called by 1: fk_eval calls 3: fk_angit_cos4096it_sin4096
69func fk_mul(a: *i64, b: *i64, c: *i64) -> i64
called by 1: fk_eval
87func fk_xform(m: *i64, vx: i64, vy: i64, vz: i64, out: *i64) -> i64
called by 1: fk_eval
103func fk_ortho(m: *i64) -> i64
called by 1: fk_eval calls 1: fk_isqrt
127func fk_isqrt(v: i64) -> i64 { return vm_isqrt(v) }
called by 4: fk_katmainfk_orthofk_dist calls 1: vm_isqrt
129func fk_dist(ax: i64, ay: i64, az: i64, bx: i64, by: i64, bz: i64) -> i64
called by 2: fk_katmain calls 1: fk_isqrt
137func fk_eval(H: *i64, parent: *i64, nchan: *i64, chan0: *i64, off: *i64, chtype: *i64,