From d99a1625506a6b6a3cf548adf6b88b39bf5881b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Mon, 8 Oct 2012 07:23:50 +0000 Subject: [PATCH] Added more advanced version of the mixxed decimater git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@734 fdac6126-5c0c-442c-9429-916003d36597 --- .../Tools/Decimater/MixedDecimaterT.cc | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc b/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc index a3be54bd..a93651a9 100644 --- a/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc +++ b/src/OpenMesh/Tools/Decimater/MixedDecimaterT.cc @@ -118,7 +118,29 @@ size_t MixedDecimaterT::decimate_to_faces(const size_t _n_vertices,const r_collapses = McDecimaterT::decimate_to_faces(n_vertices_mc, n_faces_mc); } else { - r_collapses += McDecimaterT::decimate_constraints_only(_mc_factor); + + const int samples = this->samples(); + + // MinimalSample count for the McDecimater + const int min = 2; + + // Maximal number of samples for the McDecimater + const int max = samples; + + // Number of incremental steps + const int steps = 7; + + for ( int i = 0; i < steps; ++i ) { + + // Compute number of samples to be used + int samples = double( min) + double(i)/(double(steps)-1.0) * (max-2) ; + + // We won't allow 1 here, as this is the last step in the incremental part + double decimaterLevel = (double(i + 1)) * _mc_factor / (double(steps) ); + + this->set_samples(samples); + r_collapses += McDecimaterT::decimate_constraints_only(decimaterLevel); + } } }