Fixed runaway selection

This commit is contained in:
Jan Möbius
2020-06-19 15:54:39 +02:00
parent 2d90392e0c
commit cfb9af64f7

View File

@@ -144,13 +144,13 @@ void DecimaterT<Mesh>::heap_vertex(VertexHandle _vh) {
mesh_.property(priority_, _vh) = -1;
}
}
//-----------------------------------------------------------------------------
template<class Mesh>
size_t DecimaterT<Mesh>::decimate(size_t _n_collapses, bool _only_selected) {
if (!this->is_initialized())
return 0;
//-----------------------------------------------------------------------------
template<class Mesh>
size_t DecimaterT<Mesh>::decimate(size_t _n_collapses, bool _only_selected) {
if (!this->is_initialized())
return 0;
typename Mesh::VertexHandle vp;
typename Mesh::HalfedgeHandle v0v1;
@@ -234,16 +234,17 @@ size_t DecimaterT<Mesh>::decimate(size_t _n_collapses, bool _only_selected) {
// update heap (former one ring of decimated vertex)
for (s_it = support.begin(), s_end = support.end(); s_it != s_end; ++s_it) {
assert(!mesh_.status(*s_it).deleted());
heap_vertex(*s_it);
}
// notify observer and stop if the observer requests it
if (!this->notify_observer(n_collapses))
return n_collapses;
}
// delete heap
assert(!mesh_.status(*s_it).deleted());
if (!_only_selected || mesh_.status(*s_it).selected() )
heap_vertex(*s_it);
}
// notify observer and stop if the observer requests it
if (!this->notify_observer(n_collapses))
return n_collapses;
}
// delete heap
heap_.reset();
@@ -252,13 +253,13 @@ size_t DecimaterT<Mesh>::decimate(size_t _n_collapses, bool _only_selected) {
return n_collapses;
}
//-----------------------------------------------------------------------------
template<class Mesh>
size_t DecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf, bool _only_selected) {
if (!this->is_initialized())
return 0;
//-----------------------------------------------------------------------------
template<class Mesh>
size_t DecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf, bool _only_selected) {
if (!this->is_initialized())
return 0;
if (_nv >= mesh_.n_vertices() || _nf >= mesh_.n_faces())
return 0;
@@ -345,16 +346,16 @@ size_t DecimaterT<Mesh>::decimate_to_faces(size_t _nv, size_t _nf, bool _only_se
// update heap (former one ring of decimated vertex)
for (s_it = support.begin(), s_end = support.end(); s_it != s_end; ++s_it) {
assert(!mesh_.status(*s_it).deleted());
heap_vertex(*s_it);
}
// notify observer and stop if the observer requests it
if (!this->notify_observer(n_collapses))
return n_collapses;
}
// delete heap
assert(!mesh_.status(*s_it).deleted());
heap_vertex(*s_it);
}
// notify observer and stop if the observer requests it
if (!this->notify_observer(n_collapses))
return n_collapses;
}
// delete heap
heap_.reset();