53 #ifndef OPENMESH_BASE_DECIMATER_DECIMATERT_HH 54 #define OPENMESH_BASE_DECIMATER_DECIMATERT_HH 61 #include <OpenMesh/Core/Utils/Property.hh> 63 #include <OpenMesh/Core/Utils/Noncopyable.hh> 84 template <
typename MeshT >
93 typedef std::vector< Module* > ModuleList;
94 typedef typename ModuleList::iterator ModuleListIterator;
115 void info( std::ostream& _os );
141 template <
typename _Module >
147 _mh.init(
new _Module(mesh()) );
148 all_modules_.push_back( _mh.module() );
157 template <
typename _Module >
163 typename ModuleList::iterator it = std::find(all_modules_.begin(),
167 if ( it == all_modules_.end() )
171 all_modules_.erase( it );
180 template <
typename Module >
184 return *_mh.module();
193 if (observer() && _n_collapses % observer()->get_interval() == 0)
195 observer()->notify(_n_collapses);
196 return !observer()->abort();
203 initialized_ =
false;
208 void update_modules(CollapseInfo& _ci)
210 typename ModuleList::iterator m_it, m_end = bmodules_.end();
211 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it)
212 (*m_it)->postprocess_collapse(_ci);
213 cmodule_->postprocess_collapse(_ci);
223 bool is_collapse_legal(
const CollapseInfo& _ci);
226 float collapse_priority(
const CollapseInfo& _ci);
229 void preprocess_collapse(CollapseInfo& _ci);
232 void postprocess_collapse(CollapseInfo& _ci);
242 void set_error_tolerance_factor(
double _factor);
248 void reset(){ initialized_ =
false; };
278 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_BASE_DECIMATER_DECIMATERT_CC) 279 #define OPENMESH_BASE_DECIMATER_TEMPLATES 280 #include "BaseDecimaterT_impl.hh" 283 #endif // OPENMESH_BASE_DECIMATER_DECIMATERT_HH defined void set_observer(Observer *_o)
Add observer.
Module * cmodule_
the current priority module
bool is_initialized() const
Returns whether decimater has been successfully initialized.
bool add(ModHandleT< _Module > &_mh)
add module to decimater
Module & module(ModHandleT< Module > &_mh)
get module referenced by handle _mh
Observer * observer_
observer
Mesh & mesh()
access mesh. used in modules.
ModuleList bmodules_
list of binary modules
bool notify_observer(size_t _n_collapses)
returns false, if abort requested by observer
ModuleList all_modules_
list of all allocated modules (including cmodule_ and all of bmodules_)
void set_uninitialized()
Reset the initialized flag, and clear the bmodules_ and cmodule_.
Observer * observer()
Get current observer of a decimater.
bool initialized_
Flag if all modules were initialized.