code wiki / (root) / nx_bvh_lib.nx

nx_bvh_lib.nx

buildroot/runtime/nx_bvh_lib.nx

13626 B371 linesdepth 2pulls 2 transitivereach 6 importersview sourcekind librarytopic bvh
docsdependenciesstructsconstsfunctions

about

nx_bvh_lib.nx -- SHARED BVH (BioVision Hierarchy) PARSING SUBSTRATE. Extracted 2026-08-07 when the second consumer appeared (nx_bvhfk, forward kinematics) rather than copy-pasting the tokenizer into it -- Rule 15, and Rule 9: this library PARSES, it does not interpret. Kinematics, census and rendering are separate organs on top of it. NAMING: nx_bvh.nx is a BOUNDING VOLUME HIERARCHY for the slicer. This file and its consumers are the MOTION-CAPTURE bvh. The collision already cost one false capability reading. *THE FILE CARRIES ITS OWN ANSWER KEY: a BVH declares a joint tree whose CHANNELS sum to an exact per-frame width, then prints rows of that width. b_motion PROVES that identity before returning, so a hierarchy parse that is wrong by a single channel REFUSES instead of silently mis-slicing every frame. Verified against two independent real files (19 joints/60 chan/455 frames = 27,300 values; 55 joints/168 chan/69 frames = 11,592 values), both exact. UNITS ARE DECLARED, NEVER IMPLIED: OFFSET + positional channels = file units x B_SCALE (1000). BVH does not state its unit in the format; the convention is centimetres, so we do NOT claim mm. rotational channels = degrees x B_SCALE (1000) = millidegrees. frame time = MICROSECONDS (x B_TSCALE); fps is DERIVED, never assumed 30. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 1 imports · 5 importers

nx_syscalls.nx nx_bvh_lib.nx nx_bvhfk.nx nx_bvhfk_lib.nx nx_bvhmotion.nx nx_clipcheck.nx nx_dance_emit.nx

imports: nx_syscalls.nx

imported by: nx_bvhfk.nxnx_bvhfk_lib.nxnx_bvhmotion.nxnx_clipcheck.nxnx_dance_emit.nx

structs

none

consts

25const B_SCALE: i64 = 1000
26const B_TSCALE: i64 = 1000000
27const B_MAX_JOINTS: i64 = 256
28const B_MAX_CHAN: i64 = 1024
29const B_NAMEW: i64 = 32
30const B_TOKW: i64 = 64
31const B_TEN: i64 = 10
33const B_CH_XPOS: i64 = 0
34const B_CH_YPOS: i64 = 1
35const B_CH_ZPOS: i64 = 2
36const B_CH_XROT: i64 = 3
37const B_CH_YROT: i64 = 4
38const B_CH_ZROT: i64 = 5
39const B_CH_BAD: i64 = 0 - 1
41const B_H_NJOINT: i64 = 0
42const B_H_NCHAN: i64 = 1
43const B_H_NFRAME: i64 = 2
44const B_H_FTIME: i64 = 3
45const B_H_MOTOFF: i64 = 4
46const B_H_WORDS: i64 = 8
48const B_R_NOHIER: i64 = 0 - 1
49const B_R_NOMOTION:i64 = 0 - 2
50const B_R_CAP: i64 = 0 - 3
51const B_R_WIDTH: i64 = 0 - 4
52const B_R_FRAMES: i64 = 0 - 5
53const B_R_CHAN: i64 = 0 - 6
54const B_R_FRAMEIDX:i64 = 0 - 7

functions

56func b_slen(s: *u8) -> i64 { var i: i64 = 0; while s[i] != (0 as u8) { i = i + 1 } return i }
57func b_puts(s: *u8) -> i64 { sys_write(1, s, b_slen(s)); return 0 }
59func b_num(v: i64) -> i64
74func b_is_space(c: i64) -> i64
called by 1: b_token
86func b_token(buf: *u8, len: i64, pos: *i64, tok: *u8) -> i64
123func b_tok_is(tok: *u8, n: i64, s: *u8) -> i64
131func b_parse_fx(tok: *u8, n: i64, scale: i64) -> i64
201func b_chan_code(tok: *u8, n: i64) -> i64
called by 1: b_hierarchy calls 1: b_tok_is
211func b_hierarchy(buf: *u8, len: i64, pos: *i64, H: *i64,
295func b_motion(buf: *u8, len: i64, pos: *i64, H: *i64) -> i64
328func b_refuse(code: i64) -> i64
called by 3: fk_loadmainmain calls 2: b_putsb_num
341func b_parse(buf: *u8, len: i64, H: *i64, names: *u8, parent: *i64,
351func b_frame_values(buf: *u8, len: i64, H: *i64, frame: i64, out: *i64) -> i64