The bug was to compare prior and next, whereas we have to compare *prior with *next

This commit is contained in:
Andreas Fabri 2025-02-12 17:35:28 +00:00
parent 33eec61830
commit bc6d19e11b
1 changed files with 18 additions and 7 deletions

View File

@ -143,10 +143,9 @@ public:
}
// endpoints of constraints are unremovable
// vertices which have more than 1 constraint passing through are unremovable
// vertices which are not endpoint and have != 2 incident constrained edges are unremovable
void initialize_unremovable()
{
std::unordered_map<Vertex_handle, int> degrees;
Constraint_iterator cit = pct.constraints_begin(), e = pct.constraints_end();
for(; cit!=e; ++cit){
Constraint_id cid = *cit;
@ -155,18 +154,30 @@ public:
(*it)->set_removable(false);
++it;
for(; it != ite; ++it){
Vertex_handle vh = *it;
++degrees[vh];
if((boost::next(it) != ite) && (boost::prior(it)== boost::next(it))){
if(boost::next(it) != ite){
Vertex_handle vp = *boost::prior(it), vn = *boost::next(it);
if(vp == vn){
(*it)->set_removable(false);
}
}
}
it = boost::prior(it);
(*it)->set_removable(false);
}
std::unordered_map<Vertex_handle, int> degrees;
for (Constrained_edges_iterator it = pct.constrained_edges_begin(); it != pct.constrained_edges_end(); ++it) {
Edge e = *it;
Face_handle fh = e.first;
int ei = e.second;
Vertex_handle vh = fh->vertex(pct.cw(ei));
++degrees[vh];
vh = fh->vertex(pct.ccw(ei));
++degrees[vh];
}
for(Finite_vertices_iterator it = pct.finite_vertices_begin(); it != pct.finite_vertices_end(); ++it){
if( it->is_removable() && (degrees[it] > 1) ){
if( it->is_removable() && (degrees[it] != 2) ){
it->set_removable(false);
}
}