code wiki / (root) / nx_mesh_qem_gate.nx

nx_mesh_qem_gate.nx

buildroot/runtime/nx_mesh_qem_gate.nx

4010 B71 linesdepth 7pulls 11 transitivereach 0 importersview sourcekind gate/prooftopic mesh
docsdependenciesstructsconstsfunctions

about

nx_mesh_qem_gate.nx -- MEASURED-EXCEED gate for QEM decimation vs uniform vertex clustering. A cylinder (flat caps + curved wall = mixed flat/feature regions) is decimated to the SAME triangle budget by both methods. QEM keeps the feature vertices (the cap rims at the extremes), so its bounding box stays closer to the original; uniform clustering grid-snaps and shrinks it. T1 both methods reduced the triangle count. T2 QEM mesh valid (indices in range). T3 MEASURED EXCEED: QEM bbox-error < clustering bbox-error at equal tri budget. T4 NEVER-BRICK (#26). expect_exit: 0 license_tier: ORIGINAL

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_mesh.nx nx_mesh_print_check.nx nx_cad.nx nx_mesh_decimate.nx nx_mesh_qem.nx nx_mesh_qem_gate.nx

imports: nx_syscalls.nxnx_mesh.nxnx_mesh_print_check.nxnx_cad.nxnx_mesh_decimate.nxnx_mesh_qem.nx

imported by: nobody (leaf or entry point)

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

main gw sys_write nx_cad_make_cylinder sys_mmap nx_cos_turn_q10 sys_mmap ↻ _nx_trig_reduce _nx_cos_q1_table nx_sin_turn_q10 nx_cos_turn_q10 ↻ nx_cad_extrude nx_mesh_alloc sys_mmap ↻ nx_mesh_set_vertex nx_mesh_set_triangle nx_mesh_bbox_compute sys_mmap ↻ nx_mesh_get_vertex_x nx_mesh_get_vertex_y nx_mesh_get_vertex_z nx_mesh_decimate nx_mesh_bbox_compute ↻ sys_mmap ↻ nx_mesh_get_vertex_x ↻ nx_mesh_get_vertex_y ↻ nx_mesh_get_vertex_z ↻ decim_cell nx_mesh_alloc ↻ nx_mesh_set_vertex ↻ nx_mesh_set_triangle ↻ nx_mesh_qem nx_mesh_bbox_compute ↻ sys_mmap ↻ nx_mesh_get_vertex_x ↻ nx_mesh_get_vertex_y ↻ nx_mesh_get_vertex_z ↻ nx_isqrt qem_add qem_cost

structs

none

consts

27const M: i64 = 16384

functions

17func gw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
18func gn(v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0{sys_write(1,"-\x00" as *u8,1);m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k{b[i]=t[k-1-i];i=i+1} sys_write(1,b,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
19func iabs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: bbox_err
22func bbox_err(m: *NxMesh, ox0: i64, ox1: i64, oy0: i64, oy1: i64, oz0: i64, oz1: i64) -> i64
called by 1: main calls 2: nx_mesh_bbox_computeiabs
29func main() -> i64