code wiki / _hdl_build / nx_bodybench.nx

nx_bodybench.nx

buildroot/runtime/_hdl_build/nx_bodybench.nx

25306 B482 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind bench
docsdependenciesstructsconstsfunctions

about

nx_bodybench.nx -- ★SOVEREIGN BODY JUDGE, registerable as an MCP tool. Moves the shape ruler OFF the dev laptop (it was PowerShell + System.Drawing) INTO a NishiLang organ that runs on the NAS: any agent, plan or workflow can now measure a generated body against the BodyParts3D oracle with ONE call and get a permil verdict back as JSON -- no image round-trip, no third-party runtime, no human in the loop. That is what "it needs to scale" means: the measurement is a service, not a person at a keyboard. OOP, tagged-dispatch (NOT struct fn-pointer fields -- seq715: obj.fn(args) compiles and does NOT call): * MeshView -- an object that renders ONE mesh at ONE yaw into coverage + per-pixel normal buffers (a minimal measurement rasterizer: projection + edge-function fill + z-buffer + normal; no shading/shadow/floor/texture -- those are display concerns, not measurement). * Judge -- a small hierarchy dispatched by KIND: J_SILH (silhouette IoU) and J_NORMAL (normal-field angular agreement). judge_eval(kind, ...) is the polymorphic entry; add a kind to extend. * BodyBench -- orchestrates: renders ours+oracle at yaw 0 and 90, runs each judge, emits per-judge permil and the HONEST HEADLINE = MIN over judges (hold several judges, publish the minimum). nx_bodybench <ours.nxmesh> <oracle.nxmesh> [W] [H] -> {"front_iou":..,"side_iou":..,"shape":..,"headline":..,"self_iou":1000,"self_shape":1000, ...} The self_* fields are a built-in NON-VACUITY proof: ours-vs-ours must score 1000/1000 or the ruler is broken. license_tier: ORIGINAL expect_exit: 0

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_bodybench.nx

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: nobody (leaf or entry point)

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

main bb_hw sys_write bb_satoi sys_mmap bb_sin_fill bb_acos_fill bb_wrap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close bb_rdbits mv_render bb_wrap ↻ bb_f32mul bb_rdbits ↻ sys_mmap ↻ bb_max bb_min bb_isqrt judge_eval bb_acos_deg bb_detail_fill bb_detail_score bb_detail_head bb_min ↻ bb_emit_kv bb_hw ↻ bb_pn nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap

structs

none

consts

23const BB_Q14: i64 = 16384
24const BB_ZFAR: i64 = 2000000000
25const BB_BIG: i64 = 2000000000
26const BB_M8388607: i64 = 8388607
27const BB_M8388608: i64 = 8388608
28const BB_POSQ0: i64 = 4096
29const BB_TARGET: i64 = 200000
30const BB_MAGIC_40500: i64 = 40500
31const BB_ACOSN: i64 = 8192 // acos LUT resolution over cos in [-Q14,+Q14]
32const BB_DETR: i64 = 2 // detail-judge window radius -> a (2R+1)^2 = 5x5 neighbourhood; big
223const J_SILH: i64 = 1
224const J_NORMAL: i64 = 2

functions

36func bb_streq(a: *u8, b: *u8) -> i64
42func bb_satoi(s: *u8) -> i64
called by 1: main
48func bb_hw(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 2: bb_emit_kvmain calls 1: sys_write
53func bb_pn(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: bb_emit_kv calls 1: nxi_out
54func bb_rdbits(b: *u8, o: i64) -> i64
called by 2: bb_f32mulmain
57func bb_f32mul(b: *u8, o: i64, mul: i64) -> i64
called by 1: mv_render calls 1: bb_rdbits
70func bb_isqrt(v: i64) -> i64 { if v <= 0 { return 0 } var x: i64 = v; var y: i64 = (x+1)/2; while y < x { x = y; y = (x + v/x)/2 } return x }
called by 1: mv_render
71func bb_wrap(d: i64) -> i64 { var x: i64 = d % 360; if x < 0 { x = x + 360 } return x }
72func bb_min(a: i64, b: i64) -> i64 { if a < b { return a } return b }
called by 2: mv_rendermain
73func bb_max(a: i64, b: i64) -> i64 { if a > b { return a } return b }
called by 1: mv_render
75func bb_sin_fill(t: *i64) -> i64
called by 1: main
82func bb_acos_fill(acosT: *i64, sinT: *i64) -> i64
called by 1: main calls 1: bb_wrap
100func bb_acos_deg(acosT: *i64, dotq: i64) -> i64
called by 1: judge_eval
116func mv_render(mb: *u8, ntris: i64, triBase: i64, lidBase: i64, W: i64, H: i64, yaw: i64, sinT: *i64,
226func judge_eval(kind: i64, npx: i64, covA: *i64, covB: *i64,
called by 1: main calls 1: bb_acos_deg
264func bb_detail_fill(W: i64, H: i64, cov: *i64, nx: *i64, ny: *i64, nz: *i64, out: *i64) -> i64
called by 1: main
310func bb_detail_score(npx: i64, covA: *i64, covB: *i64, dA: *i64, dB: *i64) -> i64
called by 1: main
333func bb_detail_head(W: i64, H: i64, covA: *i64, covB: *i64, dA: *i64, dB: *i64, frac: i64) -> i64
called by 1: main
368func bb_emit_kv(name: *u8, v: i64, last: i64) -> i64
called by 1: main calls 2: bb_hwbb_pn
374func main(argc: i64, argv: *i64) -> i64