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();
104 if (
mesh_.status(_ci.
v0).locked())
119 if (_ci.
vl.is_valid() && _ci.
vr.is_valid()
120 &&
mesh_.find_halfedge(_ci.
vl, _ci.
vr).is_valid()
126 if (
mesh_.status(_ci.
v0).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(
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;
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;
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 =
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 =
288 if (*m_it != pmodule) {
Mesh::VertexHandle vr
Right vertex.
virtual void initialize()
Initialize module-internal stuff.
virtual void preprocess_collapse(const CollapseInfoT< MeshT > &)
void set_error_tolerance_factor(double _factor)
bool is_collapse_legal(const CollapseInfo &_ci)
Mesh::VertexHandle vl
Left vertex.
void set_uninitialized()
Reset the initialized flag, and clear the bmodules_ and cmodule_.
void postprocess_collapse(CollapseInfo &_ci)
Post-process a collapse.
Mesh::HalfedgeHandle v0v1
Halfedge to be collapsed.
virtual void set_error_tolerance_factor(double _factor)
bool initialized_
Flag if all modules were initialized.
void preprocess_collapse(CollapseInfo &_ci)
Pre-process a collapse.
float collapse_priority(const CollapseInfo &_ci)
Calculate priority of an halfedge collapse (using the modules)
virtual float collapse_priority(const CollapseInfoT< MeshT > &)
ModuleList bmodules_
list of binary modules
Mesh & mesh_
reference to mesh
Mesh::VertexHandle v0
Vertex to be removed.
ModuleList all_modules_
list of all allocated modules (including cmodule_ and all of bmodules_)
void info(std::ostream &_os)
Print information about modules to _os.
virtual void postprocess_collapse(const CollapseInfoT< MeshT > &)
Mesh::VertexHandle v1
Remaining vertex.
Module * cmodule_
the current priority module