- added the set_error_tolerance_factor function to ModBaseT and implemented it in inherited classes as necessary
- added the set_error_tolerance_factor function to BaseDecimaterT, which calls set_error_tolerance_factor for all loaded Mods - implemented a decimate_constraints_only function for the McDecimater (and adjusted the MixedDecimater accordingly) - implemented stop criterions for the McDecimater - added some OpenMP loops for the sample generation to the McDecimater git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@685 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
* Copyright (C) 2001-2011 by Computer Graphics Group, RWTH Aachen *
|
||||
* www.openmesh.org *
|
||||
* *
|
||||
*---------------------------------------------------------------------------*
|
||||
*---------------------------------------------------------------------------*
|
||||
* This file is part of OpenMesh. *
|
||||
* *
|
||||
* OpenMesh is free software: you can redistribute it and/or modify *
|
||||
* OpenMesh is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of *
|
||||
* the License, or (at your option) any later version with the *
|
||||
@@ -30,10 +30,10 @@
|
||||
* License along with OpenMesh. If not, *
|
||||
* see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
\*===========================================================================*/
|
||||
\*===========================================================================*/
|
||||
|
||||
/*===========================================================================*\
|
||||
* *
|
||||
* *
|
||||
* $Revision$ *
|
||||
* $Date$ *
|
||||
* *
|
||||
@@ -88,11 +88,11 @@ public:
|
||||
public:
|
||||
|
||||
/// Default constructor
|
||||
ModHandleT() : mod_(NULL) {}
|
||||
ModHandleT() : mod_(NULL) {}
|
||||
|
||||
/// Destructor
|
||||
~ModHandleT() { /* don't delete mod_, since handle is not owner! */ }
|
||||
|
||||
|
||||
/// Check handle status
|
||||
/// \return \c true, if handle is valid, else \c false.
|
||||
bool is_valid() const { return mod_ != NULL; }
|
||||
@@ -132,13 +132,13 @@ private:
|
||||
|
||||
|
||||
/** Convenience macro, to be used in derived modules
|
||||
* The macro defines the types
|
||||
* The macro defines the types
|
||||
* - \c Handle, type of the module's handle.
|
||||
* - \c Base, type of ModBaseT<>.
|
||||
* - \c Mesh, type of the associated mesh passed by the decimater type.
|
||||
* - \c CollapseInfo, to your convenience
|
||||
* and uses DECIMATER_MODNAME() to define the name of the module.
|
||||
*
|
||||
*
|
||||
* \param Classname The name of the derived class.
|
||||
* \param MeshT Pass here the mesh type, which is the
|
||||
* template parameter passed to ModBaseT.
|
||||
@@ -160,7 +160,7 @@ private:
|
||||
/** Base class for all decimation modules.
|
||||
|
||||
Each module has to implement this interface.
|
||||
To build your own module you have to
|
||||
To build your own module you have to
|
||||
-# derive from this class.
|
||||
-# create the basic settings with DECIMATING_MODULE().
|
||||
-# override collapse_priority(), if necessary.
|
||||
@@ -199,20 +199,20 @@ public:
|
||||
};
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
/// Default constructor
|
||||
/// \see \ref decimater_docu
|
||||
ModBaseT(MeshT& _mesh, bool _is_binary)
|
||||
: mesh_(_mesh), is_binary_(_is_binary) {}
|
||||
: error_tolerance_factor_(1.0), mesh_(_mesh), is_binary_(_is_binary) {}
|
||||
|
||||
public:
|
||||
|
||||
/// Virtual desctructor
|
||||
virtual ~ModBaseT() { }
|
||||
virtual ~ModBaseT() { }
|
||||
|
||||
/// Set module's name (using DECIMATER_MODNAME macro)
|
||||
DECIMATER_MODNAME(ModBase);
|
||||
|
||||
|
||||
|
||||
/// Returns true if criteria returns a binary value.
|
||||
bool is_binary(void) const { return is_binary_; }
|
||||
@@ -222,11 +222,11 @@ public:
|
||||
|
||||
|
||||
public: // common interface
|
||||
|
||||
|
||||
/// Initialize module-internal stuff
|
||||
virtual void initialize() { }
|
||||
|
||||
/** Return collapse priority.
|
||||
/** Return collapse priority.
|
||||
*
|
||||
* In the binary mode collapse_priority() checks a constraint and
|
||||
* returns LEGAL_COLLAPSE or ILLEGAL_COLLAPSE.
|
||||
@@ -237,7 +237,7 @@ public: // common interface
|
||||
* constraint is violated, collapse_priority() must return
|
||||
* ILLEGAL_COLLAPSE.
|
||||
*
|
||||
* \return Collapse priority in the range [0,inf),
|
||||
* \return Collapse priority in the range [0,inf),
|
||||
* \c LEGAL_COLLAPSE or \c ILLEGAL_COLLAPSE.
|
||||
*/
|
||||
virtual float collapse_priority(const CollapseInfoT<MeshT>& /* _ci */)
|
||||
@@ -250,11 +250,23 @@ public: // common interface
|
||||
{}
|
||||
|
||||
/** After _from_vh has been collapsed into _to_vh, this method
|
||||
will be called.
|
||||
will be called.
|
||||
*/
|
||||
virtual void postprocess_collapse(const CollapseInfoT<MeshT>& /* _ci */)
|
||||
{}
|
||||
|
||||
/**
|
||||
* This provides a function that allows the setting of a percentage
|
||||
* of the original contraint.
|
||||
*
|
||||
* Note that the module might need to be re-initialized again after
|
||||
* setting the percentage
|
||||
* @param factor_ has to be in the closed interval between 0.0 and 1.0
|
||||
*/
|
||||
virtual void set_error_tolerance_factor(double _factor) {
|
||||
if (_factor >= 0.0 && _factor <= 1.0)
|
||||
error_tolerance_factor_ = _factor;
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
@@ -262,6 +274,9 @@ protected:
|
||||
/// Access the mesh associated with the decimater.
|
||||
MeshT& mesh() { return mesh_; }
|
||||
|
||||
// current percentage of the original constraint
|
||||
double error_tolerance_factor_;
|
||||
|
||||
private:
|
||||
|
||||
// hide copy constructor & assignemnt
|
||||
|
||||
Reference in New Issue
Block a user