code wiki / (root) / nx_skullsdf_verified_r4_t333.nx

nx_skullsdf_verified_r4_t333.nx

buildroot/runtime/nx_skullsdf_verified_r4_t333.nx

153803 B2900 linesdepth 5pulls 15 transitivereach 0 importersview sourcekind tooltopic skullsdf
docsdependenciesstructsconstsfunctions

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

nx_isosurf.nx nx_itoa_lib.nx nx_memfloor.nx nx_sdfprim_lib.nx nx_fieldfit_verified_r3_t333.nx nx_sha256.nx nx_skullsdf_verified_r4_t333.n

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

main ss_streq ss_candidate_main ss_puts ss_streq ↻ ss_atoi ss_tune ff_ctx_new sys_mmap nxa_die sys_write sys_exit nxa_lock_take nxa_lock_addr sys_write ↻ nxa_lock_give nxa_lock_addr ↻ nxa_report_overrun sys_write ↻ nxa_dump_printable nxa_dump_sizes ss_load_ref ss_reference_verified sha256_digest_checked_nati sha256_checked_input sys_mmap_shared sha256_workspace_bytes sha256_digest_mapping_nati ss_puts ↻ ss_rd32 ss_r_f32 ss_ref_map ss_r_f32 ↻ ss_rd32 ↻ ss_puts ↻ ff_bin ff_cell ff_regions ss_defaults ss_params_valid

structs

none

consts

24const SS_MAGIC_2026: i64 = 2026
25const SS_MAGIC_1024: i64 = 1024
26const SS_MAGIC_8388608: i64 = 8388608
27const SS_MAGIC_8388607: i64 = 8388607
28const SS_MAGIC_40000: i64 = 40000
30const SS_G: i64 = 160 // grid cells per axis
31const SS_EXT: i64 = 120 // world half-extent in MILLIMETRES. A male skull is ~185mm long and
45const SS_SCALE: i64 = 1000
46const SS_REF_W: i64 = 151 // reference bounding box, mm, measured off BodyParts3D: x lateral
47const SS_REF_H: i64 = 215 // HEIGHT = the file's z extent (BodyParts3D is a floor-origin z-UP body frame)
48const SS_REF_D: i64 = 209 // DEPTH = the file's y extent (antero-posterior, face at -y). Until 2026-09-18 the two
50const SS_TOL: i64 = 25 // mm each dimension may differ before the build is called wrong
51const SS_Q: i64 = SP_Q // fixed point for the distance functions
52const SS_NQ: i64 = 4096 // the scale surface_nets emits gradient normals in (nx_isosurf.nx:68)
53const SS_ISO: i64 = 0
54const SS_BONE: i64 = 0xe8e0d8
67const SS_RDQ: i64 = 256 // fixed-point units per millimetre in the redistanced field
68const SS_RD_INF: i64 = 76800 // 300mm x SS_RDQ -- farther than any point in the sampled box
78const SS_FQ: i64 = SP_FQ
79const SS_RD_NEAR: i64 = 3 // near-band half-width, cells, for the printed |grad| A/B
80const SS_RD_LO: i64 = 800 // |grad| per-mille below this counts under (same bar as ss_grad)
81const SS_RD_HI: i64 = 1200 // |grad| per-mille above this counts over (same bar as ss_grad)
96const SS_K: i64 = 3
148const SS_BHASKARA_NUM_PERMILLE: i64 = 4000
149const SS_BHASKARA_DEN: i64 = 40500
151const SS_LERP_ONE: i64 = 1024
156const SS_PERMILLE: i64 = 1000
159const SS_EXTENT_SENTINEL: i64 = 999999
163const SS_GRAD_BAND_LO: i64 = 800
164const SS_GRAD_BAND_HI: i64 = 1200
166const SS_MARCH_CELLS_DEFAULT: i64 = 2000
167const SS_MARCH_CELLS_MIN: i64 = 1000
177const SP_N: i64 = 87
178const SS_FIT_MIN: i64 = 58 // the v1 vector length: a fit file carrying at least this many ints
182const P_VW: i64 = 0 // vault half-width
183const P_VH: i64 = 1 // vault half-height
184const P_VD: i64 = 2 // vault half-depth
185const P_VY: i64 = 3 // vault centre y
186const P_VZ: i64 = 4 // vault centre z
187const P_FY: i64 = 5 // frontal centre y
188const P_FZ: i64 = 6 // frontal centre z
189const P_FH: i64 = 7 // frontal half-height
190const P_FD: i64 = 8 // frontal half-depth
191const P_MY: i64 = 9 // maxilla centre y
192const P_MZ: i64 = 10 // maxilla centre z
193const P_MW: i64 = 11 // maxilla half-width
194const P_MH: i64 = 12 // maxilla half-height
195const P_MD: i64 = 13 // maxilla half-depth
196const P_JY: i64 = 14 // mandible chin y
197const P_JZ: i64 = 15 // mandible chin z
198const P_RX: i64 = 16 // ramus x offset
199const P_RY: i64 = 17 // ramus centre y
200const P_OR: i64 = 18 // orbit radius
201const P_OX: i64 = 19 // orbit centre x
207const P_BX: i64 = 20 // brow bar half-span
208const P_BY: i64 = 21 // brow bar y
209const P_BZ: i64 = 22 // brow bar z
210const P_ZAX: i64 = 23 // zygomatic arch face-end x
211const P_ZAY: i64 = 24 // zygomatic arch face-end y
212const P_ZAZ: i64 = 25 // zygomatic arch face-end z
213const P_ZBX: i64 = 26 // zygomatic arch ear-end x
214const P_ZBY: i64 = 27 // zygomatic arch ear-end y
215const P_ZBZ: i64 = 28 // zygomatic arch ear-end z
216const P_ZR: i64 = 29 // zygomatic arch radius
217const P_NY: i64 = 30 // nasal bones centre y
218const P_NZ: i64 = 31 // nasal bones centre z
219const P_NRX: i64 = 32 // nasal radius x
220const P_NRY: i64 = 33 // nasal radius y
221const P_NRZ: i64 = 34 // nasal radius z
222const P_JAX: i64 = 35 // jaw body chin-end x
223const P_JAZ: i64 = 36 // jaw body chin-end z offset from P_JZ
224const P_JBX: i64 = 37 // jaw body angle-end x
225const P_JBY: i64 = 38 // jaw body angle-end y offset from P_JY
226const P_JBZ: i64 = 39 // jaw body angle-end z
227const P_JR: i64 = 40 // jaw body radius
228const P_RZ: i64 = 41 // ramus centre z
229const P_RRX: i64 = 42 // ramus radius x
230const P_RRY: i64 = 43 // ramus radius y
231const P_RRZ: i64 = 44 // ramus radius z
232const P_OAY: i64 = 45 // orbit opening y
233const P_OAZ: i64 = 46 // orbit opening z
234const P_OBX: i64 = 47 // orbit apex x
235const P_OBY: i64 = 48 // orbit apex y
236const P_OBZ: i64 = 49 // orbit apex z
237const P_PAY: i64 = 50 // nasal aperture opening y
238const P_PAZ: i64 = 51 // nasal aperture opening z
239const P_PBY: i64 = 52 // nasal aperture back y
240const P_PBZ: i64 = 53 // nasal aperture back z
241const P_PR: i64 = 54 // nasal aperture radius
242const P_CRX: i64 = 55 // chin ellipsoid radius x
243const P_CRY: i64 = 56 // chin ellipsoid radius y
244const P_CRZ: i64 = 57 // chin ellipsoid radius z
249const P_UY: i64 = 58 // upper arch: occlusal centre y
250const P_UZ: i64 = 59 // upper arch: arc centre z
251const P_UAX: i64 = 60 // upper arch: lateral semi-axis
252const P_UAZ: i64 = 61 // upper arch: anterior semi-axis
253const P_UTH: i64 = 62 // upper arch: half arc span, degrees
254const P_UN: i64 = 63 // upper arch: tooth count
255const P_UTW: i64 = 64 // upper arch: tooth width
256const P_UTHT: i64 = 65 // upper arch: tooth height
257const P_UPR: i64 = 66 // upper arch: molar widening, permil at the arc ends
258const P_LY: i64 = 67 // lower arch: occlusal centre y
259const P_LZ: i64 = 68 // lower arch: arc centre z
260const P_LAX: i64 = 69 // lower arch: lateral semi-axis
261const P_LAZ: i64 = 70 // lower arch: anterior semi-axis
262const P_LTH: i64 = 71 // lower arch: half arc span, degrees
263const P_LN: i64 = 72 // lower arch: tooth count
264const P_LTW: i64 = 73 // lower arch: tooth width
265const P_LTHT: i64 = 74 // lower arch: tooth height
266const P_LPR: i64 = 75 // lower arch: molar widening, permil at the arc ends
272const P_OSW: i64 = 76 // orbit socket semi-width x (the rim's lateral half-span)
273const P_OSH: i64 = 77 // orbit socket semi-height y
274const P_OSD: i64 = 78 // orbit socket semi-depth z (the back wall sits at P_OCZ - P_OSD, inside the bone)
275const P_OCZ: i64 = 79 // orbit socket centre z; the front pokes through the face at P_OCZ + P_OSD
276const P_PAW: i64 = 80 // piriform aperture width (rim to rim)
277const P_PAH: i64 = 81 // piriform aperture height (rhinion to nasospinale)
278const P_PAD: i64 = 82 // piriform aperture depth: the nasal floor wall sits P_PAD behind the rim at P_PAZ
279const P_NTILT: i64 = 83 // nasal plate pitch, degrees: the rhinion end forward of the nasion end
280const P_NTH: i64 = 84 // nasal plate half-thickness
281const P_AAR: i64 = 85 // alveolar process radius: the U-arch of bone the upper teeth stand in
282const P_FPR: i64 = 86 // maxillary frontal process radius (the bone either side of the aperture, up to the orbits)
500const SS_LAT_MID: i64 = 25 // |x| under this is the midline column
501const SS_LAT_FAR: i64 = 55 // |x| over this is the far-lateral column (temple / zygomatic arch / gonion)
526const SS_TD_N: i64 = 9
843const SG_DIM: i64 = 24 // spatial hash grid, cells per axis
844const SG_EXT: i64 = 140 // half-extent covered, mm
845const SS_TUNE_LAT: i64 = 6 // reverse-term lattice spacing, mm (the objective's sampling of OUR surface)
846const SS_GR_N: i64 = 7 // the named regions of ss_gap_region (vault, base, brow-orbits, nasal, zygomatic, mandible, maxilla)
856const SS_LMQ_N: i64 = 18 // the ruler's quantity count, in skc_qname order (15 + the three of 2026-09-19)
857const SS_LMQ_PRED: i64 = 16 // the quantities this field can place from its stations
858const SS_LMQ_BYTES: i64 = 4096
859const SS_LMQ_NONE: i64 = 0 - 999999999 // "this quantity is not predicted from the stations" -- a value no landmark can reach
1230const SS_RES_MAGIC: i64 = 0x4e585253 // 'NXRS'
1231const SS_RES_MAXN: i64 = 256 // lattice nodes per axis, upper bound (256^3 x 8 = 134MB;

functions

106func ss_k() -> i64 { if SS_KSET == 1 { return SS_KVAL } return SS_K }
108func 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 }
113func ss_pn(v: i64) -> i64 { nxi_out(v); return 0 }
114func ss_atoi(s: *u8) -> i64
120func ss_streq(a: *u8, b: *u8) -> i64
125func ss_isqrt(v: i64) -> i64 { return sp_isqrt(v) }
126func ss_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: ss_candidate_main
127func ss_min(a: i64, b: i64) -> i64 { if a<b { return a } return b }
128func ss_max(a: i64, b: i64) -> i64 { if a>b { return a } return b }
286func ss_param_live(k: i64) -> i64
308func ss_defaults(P: *i64) -> i64
called by 2: ss_pdefss_tune
342func ss_field_p(px: i64, py: i64, pz: i64, sexf: i64, robust: i64, P: *i64) -> i64
called by 1: ss_field calls 1: ss_field_p_q
347func ss_field_p_q(px: i64, py: i64, pz: i64, sexf: i64, robust: i64, P: *i64) -> i64
429func ss_load_fit(P: *i64) -> i64
called by 1: ss_pdef calls 1: ff_load_prefix
436func ss_pdef() -> *i64
445func ss_field(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64
453func ss_field_world(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64
called by 1: ss_gapmap calls 1: ss_field
458func ss_field_world_q(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64
502func ss_tdepth2(y: i64, ax: i64) -> i64
called by 1: ss_tdepth
519func ss_tdepth(y: i64) -> i64 { return ss_tdepth2(y, 0) }
called by 1: ss_candidate_main calls 1: ss_tdepth2
529func ss_td_tab() -> i64
called by 1: ss_tdepth_q
549func ss_tdepth_q(y: i64) -> i64
called by 1: ss_candidate_main calls 1: ss_td_tab
566func ss_f32(v: i64, scale: i64) -> i64
584func ss_wr32(b: *u8, o: i64, v: i64) -> i64
600func ss_bandix(y: i64) -> i64
called by 1: ss_thick
611func ss_band_req(ix: i64) -> i64
called by 1: ss_thick
622func ss_rd32(b: *u8, o: i64) -> i64
625func ss_r_f32(bits: i64, scale: i64) -> i64
658func ss_ref_map(buf: *u8, o: i64, cx: i64, cy: i64, cz: i64, scale: i64, out3: *i64) -> i64
called by 2: ss_fitss_load_ref calls 2: ss_r_f32ss_rd32
664func ss_ref_map_normal(buf: *u8, o: i64, scale: i64, out3: *i64) -> i64
calls 2: ss_r_f32ss_rd32
670func ss_fit(path: *u8, sexf: i64, robust: i64, stride: i64) -> i64
739func ss_reference_verified(buf: *u8, n: i64) -> i64
777func ss_load_ref(path: *u8, RX: *i64, RY: *i64, RZ: *i64, cap: i64, stride: i64) -> i64
863func ss_lm_load() -> i64
899func ss_lm_predict(P: *i64, Q: *i64) -> i64
943func ss_lm_term(P: *i64) -> i64
called by 1: ss_tune calls 1: ss_lm_predict
967func ss_params_valid(P: *i64, np: i64) -> i64
called by 1: ss_tune
1012func 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
1013func ss_fit_contract(sexf: i64, robust: i64, stride: i64) -> *FfFitContract
called by 2: ss_tunemain calls 2: ss_contract_catff_wint
1025func ss_tune(path: *u8, sexf: i64, robust: i64, stride: i64, passes: i64, step0: i64, save: *u8) -> i64
1091func ss_thick(path: *u8, sexf: i64, robust: i64, stride: i64) -> i64
1164func ss_grad(sexf: i64, robust: i64, step: i64, near: i64) -> i64
1241func ss_res_load(path: *u8) -> i64
called by 1: ss_candidate_main
1258func ss_res_at(x: i64, y: i64, z: i64) -> i64
called by 1: ss_candidate_main
1309func ss_vb_count(rbuf: *u8, rhdr: i64, rnt: i64, cy: i64, cz: i64, ocy: i64, ocz: i64,
called by 1: ss_voxref calls 2: ss_r_f32ss_rd32
1349func ss_vb_build(rbuf: *u8, rhdr: i64, rnt: i64, cx: i64, cy: i64, cz: i64, ocx: i64, ocy: i64, ocz: i64,
called by 1: ss_voxref calls 2: ss_r_f32ss_rd32
1397func ss_gap_region(x: i64, y: i64, z: i64) -> i64
called by 1: ss_gapmap calls 2: ss_pdefsp_icos
1423func ss_gap_regname(i: i64) -> i64
called by 1: ss_gapmap calls 1: ss_puts
1434func ss_gap_wrcol(b: *u8, o: i64, gq: i64) -> i64
called by 1: ss_gapmap calls 2: ss_wr32ss_f32
1455func ss_gap_node(w: i64, org: i64, cell: i64, n1: i64) -> i64
called by 1: ss_gapmap
1462func ss_gap_wrhdr(buf: *u8, nt: i64) -> i64
called by 2: ss_gapmapss_voxref calls 1: ss_wr32
1478func ss_gapmap(ref: *u8, oursout: *u8, oraout: *u8, sexf: i64, robust: i64, cum: i64, resout: *u8, latmm: i64) -> i64
2015func ss_voxref(ref: *u8, outp: *u8, cum: i64) -> i64
2238func ss_rd_try(f: i64, g: i64, cell: i64, best: i64) -> i64
2257func ss_rd_solve(a0: i64, b0: i64, c0: i64, h: i64) -> i64
called by 1: ss_rd_sweep calls 1: ss_isqrt
2280func ss_rd_sweep(dist: *i64, n1: i64, h: i64, di: i64, dj: i64, dk: i64) -> i64
2333func ss_rd_gradstat(F: *i64, n1: i64, cell: i64, q: i64, tag: *u8) -> i64
2382func ss_candidate_main(argc: i64, argv: *i64) -> i64
2881func main(argc: i64, argv: *i64) -> i64