nx_skullsdf_region_gate_t334.nx
buildroot/runtime/nx_skullsdf_region_gate_t334.nx
about
nx_skullsdf.nx -- the skull as a FUSED SHELL WITH OPENINGS, built in the implicit path.
★WHY THIS EXISTS, from two render cycles of evidence rather than preference. nx_skullgen emits the
skull as seven LOFTED TUBES. Rendered, that is seven separate objects sharing a bounding box: the
nasal bones float clear of the face, the zygomatic arch is a rod passing through nothing, and the
braincase is a balloon with a jaw hanging near it. Moving the tubes closer helps a little and cannot
fix the class of problem, because A SKULL IS NOT A SET OF TUBES -- it is one continuous fused shell
with holes cut in it. Tubes cannot fuse and cannot have holes.
★THE IMPLICIT PATH DOES EXACTLY THOSE TWO THINGS AND WE ALREADY OWN IT: smooth-union joins bones into
one surface, subtraction cuts the orbits and the nasal aperture as real openings, and nx_isosurf's
surface_nets polygonizes the result into nx_trimesh. The plan reserved SDF for viscera on the grounds
that it cannot resolve an eyelash -- true, and irrelevant to bone, whose features are centimetres.
⚠So this does NOT replace the loft path for skin. It claims the skull only.
nx_skullsdf <out.nxmesh> [sex 0-1000] [robust 0-1000] [grid]
license_tier: ORIGINAL expect_exit: 0 No hw writes (Rule 26).
dependencies 6 imports · 0 importers
imports: nx_isosurf.nxnx_itoa_lib.nxnx_memfloor.nxnx_sdfprim_lib.nxnx_fieldfit_verified_r3_t333.nxnx_sha256.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
| 24 | const SS_MAGIC_2026: i64 = 2026 |
| 25 | const SS_MAGIC_1024: i64 = 1024 |
| 26 | const SS_MAGIC_8388608: i64 = 8388608 |
| 27 | const SS_MAGIC_8388607: i64 = 8388607 |
| 28 | const SS_MAGIC_40000: i64 = 40000 |
| 30 | const SS_G: i64 = 160 // grid cells per axis |
| 31 | const SS_EXT: i64 = 120 // world half-extent in MILLIMETRES. A male skull is ~185mm long and |
| 45 | const SS_SCALE: i64 = 1000 |
| 46 | const SS_REF_W: i64 = 151 // reference bounding box, mm, measured off BodyParts3D: x lateral |
| 47 | const SS_REF_H: i64 = 215 // HEIGHT = the file's z extent (BodyParts3D is a floor-origin z-UP body frame) |
| 48 | const SS_REF_D: i64 = 209 // DEPTH = the file's y extent (antero-posterior, face at -y). Until 2026-09-18 the two |
| 50 | const SS_TOL: i64 = 25 // mm each dimension may differ before the build is called wrong |
| 51 | const SS_Q: i64 = SP_Q // fixed point for the distance functions |
| 52 | const SS_NQ: i64 = 4096 // the scale surface_nets emits gradient normals in (nx_isosurf.nx:68) |
| 53 | const SS_ISO: i64 = 0 |
| 54 | const SS_BONE: i64 = 0xe8e0d8 |
| 67 | const SS_RDQ: i64 = 256 // fixed-point units per millimetre in the redistanced field |
| 68 | const SS_RD_INF: i64 = 76800 // 300mm x SS_RDQ -- farther than any point in the sampled box |
| 78 | const SS_FQ: i64 = SP_FQ |
| 79 | const SS_RD_NEAR: i64 = 3 // near-band half-width, cells, for the printed |grad| A/B |
| 80 | const SS_RD_LO: i64 = 800 // |grad| per-mille below this counts under (same bar as ss_grad) |
| 81 | const SS_RD_HI: i64 = 1200 // |grad| per-mille above this counts over (same bar as ss_grad) |
| 96 | const SS_K: i64 = 3 |
| 148 | const SS_BHASKARA_NUM_PERMILLE: i64 = 4000 |
| 149 | const SS_BHASKARA_DEN: i64 = 40500 |
| 151 | const SS_LERP_ONE: i64 = 1024 |
| 156 | const SS_PERMILLE: i64 = 1000 |
| 159 | const SS_EXTENT_SENTINEL: i64 = 999999 |
| 163 | const SS_GRAD_BAND_LO: i64 = 800 |
| 164 | const SS_GRAD_BAND_HI: i64 = 1200 |
| 166 | const SS_MARCH_CELLS_DEFAULT: i64 = 2000 |
| 167 | const SS_MARCH_CELLS_MIN: i64 = 1000 |
| 177 | const SP_N: i64 = 87 |
| 178 | const SS_FIT_MIN: i64 = 58 // the v1 vector length: a fit file carrying at least this many ints |
| 182 | const P_VW: i64 = 0 // vault half-width |
| 183 | const P_VH: i64 = 1 // vault half-height |
| 184 | const P_VD: i64 = 2 // vault half-depth |
| 185 | const P_VY: i64 = 3 // vault centre y |
| 186 | const P_VZ: i64 = 4 // vault centre z |
| 187 | const P_FY: i64 = 5 // frontal centre y |
| 188 | const P_FZ: i64 = 6 // frontal centre z |
| 189 | const P_FH: i64 = 7 // frontal half-height |
| 190 | const P_FD: i64 = 8 // frontal half-depth |
| 191 | const P_MY: i64 = 9 // maxilla centre y |
| 192 | const P_MZ: i64 = 10 // maxilla centre z |
| 193 | const P_MW: i64 = 11 // maxilla half-width |
| 194 | const P_MH: i64 = 12 // maxilla half-height |
| 195 | const P_MD: i64 = 13 // maxilla half-depth |
| 196 | const P_JY: i64 = 14 // mandible chin y |
| 197 | const P_JZ: i64 = 15 // mandible chin z |
| 198 | const P_RX: i64 = 16 // ramus x offset |
| 199 | const P_RY: i64 = 17 // ramus centre y |
| 200 | const P_OR: i64 = 18 // orbit radius |
| 201 | const P_OX: i64 = 19 // orbit centre x |
| 207 | const P_BX: i64 = 20 // brow bar half-span |
| 208 | const P_BY: i64 = 21 // brow bar y |
| 209 | const P_BZ: i64 = 22 // brow bar z |
| 210 | const P_ZAX: i64 = 23 // zygomatic arch face-end x |
| 211 | const P_ZAY: i64 = 24 // zygomatic arch face-end y |
| 212 | const P_ZAZ: i64 = 25 // zygomatic arch face-end z |
| 213 | const P_ZBX: i64 = 26 // zygomatic arch ear-end x |
| 214 | const P_ZBY: i64 = 27 // zygomatic arch ear-end y |
| 215 | const P_ZBZ: i64 = 28 // zygomatic arch ear-end z |
| 216 | const P_ZR: i64 = 29 // zygomatic arch radius |
| 217 | const P_NY: i64 = 30 // nasal bones centre y |
| 218 | const P_NZ: i64 = 31 // nasal bones centre z |
| 219 | const P_NRX: i64 = 32 // nasal radius x |
| 220 | const P_NRY: i64 = 33 // nasal radius y |
| 221 | const P_NRZ: i64 = 34 // nasal radius z |
| 222 | const P_JAX: i64 = 35 // jaw body chin-end x |
| 223 | const P_JAZ: i64 = 36 // jaw body chin-end z offset from P_JZ |
| 224 | const P_JBX: i64 = 37 // jaw body angle-end x |
| 225 | const P_JBY: i64 = 38 // jaw body angle-end y offset from P_JY |
| 226 | const P_JBZ: i64 = 39 // jaw body angle-end z |
| 227 | const P_JR: i64 = 40 // jaw body radius |
| 228 | const P_RZ: i64 = 41 // ramus centre z |
| 229 | const P_RRX: i64 = 42 // ramus radius x |
| 230 | const P_RRY: i64 = 43 // ramus radius y |
| 231 | const P_RRZ: i64 = 44 // ramus radius z |
| 232 | const P_OAY: i64 = 45 // orbit opening y |
| 233 | const P_OAZ: i64 = 46 // orbit opening z |
| 234 | const P_OBX: i64 = 47 // orbit apex x |
| 235 | const P_OBY: i64 = 48 // orbit apex y |
| 236 | const P_OBZ: i64 = 49 // orbit apex z |
| 237 | const P_PAY: i64 = 50 // nasal aperture opening y |
| 238 | const P_PAZ: i64 = 51 // nasal aperture opening z |
| 239 | const P_PBY: i64 = 52 // nasal aperture back y |
| 240 | const P_PBZ: i64 = 53 // nasal aperture back z |
| 241 | const P_PR: i64 = 54 // nasal aperture radius |
| 242 | const P_CRX: i64 = 55 // chin ellipsoid radius x |
| 243 | const P_CRY: i64 = 56 // chin ellipsoid radius y |
| 244 | const P_CRZ: i64 = 57 // chin ellipsoid radius z |
| 249 | const P_UY: i64 = 58 // upper arch: occlusal centre y |
| 250 | const P_UZ: i64 = 59 // upper arch: arc centre z |
| 251 | const P_UAX: i64 = 60 // upper arch: lateral semi-axis |
| 252 | const P_UAZ: i64 = 61 // upper arch: anterior semi-axis |
| 253 | const P_UTH: i64 = 62 // upper arch: half arc span, degrees |
| 254 | const P_UN: i64 = 63 // upper arch: tooth count |
| 255 | const P_UTW: i64 = 64 // upper arch: tooth width |
| 256 | const P_UTHT: i64 = 65 // upper arch: tooth height |
| 257 | const P_UPR: i64 = 66 // upper arch: molar widening, permil at the arc ends |
| 258 | const P_LY: i64 = 67 // lower arch: occlusal centre y |
| 259 | const P_LZ: i64 = 68 // lower arch: arc centre z |
| 260 | const P_LAX: i64 = 69 // lower arch: lateral semi-axis |
| 261 | const P_LAZ: i64 = 70 // lower arch: anterior semi-axis |
| 262 | const P_LTH: i64 = 71 // lower arch: half arc span, degrees |
| 263 | const P_LN: i64 = 72 // lower arch: tooth count |
| 264 | const P_LTW: i64 = 73 // lower arch: tooth width |
| 265 | const P_LTHT: i64 = 74 // lower arch: tooth height |
| 266 | const P_LPR: i64 = 75 // lower arch: molar widening, permil at the arc ends |
| 272 | const P_OSW: i64 = 76 // orbit socket semi-width x (the rim's lateral half-span) |
| 273 | const P_OSH: i64 = 77 // orbit socket semi-height y |
| 274 | const P_OSD: i64 = 78 // orbit socket semi-depth z (the back wall sits at P_OCZ - P_OSD, inside the bone) |
| 275 | const P_OCZ: i64 = 79 // orbit socket centre z; the front pokes through the face at P_OCZ + P_OSD |
| 276 | const P_PAW: i64 = 80 // piriform aperture width (rim to rim) |
| 277 | const P_PAH: i64 = 81 // piriform aperture height (rhinion to nasospinale) |
| 278 | const P_PAD: i64 = 82 // piriform aperture depth: the nasal floor wall sits P_PAD behind the rim at P_PAZ |
| 279 | const P_NTILT: i64 = 83 // nasal plate pitch, degrees: the rhinion end forward of the nasion end |
| 280 | const P_NTH: i64 = 84 // nasal plate half-thickness |
| 281 | const P_AAR: i64 = 85 // alveolar process radius: the U-arch of bone the upper teeth stand in |
| 282 | const P_FPR: i64 = 86 // maxillary frontal process radius (the bone either side of the aperture, up to the orbits) |
| 501 | const SS_LAT_MID: i64 = 25 // |x| under this is the midline column |
| 502 | const SS_LAT_FAR: i64 = 55 // |x| over this is the far-lateral column (temple / zygomatic arch / gonion) |
| 527 | const SS_TD_N: i64 = 9 |
| 844 | const SG_DIM: i64 = 24 // spatial hash grid, cells per axis |
| 845 | const SG_EXT: i64 = 140 // half-extent covered, mm |
| 846 | const SS_TUNE_LAT: i64 = 6 // reverse-term lattice spacing, mm (the objective's sampling of OUR surface) |
| 847 | const SS_GR_N: i64 = 7 // the named regions of ss_gap_region (vault, base, brow-orbits, nasal, zygomatic, mandible, maxilla) |
| 857 | const SS_LMQ_N: i64 = 18 // the ruler's quantity count, in skc_qname order (15 + the three of 2026-09-19) |
| 858 | const SS_LMQ_PRED: i64 = 16 // the quantities this field can place from its stations |
| 859 | const SS_LMQ_BYTES: i64 = 4096 |
| 860 | const SS_LMQ_NONE: i64 = 0 - 999999999 // "this quantity is not predicted from the stations" -- a value no landmark can reach |
| 1236 | const SS_RES_MAGIC: i64 = 0x4e585253 // 'NXRS' |
| 1237 | const SS_RES_MAXN: i64 = 256 // lattice nodes per axis, upper bound (256^3 x 8 = 134MB; |
functions
| 106 | func ss_k() -> i64 { if SS_KSET == 1 { return SS_KVAL } return SS_K } |
| 108 | func ss_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 113 | func ss_pn(v: i64) -> i64 { nxi_out(v); return 0 } |
| 114 | func ss_atoi(s: *u8) -> i64 |
| 120 | func ss_streq(a: *u8, b: *u8) -> i64 |
| 125 | func ss_isqrt(v: i64) -> i64 { return sp_isqrt(v) } |
| 126 | func ss_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } called by 1: ss_candidate_main |
| 127 | func ss_min(a: i64, b: i64) -> i64 { if a<b { return a } return b } |
| 128 | func ss_max(a: i64, b: i64) -> i64 { if a>b { return a } return b } |
| 286 | func ss_param_live(k: i64) -> i64 |
| 308 | func ss_defaults(P: *i64) -> i64 |
| 342 | func ss_field_p(px: i64, py: i64, pz: i64, sexf: i64, robust: i64, P: *i64) -> i64 |
| 347 | func ss_field_p_q(px: i64, py: i64, pz: i64, sexf: i64, robust: i64, P: *i64) -> i64 called by 2: ss_field_pss_field_world_q calls 11: ss_ksp_ellipsoid_qsp_sminsp_capsule_qsp_arch_qsp_ring_q+5 |
| 429 | func ss_load_fit(P: *i64) -> i64 |
| 437 | func ss_pdef() -> *i64 |
| 446 | func ss_field(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64 |
| 454 | func ss_field_world(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64 |
| 459 | func ss_field_world_q(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64 |
| 503 | func ss_tdepth2(y: i64, ax: i64) -> i64 called by 1: ss_tdepth |
| 520 | func ss_tdepth(y: i64) -> i64 { return ss_tdepth2(y, 0) } |
| 530 | func ss_td_tab() -> i64 called by 1: ss_tdepth_q |
| 550 | func ss_tdepth_q(y: i64) -> i64 |
| 567 | func ss_f32(v: i64, scale: i64) -> i64 |
| 585 | func ss_wr32(b: *u8, o: i64, v: i64) -> i64 |
| 601 | func ss_bandix(y: i64) -> i64 called by 1: ss_thick |
| 612 | func ss_band_req(ix: i64) -> i64 called by 1: ss_thick |
| 623 | func ss_rd32(b: *u8, o: i64) -> i64 |
| 626 | func ss_r_f32(bits: i64, scale: i64) -> i64 |
| 659 | func ss_ref_map(buf: *u8, o: i64, cx: i64, cy: i64, cz: i64, scale: i64, out3: *i64) -> i64 |
| 665 | func ss_ref_map_normal(buf: *u8, o: i64, scale: i64, out3: *i64) -> i64 |
| 671 | func ss_fit(path: *u8, sexf: i64, robust: i64, stride: i64) -> i64 |
| 740 | func ss_reference_verified(buf: *u8, n: i64) -> i64 |
| 778 | func ss_load_ref(path: *u8, RX: *i64, RY: *i64, RZ: *i64, cap: i64, stride: i64) -> i64 |
| 864 | func ss_lm_load() -> i64 |
| 900 | func ss_lm_predict(P: *i64, Q: *i64) -> i64 |
| 944 | func ss_lm_term(P: *i64) -> i64 |
| 968 | func ss_params_valid(P: *i64, np: i64) -> i64 called by 1: ss_tune |
| 1013 | func ss_contract_cat(b: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i] != 0 { b[o+i]=s[i]; i=i+1 } return o+i } called by 1: ss_fit_contract |
| 1014 | func ss_fit_contract(sexf: i64, robust: i64, stride: i64) -> *FfFitContract |
| 1026 | func ss_tune(path: *u8, sexf: i64, robust: i64, stride: i64, passes: i64, step0: i64, save: *u8) -> i64 |
| 1097 | func ss_thick(path: *u8, sexf: i64, robust: i64, stride: i64) -> i64 |
| 1170 | func ss_grad(sexf: i64, robust: i64, step: i64, near: i64) -> i64 |
| 1247 | func ss_res_load(path: *u8) -> i64 called by 1: ss_candidate_main |
| 1264 | func ss_res_at(x: i64, y: i64, z: i64) -> i64 called by 1: ss_candidate_main |
| 1315 | func ss_vb_count(rbuf: *u8, rhdr: i64, rnt: i64, cy: i64, cz: i64, ocy: i64, ocz: i64, |
| 1355 | func ss_vb_build(rbuf: *u8, rhdr: i64, rnt: i64, cx: i64, cy: i64, cz: i64, ocx: i64, ocy: i64, ocz: i64, |
| 1403 | func ss_gap_region_p(x: i64, y: i64, z: i64, P: *i64) -> i64 |
| 1428 | func ss_gap_region(x: i64, y: i64, z: i64) -> i64 |
| 1431 | func ss_fit_region(x: i64, y: i64, z: i64) -> i64 |
| 1434 | func ss_gap_regname(i: i64) -> i64 |
| 1445 | func ss_gap_wrcol(b: *u8, o: i64, gq: i64) -> i64 |
| 1466 | func ss_gap_node(w: i64, org: i64, cell: i64, n1: i64) -> i64 called by 1: ss_gapmap |
| 1473 | func ss_gap_wrhdr(buf: *u8, nt: i64) -> i64 |
| 1489 | func ss_gapmap(ref: *u8, oursout: *u8, oraout: *u8, sexf: i64, robust: i64, cum: i64, resout: *u8, latmm: i64) -> i64 called by 1: ss_candidate_main calls 28: mf_admitss_field_worldss_rd_tryss_rd_sweepss_putsss_rd32+22 |
| 2026 | func ss_voxref(ref: *u8, outp: *u8, cum: i64) -> i64 |
| 2249 | func ss_rd_try(f: i64, g: i64, cell: i64, best: i64) -> i64 |
| 2268 | func ss_rd_solve(a0: i64, b0: i64, c0: i64, h: i64) -> i64 |
| 2291 | func ss_rd_sweep(dist: *i64, n1: i64, h: i64, di: i64, dj: i64, dk: i64) -> i64 |
| 2344 | func ss_rd_gradstat(F: *i64, n1: i64, cell: i64, q: i64, tag: *u8) -> i64 |
| 2393 | func ss_candidate_main(argc: i64, argv: *i64) -> i64 |
| 2892 | func ss_region_prior_main(argc: i64, argv: *i64) -> i64 |
| 2913 | func main(argc: i64, argv: *i64) -> i64 |