50 #define OPENMESH_BASE_DECIMATER_DECIMATERT_CC
55 #if defined(OM_CC_MIPS)
69 BaseDecimaterT<Mesh>::BaseDecimaterT(Mesh& _mesh) :
70 mesh_(_mesh), cmodule_(nullptr), initialized_(false), observer_(nullptr) {
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)
173 cmodule_->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)
185 cmodule_->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)
198 cmodule_->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)";
252 Module *quadric =
nullptr;
253 Module *pmodule =
nullptr;
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;
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:59
Definition: BaseDecimaterT.hh:86
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
void preprocess_collapse(CollapseInfo &_ci)
Pre-process a collapse.
Definition: BaseDecimaterT_impl.hh:179
void postprocess_collapse(CollapseInfo &_ci)
Post-process a collapse.
Definition: BaseDecimaterT_impl.hh:167
Stores information about a halfedge collapse.
Definition: CollapseInfoT.hh:74
Mesh::VertexHandle vl
Left vertex.
Definition: CollapseInfoT.hh:88
Mesh::HalfedgeHandle v0v1
Halfedge to be collapsed.
Definition: CollapseInfoT.hh:80
Mesh::VertexHandle v1
Remaining vertex.
Definition: CollapseInfoT.hh:83
Mesh::VertexHandle v0
Vertex to be removed.
Definition: CollapseInfoT.hh:82
Mesh::VertexHandle vr
Right vertex.
Definition: CollapseInfoT.hh:89
Base class for all decimation modules.
Definition: ModBaseT.hh:193
virtual void initialize()
Initialize module-internal stuff.
Definition: ModBaseT.hh:229
virtual float collapse_priority(const CollapseInfoT< MeshT > &)
Return collapse priority.
Definition: ModBaseT.hh:245