code wiki / _hdl_build / nx_profile_fit.nx
nx_profile_fit.nx
buildroot/runtime/_hdl_build/nx_profile_fit.nx
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
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
structs
| none |
consts
| 21 | const PF_Q14: i64 = 16384 |
| 22 | const PF_BIG: i64 = 2000000000 |
| 23 | const PF_M8388607: i64 = 8388607 |
| 24 | const PF_M8388608: i64 = 8388608 |
| 25 | const PF_POSQ0: i64 = 4096 |
| 26 | const PF_TARGET: i64 = 200000 |
| 27 | const PF_MAGIC_40500: i64 = 40500 |
| 31 | const PF_NB: i64 = 48 |
| 32 | const PF_MAXST: i64 = 256 // station slices |
| 33 | const PF_MAXPT: i64 = 4096 // section points held per station |
| 34 | const PF_XBINS: i64 = 128 // x-histogram bins used to separate torso from limbs |
| 35 | const PF_GAP: i64 = 2 // empty x-bins that separate two clusters |
| 36 | const PF_MAXRUN: i64 = 8 |
| 37 | const PF_MAXPARTS: i64 = 8 |
| 38 | const PF_MAXK: i64 = 12 // control rings kept per part after factorisation |
| 42 | const PF_OUTCAP: i64 = 1048576 // output text buffer |
| 44 | const PF_PTORSO: i64 = 0 |
| 45 | const PF_PARM: i64 = 1 |
| 46 | const PF_PLEG: i64 = 2 |
| 47 | const PF_PHEAD: i64 = 4 |
| 49 | const PF_TORSO_LO: i64 = 430 |
| 50 | const PF_TORSO_HI: i64 = 908 |
| 54 | const PF_ARM_LO: i64 = 470 |
| 55 | const PF_ARM_HI: i64 = 838 |
| 56 | const PF_LEG_LO: i64 = 60 |
| 57 | const PF_LEG_HI: i64 = 452 |
| 58 | const PF_HEAD_LO: i64 = 852 |
functions
| 60 | func 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 } |
| 61 | func pf_pn(v: i64) -> i64 |
| 70 | func pf_satoi(s: *u8) -> i64 called by 1: main |
| 75 | func pf_rdbits(b: *u8, o: i64) -> i64 |
| 78 | func pf_f32mul(b: *u8, o: i64, mul: i64) -> i64 |
| 91 | func 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 |
| 92 | func pf_wrap(d: i64) -> i64 { var x: i64 = d % 360; if x < 0 { x = x + 360 } return x } called by 1: pf_fit_section |
| 94 | func pf_sin_fill(t: *i64) -> i64 called by 1: main |
| 100 | func pf_putint(buf: *u8, pos: *i64, v: i64, sep: i64) -> i64 |
| 114 | func pf_puts(buf: *u8, pos: *i64, s: *u8) -> i64 |
| 128 | func pf_fit_section(px: *i64, pz: *i64, idx: *i64, cnt: i64, sinT: *i64, fit: *i64, rat: *i64) -> i64 |
| 218 | func pf_symmetrize(rat: *i64) -> i64 |
| 239 | func 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 |
| 281 | func pf_emit_part(buf: *u8, pos: *i64, cY: *i64, cRA: *i64, cRB: *i64, cXC: *i64, cZC: *i64, |
| 308 | func pf_landmark(cY: *i64, cR: *i64, base: i64, n: i64, lo: i64, hi: i64, kind: i64) -> i64 called by 1: main |
| 326 | func main(argc: i64, argv: *i64) -> i64 |