diff --git a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh index caad4bab201986d26b5e1a9705d2cbe9afe1687c..26a21d818ce581069716621da798c17c5a09b399 100644 --- a/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh +++ b/src/OpenMesh/Apps/Decimating/DecimaterViewerWidget.hh @@ -103,13 +103,11 @@ public: typedef MeshViewerWidget inherited_t; typedef Decimater::DecimaterT decimater_t; - typedef Decimater::ModQuadricT< mesh_t > mod_quadric_t; - typedef Decimater::ModNormalFlippingT< mesh_t > mod_nf_t; + typedef Decimater::ModQuadricT< mesh_t >::Handle mod_quadric_t; + typedef Decimater::ModNormalFlippingT< mesh_t >::Handle mod_nf_t; // object types typedef std::auto_ptr< decimater_t > decimater_o; - typedef std::auto_ptr< mod_quadric_t > mod_quadric_o; - typedef std::auto_ptr< mod_nf_t > mod_nf_o; /// default constructor DecimaterViewerWidget(QWidget* _parent=0) @@ -148,14 +146,11 @@ public: // inherited decimater_o tmp( new decimater_t ( mesh() ) ); decimater_ = tmp; } - { - mod_quadric_o tmp( new mod_quadric_t( mesh() ) ); - mod_quadric_ = tmp; - } - { - mod_nf_o tmp( new mod_nf_t ( mesh() ) ); - mod_nf_ = tmp; - } + + decimater_->add(mod_quadric_); + decimater_->module(mod_quadric_).set_binary(false); + + decimater_->add(mod_nf_); decimater_->initialize(); } @@ -177,8 +172,8 @@ private: QTimer *timer_; decimater_o decimater_; - mod_quadric_o mod_quadric_; - mod_nf_o mod_nf_; + mod_quadric_t mod_quadric_; + mod_nf_t mod_nf_; size_t steps_; }; diff --git a/src/OpenMesh/Apps/Decimating/decimater.cc b/src/OpenMesh/Apps/Decimating/decimater.cc index 8d61ba8b5d034af5eb4329f60af5bb2dda25c4d8..7f2c20e51b382a0a717d9af10d30fbfb140493bc 100644 --- a/src/OpenMesh/Apps/Decimating/decimater.cc +++ b/src/OpenMesh/Apps/Decimating/decimater.cc @@ -271,6 +271,7 @@ decimate(const std::string &_ifname, decimater.add(modEL); if (_opt.EL.has_value()) decimater.module( modEL ).set_edge_length( _opt.EL ) ; + decimater.module(modEL).set_binary(false); } typename OpenMesh::Decimater::ModHausdorffT ::Handle modHD; @@ -319,6 +320,7 @@ decimate(const std::string &_ifname, decimater.add(modQ); if (_opt.Q.has_value()) decimater.module( modQ ).set_max_err( _opt.Q ); + decimater.module(modQ).set_binary(false); } typename OpenMesh::Decimater::ModRoundnessT::Handle modR; @@ -345,6 +347,7 @@ decimate(const std::string &_ifname, if (!rc) { std::cerr << " initializing failed!" << std::endl; + std::cerr << " maybe no priority module or more than one were defined!" << std::endl; return false; } } @@ -538,15 +541,16 @@ void usage_and_exit(int xcode) std::cerr << std::endl; std::cerr << "Modules:\n\n"; std::cerr << " AR[:ratio] - ModAspectRatio\n"; - std::cerr << " EL[:legth] - ModEdgeLength\n"; + std::cerr << " EL[:legth] - ModEdgeLength*\n"; std::cerr << " HD[:distance] - ModHausdorff\n"; std::cerr << " IS - ModIndependentSets\n"; std::cerr << " ND[:angle] - ModNormalDeviation\n"; std::cerr << " NF[:angle] - ModNormalFlipping\n"; std::cerr << " PM[:file name] - ModProgMesh\n"; - std::cerr << " Q[:error] - ModQuadric\n"; + std::cerr << " Q[:error] - ModQuadric*\n"; std::cerr << " R[:angle] - ModRoundness\n"; std::cerr << " 0 < angle < 60\n"; + std::cerr << " *: priority module. Decimater needs one of them (not more).\n"; exit( xcode ); }