code wiki / (root) / nx_mmdev_gate.nx

nx_mmdev_gate.nx

buildroot/runtime/nx_mmdev_gate.nx

6887 B118 linesdepth 4pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_mmdev_gate.nx -- GATE for the millimetre surface-deviation ruler (PG4, procgen.plan, 2026-08-24). A ruler is proven by geometry whose true answer is known BEFORE the ruler runs. The fixtures here are NXMSH2 meshes written through the same nx_nxmesh_lib the ruler reads, so the codec round-trip is under test too, in caller-owned mmap -- never a production plane. KNOWN ANSWERS: a unit square (two triangles, 100 mm on a side) against a copy of itself lifted 5.0 mm along its normal. Every vertex of one sits exactly 5.0 mm from the other's surface, so mean, p95 and max must ALL read 50 in tenths of a millimetre. A wrong point-triangle case (edge or corner region taken instead of the face) would read larger; a wrong sign or a dropped axis would read 0 or ~70. That is the anti-vacuity property: the trivial wrong implementations cannot pass it.

dependencies 5 imports · 0 importers

nx_syscalls.nx nx_gate_verdict.nx nx_vecmath.nx nx_nxmesh_lib.nx nx_mmdev_lib.nx nx_mmdev_gate.nx

imports: nx_syscalls.nxnx_gate_verdict.nxnx_vecmath.nxnx_nxmesh_lib.nxnx_mmdev_lib.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 ↻ nm_file_bytes sys_mmap ↻ mg_square nm_put_u32 nm_tri_base nm_nlayers nm_u32 sys_mmap ↻ nm_put_tri nm_put_u32 ↻ vm_int_to_f32 nm_tri_base ↻ nm_coord vm_f32_to_int nm_u32 ↻ gv_puts ↻ gv_num sys_mmap ↻ sys_write ↻ sys_munmap

structs

none

consts

20const MG_SIDE: i64 = 1000
21const MG_LIFT: i64 = 50
22const MG_LIFT2: i64 = 2500
25const MG_SLACK: i64 = 1

functions

28func mg_square(buf: *u8, lift: i64) -> i64
40func mg_near(a: i64, b: i64) -> i64 { var d: i64 = a - b; if d < 0 { d = 0 - d } if d <= MG_SLACK { return 1 } return 0 }
called by 1: main
42func main() -> i64