54 #ifndef OPENMESH_DECIMATER_MODBASET_HH
55 #define OPENMESH_DECIMATER_MODBASET_HH
60 #include <OpenMesh/Core/Utils/Noncopyable.hh>
73 template <
typename Mesh>
class BaseDecimaterT;
82 template <
typename Module>
88 typedef Module module_type;
104 #if defined(OM_CC_MSVC)
110 void clear() { mod_ =
nullptr; }
111 void init(Module* _m) { mod_ = _m; }
112 Module* module() {
return mod_; }
130 #define DECIMATER_MODNAME(_mod_name) \
131 virtual const std::string& name() const override { \
132 static std::string _s_modname_(#_mod_name); return _s_modname_; \
149 #define DECIMATING_MODULE(Classname, MeshT, Name) \
150 typedef Classname < MeshT > Self; \
151 typedef OpenMesh::Decimater::ModHandleT< Self > Handle; \
152 typedef OpenMesh::Decimater::ModBaseT< MeshT > Base; \
153 typedef typename Base::Mesh Mesh; \
154 typedef typename Base::CollapseInfo CollapseInfo; \
155 DECIMATER_MODNAME( Name )
191 template <
typename MeshT>
208 : error_tolerance_factor_(1.0), mesh_(_mesh), is_binary_(_is_binary) {}
216 virtual const std::string&
name()
const {
static std::string _s_modname_(
"ModBase");
return _s_modname_; }
269 if (_factor >= 0.0 && _factor <= 1.0)
270 error_tolerance_factor_ = _factor;
277 MeshT&
mesh() {
return mesh_; }
280 double error_tolerance_factor_;
Provides data class CollapseInfoT for storing all information about a halfedge collapse.
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
This class demonstrates the non copyable idiom.
Definition: Noncopyable.hh:72
Definition: BaseDecimaterT.hh:86
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
Handle for mesh decimation modules.
Definition: ModBaseT.hh:84
~ModHandleT()
Destructor.
Definition: ModBaseT.hh:96
bool is_valid() const
Check handle status.
Definition: ModBaseT.hh:100
ModHandleT()
Default constructor.
Definition: ModBaseT.hh:93
Base class for all decimation modules.
Definition: ModBaseT.hh:193
bool is_binary(void) const
Returns true if criteria returns a binary value.
Definition: ModBaseT.hh:220
virtual void initialize()
Initialize module-internal stuff.
Definition: ModBaseT.hh:229
void set_binary(bool _b)
Set whether module is binary or not.
Definition: ModBaseT.hh:223
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:268
@ LEGAL_COLLAPSE
indicates a legal collapse
Definition: ModBaseT.hh:200
@ ILLEGAL_COLLAPSE
indicates an illegal collapse
Definition: ModBaseT.hh:199
MeshT & mesh()
Access the mesh associated with the decimater.
Definition: ModBaseT.hh:277
virtual void preprocess_collapse(const CollapseInfoT< MeshT > &)
Before _from_vh has been collapsed into _to_vh, this method will be called.
Definition: ModBaseT.hh:251
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
virtual ~ModBaseT()
Virtual desctructor.
Definition: ModBaseT.hh:213
ModBaseT(MeshT &_mesh, bool _is_binary)
Default constructor.
Definition: ModBaseT.hh:207
virtual float collapse_priority(const CollapseInfoT< MeshT > &)
Return collapse priority.
Definition: ModBaseT.hh:245
virtual const std::string & name() const
Set module's name.
Definition: ModBaseT.hh:216