File: decimater.cc

package info (click to toggle)
openmesh 11.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 16,080 kB
  • sloc: cpp: 56,379; ansic: 5,600; perl: 1,374; sh: 119; makefile: 18
file content (25 lines) | stat: -rw-r--r-- 905 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
using namespace OpenMesh;

typedef TriMesh_ArrayKernelT<>               Mesh;
typedef Decimater::DecimaterT<Mesh>          Decimater;
typedef Decimater::ModQuadricT<Mesh>::Handle HModQuadric;

Mesh        mesh;             // a mesh object
Decimater   decimater(mesh);  // a decimater object, connected to a mesh
HModQuadric hModQuadric;      // use a quadric module

decimater.add(hModQuadric); // register module at the decimater
std::cout << decimater.module(hModQuadric).name() << std::endl; // module access

/*
 * since we need exactly one priority module (non-binary)
 * we have to call set_binary(false) for our priority module
 * in the case of HModQuadric, unset_max_err() calls set_binary(false) internally
 */
decimater.module(hModQuadric).unset_max_err();

decimater.initialize();
decimater.decimate();

// after decimation: remove decimated elements from the mesh
mesh.garbage_collection();