code wiki / (root) / nx_mesh_decimate.nx

nx_mesh_decimate.nx

buildroot/runtime/nx_mesh_decimate.nx

4902 B103 linesdepth 6pulls 6 transitivereach 5 importersview sourcekind librarytopic mesh
docsdependenciesstructsconstsfunctions

about

nx_mesh_decimate.nx -- mesh DECIMATION by dense-grid vertex clustering (Rossignac-Borrel 1993), pure integer. Marching-tetrahedra meshes are dense (many tiny triangles on flat faces); this snaps every vertex to a regular cell grid (cell-CENTROID representative) and drops triangles that collapse (>=2 verts land in the same cell) -> far fewer triangles for the SAME shape, with bounded error <= ~cell. The transfer/size EXCEED: a sovereign STL shrinks Nx with one tolerance knob, deterministically (integer). No hash needed (a dense bbox grid has no key collisions). Reuses nx_mesh + nx_mesh_print_check (bbox). HONEST: this is a SIZE/transfer decimation, lossy by <=~cell and not guaranteed watertight; closure-preserving decimation is a later rung. license_tier: ORIGINAL

dependencies 3 imports · 5 importers

nx_syscalls.nx nx_mesh.nx nx_mesh_print_check.nx nx_mesh_decimate.nx nx_mesh_decimate_gate.nx nx_mesh_qem_gate.nx nx_underridge_hook_gcode_gate.nx nx_underridge_hook_petg_gate.nx nx_underridge_master_gate.nx

imports: nx_syscalls.nxnx_mesh.nxnx_mesh_print_check.nx

imported by: nx_mesh_decimate_gate.nxnx_mesh_qem_gate.nxnx_underridge_hook_gcode_gate.nxnx_underridge_hook_petg_gate.nxnx_underridge_master_gate.nx

structs

none

consts

14const NX_DECIM_MAX_CELLS: i64 = 6000000

functions

17func decim_cell(x: i64, y: i64, z: i64, minx: i64, miny: i64, minz: i64,
called by 1: nx_mesh_decimate
25func nx_mesh_decimate(m: *NxMesh, cell: i64) -> *NxMesh