code wiki / _hdl_build / nx_profile_fit.nx

nx_profile_fit.nx

buildroot/runtime/_hdl_build/nx_profile_fit.nx

38757 B754 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic profile
docsdependenciesstructsconstsfunctions

about

nx_profile_fit.nx -- ★MEASURED CROSS-SECTION PROFILES FROM A REAL ANATOMICAL REFERENCE. This is the Infinigen method, done sovereignly: their creature lofting threads NURBS surfaces through profile sections taken from REAL references (nurbs_data). Ours threaded ELLIPSES -- and a human cross section is not an ellipse (flat back, spinal furrow, sternal hollow, deltoid shelf, iliac flare). This organ SLICES an oracle mesh at every station height, clusters each slice into torso / arm / leg / head, fits the section's bounding ellipse, and emits the DIMENSIONLESS deviation of the real outline from that ellipse as a per-angle ratio. ★WHAT IS AND IS NOT TAKEN FROM THE ORACLE: only the SHAPE PRIOR (a per-mille ratio per angle, 1000 = on the ellipse). Every SIZE stays procedural -- the generator still decides stature, breadth, build and dimorphism. So this cannot become "ship the scanned body": it is a measured shape rule the emitter applies to whatever body the rule engine asks for, exactly as Infinigen applies profiles from refs to a genome. Oracle provenance/licence is written into the emitted file header by the caller's manifest. nx_profile_fit <oracle.nxmesh> <out.dat> [step_permil] [canon_out.dat] [part_id] ORGAN MODE: supply part_id and the oracle is declared to BE that single part -- no band gate, no limb clustering. Absent it, the body path is unchanged. license_tier: ORIGINAL expect_exit: 0

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_profile_fit.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 pf_hw sys_write pf_satoi sys_mmap pf_sin_fill sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close pf_rdbits pf_f32mul pf_rdbits ↻ pf_puts pf_putint sys_mmap ↻ pf_fit_section sys_mmap ↻ pf_wrap pf_isqrt pf_symmetrize sys_mmap ↻ sys_openat_wr sys_write ↻ sys_close ↻ pf_factorise pf_emit_part pf_puts ↻ pf_putint ↻ pf_pn sys_mmap ↻ sys_write ↻ pf_landmark

structs

none

consts

21const PF_Q14: i64 = 16384
22const PF_BIG: i64 = 2000000000
23const PF_M8388607: i64 = 8388607
24const PF_M8388608: i64 = 8388608
25const PF_POSQ0: i64 = 4096
26const PF_TARGET: i64 = 200000
27const PF_MAGIC_40500: i64 = 40500
31const PF_NB: i64 = 48
32const PF_MAXST: i64 = 256 // station slices
33const PF_MAXPT: i64 = 4096 // section points held per station
34const PF_XBINS: i64 = 128 // x-histogram bins used to separate torso from limbs
35const PF_GAP: i64 = 2 // empty x-bins that separate two clusters
36const PF_MAXRUN: i64 = 8
37const PF_MAXPARTS: i64 = 8
38const PF_MAXK: i64 = 12 // control rings kept per part after factorisation
42const PF_OUTCAP: i64 = 1048576 // output text buffer
44const PF_PTORSO: i64 = 0
45const PF_PARM: i64 = 1
46const PF_PLEG: i64 = 2
47const PF_PHEAD: i64 = 4
49const PF_TORSO_LO: i64 = 430
50const PF_TORSO_HI: i64 = 908
54const PF_ARM_LO: i64 = 470
55const PF_ARM_HI: i64 = 838
56const PF_LEG_LO: i64 = 60
57const PF_LEG_HI: i64 = 452
58const PF_HEAD_LO: i64 = 852

functions

60func pf_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 1: main calls 1: sys_write
61func pf_pn(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
70func pf_satoi(s: *u8) -> i64
called by 1: main
75func pf_rdbits(b: *u8, o: i64) -> i64
called by 2: pf_f32mulmain
78func pf_f32mul(b: *u8, o: i64, mul: i64) -> i64
called by 1: main calls 1: pf_rdbits
91func pf_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: pf_fit_section
92func pf_wrap(d: i64) -> i64 { var x: i64 = d % 360; if x < 0 { x = x + 360 } return x }
called by 1: pf_fit_section
94func pf_sin_fill(t: *i64) -> i64
called by 1: main
100func pf_putint(buf: *u8, pos: *i64, v: i64, sep: i64) -> i64
called by 2: pf_emit_partmain calls 1: sys_mmap
114func pf_puts(buf: *u8, pos: *i64, s: *u8) -> i64
called by 2: pf_emit_partmain
128func pf_fit_section(px: *i64, pz: *i64, idx: *i64, cnt: i64, sinT: *i64, fit: *i64, rat: *i64) -> i64
called by 1: main calls 3: sys_mmappf_wrappf_isqrt
218func pf_symmetrize(rat: *i64) -> i64
called by 1: main calls 1: sys_mmap
239func pf_factorise(cY: *i64, cRA: *i64, cRB: *i64, cXC: *i64, cZC: *i64, base: i64, n: i64, K: i64, sel: *i64) -> i64
called by 1: main
281func pf_emit_part(buf: *u8, pos: *i64, cY: *i64, cRA: *i64, cRB: *i64, cXC: *i64, cZC: *i64,
called by 1: main calls 2: pf_putspf_putint
308func pf_landmark(cY: *i64, cR: *i64, base: i64, n: i64, lo: i64, hi: i64, kind: i64) -> i64
called by 1: main
326func main(argc: i64, argv: *i64) -> i64