decimater.cc 941 Bytes
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2 3 4 5 6 7 8 9 10 11 12
// 
using namespace OpenMesh

// ---------------------------------------- necessary types

// Mesh type
typedef TriMesh_ArrayKernelT<>                      Mesh;

// Decimater type
typedef Decimater::DecimaterT< Mesh >               Decimater;

// Decimation Module Handle type
Jan Möbius's avatar
Jan Möbius committed
13
typedef Decimater::ModQuadricT< Mesh >::Handle HModQuadric;
Jan Möbius's avatar
Jan Möbius committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

// ---------------------------------------- decimater setup

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;
                              // the way to access the module 

decimater.initialize();       // let the decimater initialize the mesh and the
                              // modules

decimater.decimate();         // do decimation