code wiki / _hdl_build / nx_skullgen.nx
nx_skullgen.nx
buildroot/runtime/_hdl_build/nx_skullgen.nx
about
nx_skullgen.nx -- F1108/seq900 KEYSTONE: THE SKULL, GENERATED. Inside-out, from the first byte up.
OPERATOR, and he was right: "you arent building from the inside out aka a skull to give it structure ...
take the skull and bones those should have all been generatable by now then you just layer on top."
Every facial feature this program fought with is a property of BONE -- the brow ridge is the supraorbital
margin of the frontal bone, the chin is the mental protuberance of the mandible, the cheekbones are the
zygomatic arches, the eye sockets are the orbits. We had been sticking those onto a smooth SKIN ovoid,
which is why three tuned chin attempts all rendered as lobes stacked under a mouth: pieces stuck on a
blob look like pieces stuck on a blob. The structure has to exist first and the surface layers onto it.
This organ does NOT store a skull -- it stores the RULES that make one, and emits them as a canon of
P/R/F rows that the proven emitter turns into geometry. So the skull inherits spline lofting, true
central-difference normals, capped tubes, per-part placement and rotation about Z for free, and it is
data generated by anatomy rather than a modelled asset. The oracle it is scored against is the
BodyParts3D skull (171,248 real scanned triangles, CC BY-SA 2.1 Japan) -- a RULER, never the product.
nx_skullgen <out.dat> [sex 0-1000] [seed] [robust 0-1000]
nx_skullgen selftest
license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).
dependencies 2 imports · 0 importers
imports: nx_gate_verdict.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
structs
| none |
consts
| 23 | const SK_BUF: i64 = 65536 |
| 24 | const SK_MODE: i64 = 420 |
| 25 | const SK_MINP: i64 = 7 |
| 26 | const SK_MINR: i64 = 30 |
| 41 | const SK_BROW_BASE: i64 = 12 // supraorbital margin: heavy male, light female |
| 42 | const SK_BROW_SEXF: i64 = 5 |
| 43 | const SK_BROW_ROBUST: i64 = 6 |
| 44 | const SK_JAW_BASE: i64 = 46 // mandible breadth: square male, tapered female |
| 45 | const SK_JAW_SEXF: i64 = 6 |
| 46 | const SK_JAW_ROBUST: i64 = 5 |
| 47 | const SK_VAULT_BASE: i64 = 52 // cranial vault half-breadth |
| 48 | const SK_VAULT_SEXF: i64 = 2 |
| 49 | const SK_ZYG_BASE: i64 = 50 // zygomatic (cheekbone) projection |
| 50 | const SK_ZYG_SEXF: i64 = 3 |
| 51 | const SK_ZYG_ROBUST: i64 = 4 |
| 52 | const SK_ASCII_SP: i64 = 32 |
| 53 | const SK_ASCII_NL: i64 = 10 |
| 54 | const SK_TAG_P: i64 = 80 |
| 55 | const SK_TAG_R: i64 = 82 |
| 56 | const SK_TAG_F: i64 = 70 |
| 63 | const SK_PERCENT: i64 = 100 |
| 64 | const SK_PERMILLE: i64 = 1000 |
| 68 | const SK_SEED_GOLDEN32: i64 = 2654435761 // 0x9E3779B1 = floor(2^32 / phi), Knuth's multiplicative-hash constant |
| 69 | const SK_SEED_ODD_ADD: i64 = 12345 // odd addend so seed 0 cannot produce the degenerate state 0 |
| 72 | const SK_EXTENT_SENTINEL: i64 = 999999 |
| 74 | const SK_FIXTURE_BUF: i64 = 4096 |
| 79 | const SK_T6_SEED: i64 = 12345 |
| 345 | const SK_VAULT_FLOOR: i64 = 40 // braincase confined to the upper 60 percent of skull height (seq908) |
functions
| 86 | func sk_puts(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 |
| 91 | func sk_pn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 92 | func sk_step(st: *i64) -> i64 called by 1: sk_pm |
| 99 | func sk_pm(st: *i64, amp: i64) -> i64 { if amp <= 0 { return 0 } let r: i64 = sk_step(st) % (2*amp+1); return r - amp } |
| 100 | func sk_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 105 | func sk_atoi(s: *u8) -> i64 called by 1: main |
| 111 | func sk_wint(b: *u8, pos: *i64, v: i64, c: i64) -> i64 |
| 123 | func skR(b: *u8, pos: *i64, y: i64, xoff: i64, zoff: i64, ra: i64, rb: i64) -> i64 |
| 132 | func skP(b: *u8, pos: *i64, mir: i64, rot: i64, ox: i64, oy: i64, oz: i64, mat: i64, rotz: i64) -> i64 |
| 139 | func skF(b: *u8, pos: *i64, part: i64, y: i64, yw: i64, th: i64, tw: i64, amp: i64) -> i64 |
| 147 | func skO(b: *u8, pos: *i64, part: i64, y: i64, yw: i64, th: i64, tw: i64) -> i64 |
| 156 | func sk_emit(b: *u8, pos: *i64, st: *i64, sexf: i64, robust: i64, noise: i64) -> i64 |
| 292 | func sk_write(path: *u8, sexf: i64, seed: i64, robust: i64, noise: i64) -> i64 |
| 306 | func sk_count(path: *u8, ch: i64) -> i64 |
| 346 | func sk_tokn(d: *u8, n: i64, p: *i64, out: *i64) -> i64 called by 1: sk_ycheck |
| 372 | func sk_ycheck(path: *u8, out: *i64) -> i64 |
| 434 | func sk_gate() -> i64 |
| 507 | func main(argc: i64, argv: *i64) -> i64 |