code wiki / _hdl_build / nx_selfcontact_gate.nx

nx_selfcontact_gate.nx

buildroot/runtime/_hdl_build/nx_selfcontact_gate.nx

12487 B253 linesdepth 6pulls 9 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_selfcontact_gate.nx -- TWO TISSUE SURFACES CANNOT PASS THROUGH EACH OTHER (softbody SB10). THE ORACLE IS A MEASUREMENT, NOT THE ROUTINE'S OPINION. st_self_contact returns how many pairs it found in contact, and grading it on its own count would be circular -- a routine that resolved nothing and reported zero scores identically to one that worked. Every outcome tooth here is graded on st_sc_min_sep, an INDEPENDENT all-pairs scan of the closest surface-to-surface approach. SCOPE. Non-interpenetration only. Friction at self-contact is deliberately NOT in this rung -- see st_self_contact's note: bundling them is the compound bar that kept the old SB3 from ever closing, and mu is UNSET estate-wide for want of a citation, so a friction term would provably do nothing here while making the rung look bigger than it is. THREE RED RUNS BUILT THIS GATE, AND ALL THREE WERE ONE MISTAKE: ASKING A QUESTION ABOUT SURFACES WITH AN INSTRUMENT THAT ANSWERS ABOUT BOXES OR AXES. 1. Placement by bounding-box overlap left the nearest surfaces 397 cmm apart -- overlapping boxes say the bodies occupy nearby space, never that any two points of them are close. T1 caught it. 2. "Did it move" by bounding extreme read zero, because these cages meet mid-body and the particle at max_x is nowhere near the contact. 3. "Did it move" by x displacement ALSO read zero -- correctly. sc_place leaves the cages overlapping in x, so the nearest surfaces meet on their flanks and the contact normal is mostly y and z. The instrument was right; the AXIS was an assumption nobody had checked. So every tooth below is axis-free, and the displacement instrument carries a planted-shift control: a zero from it can never again be confused with a correction that did not happen. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_softtissue.nx nx_gate_verdict.nx nx_selfcontact_gate.nx

imports: nx_syscalls.nxnx_softtissue.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_ctr 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 sys_write ↻ nxa_dump_sizes sys_write ↻ gv_head gv_puts sys_write ↻ st_new sys_mmap ↻ st_profile st_profile_seeded st_hash pg_sample pg_has_bound pg_bound pg_bound ↻ st_span st_hash ↻ st_profile ↻ st_inside st_wall_drop st_abs st_isqrt vm_isqrt st_six_vol st_div_r st_layer_alpha_vol

structs

none

consts

29const SC_G: i64 = 9800
30const SC_ITERS: i64 = 8
31const SC_SETTLE: i64 = 40
32const SC_H_MM: i64 = 10
36const SC_DIST_FALLBACK: i64 = 300 // only if the mesh reports no spacing at all, which is a REFUSAL case
37const SC_PASSES: i64 = 24 // projection passes
38const SC_FAR: i64 = 100000 // 1 m apart: the broad phase must reject this for free
39const SC_SNAP: i64 = 4096 // >= any profile's particle count (largest measured is 1636)
40const SC_PLANT: i64 = 7 // planted displacement for the instrument's own control, cmm
44const SC_TOL: i64 = SC_PASSES

functions

49func sc_translate(W: *i64, dx: i64, dy: i64, dz: i64) -> i64
called by 2: sc_placemain
63func sc_nsurf(W: *i64) -> i64
called by 1: main
74func sc_snap3(W: *i64, sx: *i64, sy: *i64, sz: *i64) -> i64
called by 1: main
90func sc_moved(W: *i64, sx: *i64, sy: *i64, sz: *i64) -> i64
called by 1: main
111func sc_place(A: *i64, B: *i64, target: i64) -> i64
133func sc_settled(W: *i64) -> i64
called by 1: main calls 1: st_run
138func main() -> i64