50 #define OPENMESH_BASE_DECIMATER_DECIMATERT_CC 55 #if defined(OM_CC_MIPS) 69 BaseDecimaterT<Mesh>::BaseDecimaterT(Mesh& _mesh) :
70 mesh_(_mesh), cmodule_(NULL), initialized_(false), observer_(NULL) {
72 mesh_.request_vertex_status();
73 mesh_.request_edge_status();
74 mesh_.request_face_status();
81 BaseDecimaterT<Mesh>::~BaseDecimaterT() {
83 mesh_.release_vertex_status();
84 mesh_.release_edge_status();
85 mesh_.release_face_status();
90 typename ModuleList::iterator m_it, m_end = all_modules_.end();
91 for (m_it = all_modules_.begin(); m_it != m_end; ++m_it)
104 if (mesh_.status(_ci.
v0).locked())
116 if (!mesh_.is_collapse_ok(_ci.
v0v1))
119 if (_ci.
vl.is_valid() && _ci.
vr.is_valid()
120 && mesh_.find_halfedge(_ci.
vl, _ci.
vr).is_valid()
121 && mesh_.valence(_ci.
vl) == 3 && mesh_.valence(_ci.
vr) == 3) {
126 if (mesh_.status(_ci.
v0).feature()
127 && !mesh_.status(mesh_.edge_handle(_ci.
v0v1)).feature())
131 if (mesh_.is_boundary(_ci.
v0)) {
134 if (!mesh_.is_boundary(_ci.
v1))
138 if (_ci.
vl.is_valid() && _ci.
vr.is_valid())
143 if (mesh_.cw_rotated_halfedge_handle(
144 mesh_.cw_rotated_halfedge_handle(_ci.
v0v1)) == _ci.
v0v1)
155 typename ModuleList::iterator m_it, m_end = bmodules_.end();
157 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it) {
158 if ((*m_it)->collapse_priority(_ci) < 0.0)
168 typename ModuleList::iterator m_it, m_end = bmodules_.end();
170 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it)
171 (*m_it)->postprocess_collapse(_ci);
180 typename ModuleList::iterator m_it, m_end = bmodules_.end();
182 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it)
183 (*m_it)->preprocess_collapse(_ci);
192 if (_factor >= 0.0 && _factor <= 1.0) {
193 typename ModuleList::iterator m_it, m_end = bmodules_.end();
195 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it)
196 (*m_it)->set_error_tolerance_factor(_factor);
207 _os <<
"initialized : yes" << std::endl;
208 _os <<
"binary modules: " << bmodules_.size() << std::endl;
209 for (ModuleListIterator m_it = bmodules_.begin(); m_it != bmodules_.end();
211 _os <<
" " << (*m_it)->name() << std::endl;
213 _os <<
"priority module: " << cmodule_->
name().c_str() << std::endl;
215 _os <<
"initialized : no" << std::endl;
216 _os <<
"available modules: " << all_modules_.size() << std::endl;
217 for (ModuleListIterator m_it = all_modules_.begin();
218 m_it != all_modules_.end(); ++m_it) {
219 _os <<
" " << (*m_it)->name() <<
" : ";
220 if ((*m_it)->is_binary()) {
222 if ((*m_it)->name() ==
"Quadric") {
223 _os <<
" and priority (special treatment)";
254 for (ModuleListIterator m_it = all_modules_.begin(), m_end =
255 all_modules_.end(); m_it != m_end; ++m_it) {
256 if ((*m_it)->name() ==
"Quadric")
259 if (!(*m_it)->is_binary()) {
270 if (!pmodule && quadric) {
283 for (ModuleListIterator m_it = all_modules_.begin(), m_end =
284 all_modules_.end(); m_it != m_end; ++m_it) {
288 if (*m_it != pmodule) {
290 bmodules_.push_back(*m_it);
294 return initialized_ =
true;
Base class for all decimation modules.
Definition: ModBaseT.hh:192
Mesh::VertexHandle vr
Right vertex.
Definition: CollapseInfoT.hh:98
Mesh::HalfedgeHandle v0v1
Halfedge to be collapsed.
Definition: CollapseInfoT.hh:89
void set_uninitialized()
Reset the initialized flag, and clear the bmodules_ and cmodule_.
Definition: BaseDecimaterT.hh:202
virtual const std::string & name() const
Set module's name (using DECIMATER_MODNAME macro)
Definition: ModBaseT.hh:216
virtual float collapse_priority(const CollapseInfoT< MeshT > &)
Return collapse priority.
Definition: ModBaseT.hh:245
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
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
bool initialize()
Initialize decimater and decimating modules.
Definition: BaseDecimaterT_impl.hh:236
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
Mesh::VertexHandle vl
Left vertex.
Definition: CollapseInfoT.hh:97
float collapse_priority(const CollapseInfo &_ci)
Calculate priority of an halfedge collapse (using the modules)
Definition: BaseDecimaterT_impl.hh:154
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
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
Mesh::VertexHandle v1
Remaining vertex.
Definition: CollapseInfoT.hh:92
bool is_collapse_legal(const CollapseInfo &_ci)
Is an edge collapse legal? Performs topological test only.
Definition: BaseDecimaterT_impl.hh:100
void preprocess_collapse(CollapseInfo &_ci)
Pre-process a collapse.
Definition: BaseDecimaterT_impl.hh:179
virtual void initialize()
Initialize module-internal stuff.
Definition: ModBaseT.hh:229
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
void postprocess_collapse(CollapseInfo &_ci)
Post-process a collapse.
Definition: BaseDecimaterT_impl.hh:167
void info(std::ostream &_os)
Print information about modules to _os.
Definition: BaseDecimaterT_impl.hh:205
Mesh::VertexHandle v0
Vertex to be removed.
Definition: CollapseInfoT.hh:91