diff --git a/src/OpenMesh/Tools/Decimater/DecimaterT.cc b/src/OpenMesh/Tools/Decimater/DecimaterT.cc index 34b0bda0..1bdeeeee 100644 --- a/src/OpenMesh/Tools/Decimater/DecimaterT.cc +++ b/src/OpenMesh/Tools/Decimater/DecimaterT.cc @@ -118,7 +118,7 @@ void DecimaterT::heap_vertex(VertexHandle _vh) { if (collapse_target.is_valid()) { // std::clog << " added|updated" << std::endl; mesh_.property(collapse_target_, _vh) = collapse_target; - mesh_.property(priority_, _vh) = best_prio; + mesh_.property(priority_, _vh) = best_prio; if (heap_->is_stored(_vh)) heap_->update(_vh); @@ -140,6 +140,7 @@ void DecimaterT::heap_vertex(VertexHandle _vh) { //----------------------------------------------------------------------------- template size_t DecimaterT::decimate(size_t _n_collapses) { + if (!this->is_initialized()) return 0; @@ -215,6 +216,7 @@ size_t DecimaterT::decimate(size_t _n_collapses) { heap_.reset(); + // DON'T do garbage collection here! It's up to the application. return n_collapses; } @@ -223,6 +225,7 @@ size_t DecimaterT::decimate(size_t _n_collapses) { template size_t DecimaterT::decimate_to_faces(size_t _nv, size_t _nf) { + if (!this->is_initialized()) return 0; diff --git a/src/OpenMesh/Tools/Decimater/McDecimaterT.cc b/src/OpenMesh/Tools/Decimater/McDecimaterT.cc index 8dcfe74b..50e9e978 100644 --- a/src/OpenMesh/Tools/Decimater/McDecimaterT.cc +++ b/src/OpenMesh/Tools/Decimater/McDecimaterT.cc @@ -372,7 +372,7 @@ size_t McDecimaterT::decimate_constraints_only(float _factor) { unsigned int nf = mesh_.n_faces(); bool lastCollapseIllegal = false; - // number of illegal collapses that occured in a row + // number of illegal collapses that occurred in a row unsigned int illegalCollapses = 0; bool collapsesUnchanged = false;