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>
84template <
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();
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);
248 void reset(){ initialized_ =
false; };
258 ModuleList bmodules_;
264 ModuleList all_modules_;
278#if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_BASE_DECIMATER_DECIMATERT_CC)
279#define OPENMESH_BASE_DECIMATER_TEMPLATES
Base class for all decimation modules.
This file contains an observer class which is used to monitor the progress of an decimater.
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:96
This class demonstrates the non copyable idiom.
Definition: Noncopyable.hh:72
base class decimater framework
Definition: BaseDecimaterT.hh:81
Definition: BaseDecimaterT.hh:86
void info(std::ostream &_os)
Print information about modules to _os.
Definition: BaseDecimaterT_impl.hh:205
bool remove(ModHandleT< _Module > &_mh)
remove module
Definition: BaseDecimaterT.hh:158
bool notify_observer(size_t _n_collapses)
returns false, if abort requested by observer
Definition: BaseDecimaterT.hh:191
bool add(ModHandleT< _Module > &_mh)
add module to decimater
Definition: BaseDecimaterT.hh:142
void set_error_tolerance_factor(double _factor)
This provides a function that allows the setting of a percentage of the original constraint of the mo...
Definition: BaseDecimaterT_impl.hh:191
float collapse_priority(const CollapseInfo &_ci)
Calculate priority of an halfedge collapse (using the modules)
Definition: BaseDecimaterT_impl.hh:154
Observer * observer()
Get current observer of a decimater.
Definition: BaseDecimaterT.hh:132
void set_observer(Observer *_o)
Add observer.
Definition: BaseDecimaterT.hh:126
void preprocess_collapse(CollapseInfo &_ci)
Pre-process a collapse.
Definition: BaseDecimaterT_impl.hh:179
bool initialize()
Initialize decimater and decimating modules.
Definition: BaseDecimaterT_impl.hh:236
void set_uninitialized()
Reset the initialized flag, and clear the bmodules_ and cmodule_.
Definition: BaseDecimaterT.hh:202
void postprocess_collapse(CollapseInfo &_ci)
Post-process a collapse.
Definition: BaseDecimaterT_impl.hh:167
Mesh & mesh()
access mesh. used in modules.
Definition: BaseDecimaterT.hh:138
bool is_initialized() const
Returns whether decimater has been successfully initialized.
Definition: BaseDecimaterT.hh:111
Module & module(ModHandleT< Module > &_mh)
get module referenced by handle _mh
Definition: BaseDecimaterT.hh:181
void reset()
Reset the status of this class.
Definition: BaseDecimaterT.hh:248
bool is_collapse_legal(const CollapseInfo &_ci)
Is an edge collapse legal? Performs topological test only.
Definition: BaseDecimaterT_impl.hh:100
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
Handle for mesh decimation modules.
Definition: ModBaseT.hh:84
bool is_valid() const
Check handle status.
Definition: ModBaseT.hh:100
Base class for all decimation modules.
Definition: ModBaseT.hh:193
virtual void postprocess_collapse(const CollapseInfoT< MeshT > &)
After _from_vh has been collapsed into _to_vh, this method will be called.
Definition: ModBaseT.hh:257
Observer class.
Definition: Observer.hh:76
virtual bool abort() const
Abort callback.
Definition: Observer.cc:82
virtual void notify(size_t _step)=0
callback