code wiki / _hdl_build / nx_skullsdf.nx

nx_skullsdf.nx

buildroot/runtime/_hdl_build/nx_skullsdf.nx

65112 B1179 linesdepth 4pulls 7 transitivereach 0 importersview sourcekind tool
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 3 imports · 0 importers

nx_isosurf.nx nx_itoa_lib.nx nx_memfloor.nx nx_skullsdf.nx

imports: nx_isosurf.nxnx_itoa_lib.nxnx_memfloor.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main ss_puts ss_streq ss_atoi ss_tune ss_load_ref sys_read_file sys_openat_rd sys_lseek sys_mmap sys_read sys_close ss_rd32 ss_r_f32 ss_puts ↻ ss_bin_ref sg_cell ss_defaults ss_score2 ss_score_fwd ss_field_p ss_ellipsoid ss_isqrt ss_min ss_smin ss_min ↻ ss_abs ss_k ss_capsule ss_isqrt ↻ ss_sub ss_max ss_score_rev ss_field_p ↻ ss_near_ref ss_isqrt ↻ ss_score_fwd ↻ ss_score_rev ↻ ss_pn nxi_out

structs

none

consts

21const SS_MAGIC_2026: i64 = 2026
22const SS_MAGIC_1024: i64 = 1024
23const SS_MAGIC_8388608: i64 = 8388608
24const SS_MAGIC_8388607: i64 = 8388607
25const SS_MAGIC_40000: i64 = 40000
27const SS_G: i64 = 160 // grid cells per axis
28const SS_EXT: i64 = 120 // world half-extent in MILLIMETRES. A male skull is ~185mm long and
42const SS_SCALE: i64 = 1000
43const SS_REF_W: i64 = 151 // reference bounding box, mm, measured off BodyParts3D
44const SS_REF_H: i64 = 209
45const SS_REF_D: i64 = 215
46const SS_TOL: i64 = 25 // mm each dimension may differ before the build is called wrong
47const SS_Q: i64 = 1024 // fixed point for the distance functions
48const SS_NQ: i64 = 4096 // the scale surface_nets emits gradient normals in (nx_isosurf.nx:68)
49const SS_ISO: i64 = 0
50const SS_BONE: i64 = 0xe8e0d8
62const SS_K: i64 = 6
216const SP_N: i64 = 20
217const P_VW: i64 = 0 // vault half-width
218const P_VH: i64 = 1 // vault half-height
219const P_VD: i64 = 2 // vault half-depth
220const P_VY: i64 = 3 // vault centre y
221const P_VZ: i64 = 4 // vault centre z
222const P_FY: i64 = 5 // frontal centre y
223const P_FZ: i64 = 6 // frontal centre z
224const P_FH: i64 = 7 // frontal half-height
225const P_FD: i64 = 8 // frontal half-depth
226const P_MY: i64 = 9 // maxilla centre y
227const P_MZ: i64 = 10 // maxilla centre z
228const P_MW: i64 = 11 // maxilla half-width
229const P_MH: i64 = 12 // maxilla half-height
230const P_MD: i64 = 13 // maxilla half-depth
231const P_JY: i64 = 14 // mandible chin y
232const P_JZ: i64 = 15 // mandible chin z
233const P_RX: i64 = 16 // ramus x offset
234const P_RY: i64 = 17 // ramus centre y
235const P_OR: i64 = 18 // orbit radius
236const P_OX: i64 = 19 // orbit centre x
351const SS_LAT_MID: i64 = 25 // |x| under this is the midline column
352const SS_LAT_FAR: i64 = 55 // |x| over this is the far-lateral column (temple / zygomatic arch / gonion)
575const SG_DIM: i64 = 24 // spatial hash grid, cells per axis
576const SG_EXT: i64 = 140 // half-extent covered, mm

functions

72func ss_k() -> i64 { if SS_KSET == 1 { return SS_KVAL } return SS_K }
called by 2: ss_field_pss_grad
74func 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 }
79func ss_pn(v: i64) -> i64 { nxi_out(v); return 0 }
80func ss_atoi(s: *u8) -> i64
called by 1: main
86func ss_streq(a: *u8, b: *u8) -> i64
called by 1: main
91func ss_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 }
92func ss_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 2: ss_sminmain
93func ss_min(a: i64, b: i64) -> i64 { if a<b { return a } return b }
called by 2: ss_ellipsoidss_smin
94func ss_max(a: i64, b: i64) -> i64 { if a>b { return a } return b }
called by 1: ss_sub
107func ss_ellipsoid(px: i64, py: i64, pz: i64, cx: i64, cy: i64, cz: i64, rx: i64, ry: i64, rz: i64) -> i64
called by 1: ss_field_p calls 2: ss_isqrtss_min
182func ss_capsule(px: i64, py: i64, pz: i64, ax: i64, ay: i64, az: i64, bx: i64, by: i64, bz: i64, r: i64) -> i64
called by 1: ss_field_p calls 1: ss_isqrt
198func ss_smin(a: i64, b: i64, k: i64) -> i64
called by 1: ss_field_p calls 2: ss_minss_abs
205func ss_sub(a: i64, b: i64) -> i64 { return ss_max(a, 0-b) }
called by 1: ss_field_p calls 1: ss_max
241func ss_defaults(P: *i64) -> i64
called by 2: ss_pdefss_tune
250func ss_field_p(px: i64, py: i64, pz: i64, sexf: i64, robust: i64, P: *i64) -> i64
294func ss_pdef() -> *i64
called by 1: ss_field calls 1: ss_defaults
301func ss_field(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64
309func ss_field_world(px: i64, py: i64, pz: i64, sexf: i64, robust: i64) -> i64
called by 1: main calls 1: ss_field
353func ss_tdepth2(y: i64, ax: i64) -> i64
called by 1: ss_tdepth
370func ss_tdepth(y: i64) -> i64 { return ss_tdepth2(y, 0) }
called by 1: main calls 1: ss_tdepth2
371func ss_f32(v: i64, scale: i64) -> i64
called by 1: main
389func ss_wr32(b: *u8, o: i64, v: i64) -> i64
called by 1: main
405func ss_bandix(y: i64) -> i64
called by 1: ss_thick
416func ss_band_req(ix: i64) -> i64
called by 1: ss_thick
427func ss_rd32(b: *u8, o: i64) -> i64
430func ss_r_f32(bits: i64, scale: i64) -> i64
452func ss_fit(path: *u8, sexf: i64, robust: i64, stride: i64) -> i64
519func ss_load_ref(path: *u8, RX: *i64, RY: *i64, RZ: *i64, cap: i64, stride: i64) -> i64
578func sg_cell(x: i64, y: i64, z: i64) -> i64
called by 1: ss_bin_ref
591func ss_bin_ref(RX: *i64, RY: *i64, RZ: *i64, n: i64, head: *i64, next: *i64) -> i64
called by 1: ss_tune calls 1: sg_cell
604func ss_near_ref(x: i64, y: i64, z: i64, RX: *i64, RY: *i64, RZ: *i64, head: *i64, next: *i64) -> i64
called by 1: ss_score_rev calls 1: ss_isqrt
643func ss_score_fwd(RX: *i64, RY: *i64, RZ: *i64, n: i64, sexf: i64, robust: i64, P: *i64) -> i64
called by 2: ss_score2ss_tune calls 1: ss_field_p
657func ss_score_rev(RX: *i64, RY: *i64, RZ: *i64, n: i64, head: *i64, next: *i64,
683func ss_score2(RX: *i64, RY: *i64, RZ: *i64, n: i64, head: *i64, next: *i64,
called by 1: ss_tune calls 2: ss_score_fwdss_score_rev
692func ss_tune(path: *u8, sexf: i64, robust: i64, stride: i64, passes: i64) -> i64
749func ss_thick(path: *u8, sexf: i64, robust: i64, stride: i64) -> i64
822func ss_grad(sexf: i64, robust: i64, step: i64, near: i64) -> i64
868func main(argc: i64, argv: *i64) -> i64