Commit 8038dfb3 authored by Matthias Möller's avatar Matthias Möller

- fix init bug for decimater apps (using priority modules now)

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@652 fdac6126-5c0c-442c-9429-916003d36597
parent d19afb03
...@@ -103,13 +103,11 @@ public: ...@@ -103,13 +103,11 @@ public:
typedef MeshViewerWidget inherited_t; typedef MeshViewerWidget inherited_t;
typedef Decimater::DecimaterT<mesh_t> decimater_t; typedef Decimater::DecimaterT<mesh_t> decimater_t;
typedef Decimater::ModQuadricT< mesh_t > mod_quadric_t; typedef Decimater::ModQuadricT< mesh_t >::Handle mod_quadric_t;
typedef Decimater::ModNormalFlippingT< mesh_t > mod_nf_t; typedef Decimater::ModNormalFlippingT< mesh_t >::Handle mod_nf_t;
// object types // object types
typedef std::auto_ptr< decimater_t > decimater_o; 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 /// default constructor
DecimaterViewerWidget(QWidget* _parent=0) DecimaterViewerWidget(QWidget* _parent=0)
...@@ -148,14 +146,11 @@ public: // inherited ...@@ -148,14 +146,11 @@ public: // inherited
decimater_o tmp( new decimater_t ( mesh() ) ); decimater_o tmp( new decimater_t ( mesh() ) );
decimater_ = tmp; decimater_ = tmp;
} }
{
mod_quadric_o tmp( new mod_quadric_t( mesh() ) ); decimater_->add(mod_quadric_);
mod_quadric_ = tmp; decimater_->module(mod_quadric_).set_binary(false);
}
{ decimater_->add(mod_nf_);
mod_nf_o tmp( new mod_nf_t ( mesh() ) );
mod_nf_ = tmp;
}
decimater_->initialize(); decimater_->initialize();
} }
...@@ -177,8 +172,8 @@ private: ...@@ -177,8 +172,8 @@ private:
QTimer *timer_; QTimer *timer_;
decimater_o decimater_; decimater_o decimater_;
mod_quadric_o mod_quadric_; mod_quadric_t mod_quadric_;
mod_nf_o mod_nf_; mod_nf_t mod_nf_;
size_t steps_; size_t steps_;
}; };
......
...@@ -271,6 +271,7 @@ decimate(const std::string &_ifname, ...@@ -271,6 +271,7 @@ decimate(const std::string &_ifname,
decimater.add(modEL); decimater.add(modEL);
if (_opt.EL.has_value()) if (_opt.EL.has_value())
decimater.module( modEL ).set_edge_length( _opt.EL ) ; decimater.module( modEL ).set_edge_length( _opt.EL ) ;
decimater.module(modEL).set_binary(false);
} }
typename OpenMesh::Decimater::ModHausdorffT <Mesh>::Handle modHD; typename OpenMesh::Decimater::ModHausdorffT <Mesh>::Handle modHD;
...@@ -319,6 +320,7 @@ decimate(const std::string &_ifname, ...@@ -319,6 +320,7 @@ decimate(const std::string &_ifname,
decimater.add(modQ); decimater.add(modQ);
if (_opt.Q.has_value()) if (_opt.Q.has_value())
decimater.module( modQ ).set_max_err( _opt.Q ); decimater.module( modQ ).set_max_err( _opt.Q );
decimater.module(modQ).set_binary(false);
} }
typename OpenMesh::Decimater::ModRoundnessT<Mesh>::Handle modR; typename OpenMesh::Decimater::ModRoundnessT<Mesh>::Handle modR;
...@@ -345,6 +347,7 @@ decimate(const std::string &_ifname, ...@@ -345,6 +347,7 @@ decimate(const std::string &_ifname,
if (!rc) if (!rc)
{ {
std::cerr << " initializing failed!" << std::endl; std::cerr << " initializing failed!" << std::endl;
std::cerr << " maybe no priority module or more than one were defined!" << std::endl;
return false; return false;
} }
} }
...@@ -538,15 +541,16 @@ void usage_and_exit(int xcode) ...@@ -538,15 +541,16 @@ void usage_and_exit(int xcode)
std::cerr << std::endl; std::cerr << std::endl;
std::cerr << "Modules:\n\n"; std::cerr << "Modules:\n\n";
std::cerr << " AR[:ratio] - ModAspectRatio\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 << " HD[:distance] - ModHausdorff\n";
std::cerr << " IS - ModIndependentSets\n"; std::cerr << " IS - ModIndependentSets\n";
std::cerr << " ND[:angle] - ModNormalDeviation\n"; std::cerr << " ND[:angle] - ModNormalDeviation\n";
std::cerr << " NF[:angle] - ModNormalFlipping\n"; std::cerr << " NF[:angle] - ModNormalFlipping\n";
std::cerr << " PM[:file name] - ModProgMesh\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 << " R[:angle] - ModRoundness\n";
std::cerr << " 0 < angle < 60\n"; std::cerr << " 0 < angle < 60\n";
std::cerr << " *: priority module. Decimater needs one of them (not more).\n";
exit( xcode ); exit( xcode );
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment