52 #ifndef OPENMESH_DECIMATER_MODBASET_HH
53 #define OPENMESH_DECIMATER_MODBASET_HH
58 #include <OpenMesh/Core/Utils/Noncopyable.hh>
71 template <
typename Mesh>
class BaseDecimaterT;
80 template <
typename Module>
86 typedef Module module_type;
102 #if defined(OM_CC_MSVC)
108 void clear() { mod_ = NULL; }
109 void init(Module* _m) { mod_ = _m; }
110 Module* module() {
return mod_; }
128 #define DECIMATER_MODNAME(_mod_name) \
129 virtual const std::string& name() const { \
130 static std::string _s_modname_(#_mod_name); return _s_modname_; \
147 #define DECIMATING_MODULE(Classname, MeshT, Name) \
148 typedef Classname < MeshT > Self; \
149 typedef OpenMesh::Decimater::ModHandleT< Self > Handle; \
150 typedef OpenMesh::Decimater::ModBaseT< MeshT > Base; \
151 typedef typename Base::Mesh Mesh; \
152 typedef typename Base::CollapseInfo CollapseInfo; \
153 DECIMATER_MODNAME( Name )
189 template <
typename MeshT>
206 : error_tolerance_factor_(1.0), mesh_(_mesh), is_binary_(_is_binary) {}
267 if (_factor >= 0.0 && _factor <= 1.0)
268 error_tolerance_factor_ = _factor;
275 MeshT&
mesh() {
return mesh_; }
278 double error_tolerance_factor_;
296 #endif // OPENMESH_DECIMATER_MODBASE_HH defined
Handle for mesh decimation modules.
Definition: ModBaseT.hh:81
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:73
bool is_valid() const
Check handle status.
Definition: ModBaseT.hh:98
Base class for all decimation modules.
Definition: ModBaseT.hh:190
virtual void preprocess_collapse(const CollapseInfoT< MeshT > &)
Before _from_vh has been collapsed into _to_vh, this method will be called.
Definition: ModBaseT.hh:249
void set_binary(bool _b)
Set whether module is binary or not.
Definition: ModBaseT.hh:221
indicates a legal collapse
Definition: ModBaseT.hh:198
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
MeshT & mesh()
Access the mesh associated with the decimater.
Definition: ModBaseT.hh:275
ModHandleT()
Default constructor.
Definition: ModBaseT.hh:91
virtual float collapse_priority(const CollapseInfoT< MeshT > &)
Return collapse priority.
Definition: ModBaseT.hh:243
virtual void initialize()
Initialize module-internal stuff.
Definition: ModBaseT.hh:227
#define DECIMATER_MODNAME(_mod_name)
Macro that sets up the name() function.
Definition: ModBaseT.hh:128
bool is_binary(void) const
Returns true if criteria returns a binary value.
Definition: ModBaseT.hh:218
~ModHandleT()
Destructor.
Definition: ModBaseT.hh:94
ModBaseT(MeshT &_mesh, bool _is_binary)
Default constructor.
Definition: ModBaseT.hh:205
virtual void postprocess_collapse(const CollapseInfoT< MeshT > &)
After _from_vh has been collapsed into _to_vh, this method will be called.
Definition: ModBaseT.hh:255
This class demonstrates the non copyable idiom.
Definition: Noncopyable.hh:69
virtual void set_error_tolerance_factor(double _factor)
This provides a function that allows the setting of a percentage of the original contraint.
Definition: ModBaseT.hh:266
Definition: BaseDecimaterT.hh:82
indicates an illegal collapse
Definition: ModBaseT.hh:197
Provides data class CollapseInfoT for storing all information about a halfedge collapse.
virtual ~ModBaseT()
Virtual desctructor.
Definition: ModBaseT.hh:211