57 #define OPENMESH_MIXED_DECIMATER_DECIMATERT_CC 61 #include <OpenMesh/Tools/Decimater/MixedDecimaterT.hh> 64 #if defined(OM_CC_MIPS) 96 size_t n_collapses_mc =
static_cast<size_t>(_mc_factor*_n_collapses);
97 size_t n_collapses_inc =
static_cast<size_t>(_n_collapses - n_collapses_mc);
99 size_t r_collapses = 0;
100 if (_mc_factor > 0.0)
107 if (_mc_factor < 1.0)
117 if (_mc_factor > 1.0)
120 std::size_t r_collapses = 0;
121 if (_mc_factor > 0.0)
123 bool constraintsOnly = (_n_vertices == 0) && (_n_faces == 1);
124 if (!constraintsOnly) {
125 size_t mesh_faces = this->
mesh().n_faces();
126 size_t mesh_vertices = this->
mesh().n_vertices();
128 size_t n_vertices_mc =
static_cast<size_t>(mesh_vertices - _mc_factor * (mesh_vertices - _n_vertices));
129 size_t n_faces_mc =
static_cast<size_t>(mesh_faces - _mc_factor * (mesh_faces - _n_faces));
134 const size_t samples = this->samples();
137 const size_t min = 2;
140 const size_t max = samples;
143 const size_t steps = 7;
145 for (
size_t i = 0; i < steps; ++i ) {
148 size_t samples = int (
double( min) +
double(i)/(
double(steps)-1.0) * (max-2) ) ;
151 float decimaterLevel = (float(i + 1)) * _mc_factor / (
float(steps) );
153 this->set_samples(samples);
160 this->
mesh().garbage_collection();
167 if (_mc_factor < 1.0) {
size_t decimate_to_faces(size_t _n_vertices=0, size_t _n_faces=0)
~MixedDecimaterT()
Destructor.
size_t decimate_to_faces(const size_t _n_vertices=0, const size_t _n_faces=0, const float _mc_factor=0.8)
size_t decimate(size_t _n_collapses=0)
Perform a number of collapses on the mesh.
Mesh & mesh()
access mesh. used in modules.
size_t decimate(size_t _n_collapses)
size_t decimate_constraints_only(float _factor)
size_t decimate_to_faces(size_t _n_vertices=0, size_t _n_faces=0)
Attempts to decimate the mesh until a desired vertex or face complexity is achieved.
size_t decimate(const size_t _n_collapses, const float _mc_factor)
Observer * observer()
Get current observer of a decimater.
MixedDecimaterT(Mesh &_mesh)
Constructor.