nx_mesh_qem.nx
buildroot/runtime/nx_mesh_qem.nx
about
nx_mesh_qem.nx -- mesh decimation by QUADRIC ERROR METRICS (Garland-Heckbert 1997), pure
integer. Each vertex accumulates a quadric Q (sum of outer products of its incident face
planes); collapsing an edge costs p^T Q p (the squared distance of the new point to those
planes). Collapsing LOWEST-cost edges first => flat regions decimate hard while curved/feature
regions keep their vertices -- the quality win over uniform vertex clustering (nx_mesh_decimate)
on CURVED geometry. Sovereign + no-float: the mesh is scaled into a bounded [0,1024] cube so
the integer quadrics never overflow i64; collapse uses MIDPOINT placement (no matrix inverse).
Reuses nx_mesh + nx_isqrt. license_tier: ORIGINAL
dependencies 4 imports · 1 importers
imports: nx_syscalls.nxnx_mesh.nxnx_mesh_print_check.nxnx_isqrt.nx
imported by: nx_mesh_qem_gate.nx
structs
| none |
consts
| 14 | const QEM_S: i64 = 1024 // normalized cube side |
| 15 | const QEM_NQ: i64 = 256 // normal fixed-point scale |
functions
| 18 | func qem_add(quad: *i64, v: i64, a: i64, b: i64, c: i64, d: i64) -> i64 called by 1: nx_mesh_qem |
| 34 | func qem_cost(quad: *i64, va: i64, vb: i64, px: i64, py: i64, pz: i64) -> i64 called by 1: nx_mesh_qem |
| 47 | func nx_mesh_qem(m: *NxMesh, target_tris: i64) -> *NxMesh called by 1: main calls 11: nx_mesh_bbox_computesys_mmapnx_mesh_get_vertex_xnx_mesh_get_vertex_ynx_mesh_get_vertex_znx_isqrt+5 |