51 #define OPENMESH_MIXED_DECIMATER_DECIMATERT_CC 58 #if defined(OM_CC_MIPS) 90 size_t n_collapses_mc =
static_cast<size_t>(_mc_factor*_n_collapses);
91 size_t n_collapses_inc =
static_cast<size_t>(_n_collapses - n_collapses_mc);
93 size_t r_collapses = 0;
101 if (_mc_factor < 1.0)
111 if (_mc_factor > 1.0)
114 std::size_t r_collapses = 0;
115 if (_mc_factor > 0.0)
117 bool constraintsOnly = (_n_vertices == 0) && (_n_faces == 1);
118 if (!constraintsOnly) {
119 size_t mesh_faces = this->
mesh().n_faces();
120 size_t mesh_vertices = this->
mesh().n_vertices();
122 size_t n_vertices_mc =
static_cast<size_t>(mesh_vertices - _mc_factor * (mesh_vertices - _n_vertices));
123 size_t n_faces_mc =
static_cast<size_t>(mesh_faces - _mc_factor * (mesh_faces - _n_faces));
128 const size_t samples = this->samples();
131 const size_t min = 2;
134 const size_t max = samples;
137 const size_t steps = 7;
139 for (
size_t i = 0; i < steps; ++i ) {
142 size_t samples = int (
double( min) +
double(i)/(
double(steps)-1.0) * (max-2) ) ;
145 float decimaterLevel = (float(i + 1)) * _mc_factor / (
float(steps) );
147 this->set_samples(samples);
154 this->
mesh().garbage_collection();
161 if (_mc_factor < 1.0) {
size_t decimate(size_t _n_collapses=0)
Perform a number of collapses on the mesh.
Observer * observer()
Get current observer of a decimater.
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_to_faces(size_t _n_vertices=0, size_t _n_faces=0)
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.
~MixedDecimaterT()
Destructor.
Mesh & mesh()
access mesh. used in modules.
size_t decimate(size_t _n_collapses)
MixedDecimaterT(Mesh &_mesh)
Constructor.
size_t decimate(const size_t _n_collapses, const float _mc_factor)
size_t decimate_constraints_only(float _factor)