57 #define OPENMESH_BASE_DECIMATER_DECIMATERT_CC
62 #if defined(OM_CC_MIPS)
76 BaseDecimaterT<Mesh>::BaseDecimaterT(
Mesh& _mesh) :
77 mesh_(_mesh), cmodule_(NULL), initialized_(false), observer_(NULL) {
79 mesh_.request_vertex_status();
80 mesh_.request_edge_status();
81 mesh_.request_face_status();
88 BaseDecimaterT<Mesh>::~BaseDecimaterT() {
90 mesh_.release_vertex_status();
91 mesh_.release_edge_status();
92 mesh_.release_face_status();
97 typename ModuleList::iterator m_it, m_end = all_modules_.end();
98 for (m_it = all_modules_.begin(); m_it != m_end; ++m_it)
100 all_modules_.clear();
111 if (mesh_.status(_ci.
v0).locked())
123 if (!mesh_.is_collapse_ok(_ci.
v0v1))
126 if (_ci.
vl.is_valid() && _ci.
vr.is_valid()
127 && mesh_.find_halfedge(_ci.
vl, _ci.
vr).is_valid()
128 && mesh_.valence(_ci.
vl) == 3 && mesh_.valence(_ci.
vr) == 3) {
133 if (mesh_.status(_ci.
v0).feature()
134 && !mesh_.status(mesh_.edge_handle(_ci.
v0v1)).feature())
138 if (mesh_.is_boundary(_ci.
v0)) {
141 if (!mesh_.is_boundary(_ci.
v1))
145 if (_ci.
vl.is_valid() && _ci.
vr.is_valid())
150 if (mesh_.cw_rotated_halfedge_handle(
151 mesh_.cw_rotated_halfedge_handle(_ci.
v0v1)) == _ci.
v0v1)
162 typename ModuleList::iterator m_it, m_end = bmodules_.end();
164 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it) {
165 if ((*m_it)->collapse_priority(_ci) < 0.0)
175 typename ModuleList::iterator m_it, m_end = bmodules_.end();
177 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it)
180 cmodule_->postprocess_collapse(_ci);
187 typename ModuleList::iterator m_it, m_end = bmodules_.end();
189 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it)
192 cmodule_->preprocess_collapse(_ci);
199 if (_factor >= 0.0 && _factor <= 1.0) {
200 typename ModuleList::iterator m_it, m_end = bmodules_.end();
202 for (m_it = bmodules_.begin(); m_it != m_end; ++m_it)
205 cmodule_->set_error_tolerance_factor(_factor);
214 _os <<
"initialized : yes" << std::endl;
215 _os <<
"binary modules: " << bmodules_.size() << std::endl;
216 for (ModuleListIterator m_it = bmodules_.begin(); m_it != bmodules_.end();
218 _os <<
" " << (*m_it)->name() << std::endl;
220 _os <<
"priority module: " << cmodule_->name().c_str() << std::endl;
222 _os <<
"initialized : no" << std::endl;
223 _os <<
"available modules: " << all_modules_.size() << std::endl;
224 for (ModuleListIterator m_it = all_modules_.begin();
225 m_it != all_modules_.end(); ++m_it) {
226 _os <<
" " << (*m_it)->name() <<
" : ";
227 if ((*m_it)->is_binary()) {
229 if ((*m_it)->name() ==
"Quadric") {
230 _os <<
" and priority (special treatment)";
261 for (ModuleListIterator m_it = all_modules_.begin(), m_end =
262 all_modules_.end(); m_it != m_end; ++m_it) {
263 if ((*m_it)->name() ==
"Quadric")
266 if (!(*m_it)->is_binary()) {
277 if (!pmodule && quadric) {
290 for (ModuleListIterator m_it = all_modules_.begin(), m_end =
291 all_modules_.end(); m_it != m_end; ++m_it) {
295 if (*m_it != pmodule) {
297 bmodules_.push_back(*m_it);
301 return initialized_ =
true;
virtual void initialize()
Initialize module-internal stuff.
Mesh::VertexHandle v1
Remaining vertex.
virtual float collapse_priority(const CollapseInfoT< MeshT > &)
Mesh::VertexHandle v0
Vertex to be removed.
Mesh::VertexHandle vr
Right vertex.
void preprocess_collapse(CollapseInfo &_ci)
Pre-process a collapse.
void set_error_tolerance_factor(double _factor)
Mesh::VertexHandle vl
Left vertex.
void postprocess_collapse(CollapseInfo &_ci)
Post-process a collapse.
Mesh::HalfedgeHandle v0v1
Halfedge to be collapsed.