code wiki / _hdl_build / nx_bodyparts.nx

nx_bodyparts.nx

buildroot/runtime/_hdl_build/nx_bodyparts.nx

17128 B405 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_bodyparts.nx -- L0 TAXON + STRUCTURE CENSUS of the SEMANTIC TWIN LADDER (debt 1785954089; operator 2026-08-05: "it is a human, female, has a head, then eyes... a clay blob is not the same object as a girl"). Metric distance alone ranked an ARMLESS body first (nx_bodybench 278 vs 232) -- because no instrument could say WHAT the thing is. This organ answers the first question: IS IT A HUMANOID, AND WHICH PARTS EXIST? METHOD (structural, no rig required so it works on ANY mesh soup): slice the mesh into y-bands; in each band build an x-histogram and count CLUSTERS (occupied runs separated by >=BP_GAP empty bins). A standing humanoid has a signature no blob can fake: 3 clusters where the arms are clear of the torso, 2 clusters where the legs separate, and a NECK (a width minimum) below a head mass. A pawn silhouette is 1 cluster everywhere and is REFUSED as a humanoid -- semantically, not by score. Bone-weight-driven NAMED segmentation (L2, VRM's 51 humanoid bones = free parts for rigged donors) is the next rung and rides the same output rows. nx_bodyparts <mesh.nxmesh> [bands] | selftest Emits JSON: per-region cluster maxima, neck/head findings, part census, VERDICT=HUMANOID|NOT-HUMANOID with the MISSING part named. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_bodyparts.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main bp_selftest bp_fix_pawn sys_mmap bp_hdr bp_w32 bp_box bp_tri bp_w32 ↻ bp_encf bp_save bp_w32 ↻ sys_openat_wr sys_write sys_close bp_fix_human sys_mmap ↻ bp_box ↻ bp_hdr ↻ bp_save ↻ hw sys_write ↻ bp_run sys_mmap ↻ bp_load sys_openat_rd sys_mmap ↻ sys_read sys_close ↻ bp_u32 bp_f32q bp_refuse hw ↻ bp_clusters bp_width hw ↻ pn sys_mmap ↻ sys_write ↻ pn ↻

structs

none

consts

19const BP_MAGIC_65536: i64 = 65536
20const BP_MAGIC_1600: i64 = 1600
21const BP_MAGIC_262144: i64 = 262144
22const BP_MAGIC_1350: i64 = 1350
23const BP_MAGIC_1300: i64 = 1300
24const BP_MAGIC_1430: i64 = 1430
26const BP_CAP: i64 = 33554432
27const BP_MAXTRI: i64 = 400000
28const BP_MAXBAND: i64 = 256
29const BP_XBINS: i64 = 128
30const BP_GAP: i64 = 2
31const BP_M8388607: i64 = 8388607
32const BP_M8388608: i64 = 8388608
33const BP_BIG: i64 = 4611686018427387903
35const BP_ARM_LO: i64 = 550
36const BP_ARM_HI: i64 = 800
37const BP_LEG_LO: i64 = 80
38const BP_LEG_HI: i64 = 420
39const BP_NECK_LO: i64 = 800
40const BP_NECK_HI: i64 = 920
42const BP_NECK_FRAC: i64 = 600
44const BP_HEAD_FRAC: i64 = 900

functions

46func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
47func 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 }
called by 2: bp_runbp_selftest calls 2: sys_mmapsys_write
48func bp_u32(b: *u8, o: i64) -> i64 { return (b[o] as i64) + ((b[o+1] as i64)<<8) + ((b[o+2] as i64)<<16) + ((b[o+3] as i64)<<24) }
called by 1: bp_load
50func bp_f32q(w: i64) -> i64
called by 1: bp_load
64func bp_refuse(reason: *u8) -> i64 { hw("BODYPARTS REFUSED: " as *u8); hw(reason); hw("\n" as *u8); return 0 }
called by 1: bp_run calls 1: hw
67func bp_load(path: *u8, vx: *i64) -> i64
98func bp_clusters(occ: *i64) -> i64
called by 1: bp_run
116func bp_width(occ: *i64) -> i64
called by 1: bp_run
128func bp_run(path: *u8, nband: i64) -> i64
275func bp_encf(v: i64, scale: i64) -> i64
called by 1: bp_tri
290func bp_w32(b: *u8, o: i64, v: i64) -> i64
called by 3: bp_tribp_hdrbp_save
295func bp_tri(b: *u8, off: i64, x0: i64, y0: i64, z0: i64, x1: i64, y1: i64, z1: i64, x2: i64, y2: i64, z2: i64) -> i64
called by 1: bp_box calls 2: bp_w32bp_encf
304func bp_box(b: *u8, off: i64, xlo: i64, xhi: i64, ylo: i64, yhi: i64, zlo: i64, zhi: i64) -> i64
called by 2: bp_fix_pawnbp_fix_human calls 1: bp_tri
320func bp_hdr(b: *u8, ntri: i64) -> i64
called by 2: bp_fix_pawnbp_fix_human calls 1: bp_w32
330func bp_save(path: *u8, b: *u8, ntri: i64) -> i64
340func bp_fix_pawn(path: *u8) -> i64
347func bp_fix_human(path: *u8) -> i64
361func bp_selftest() -> i64
375func main(argc: i64, argv: *i64) -> i64