@snacks I isolated the passage responsible:
//remove slack
faces.erase(std::remove_if(faces.begin(),
faces.end(),
[](Face& face){return face.id==0;}),
faces.end());
for(Face& face : faces){
refcounters[face.a->id]++;
refcounters[face.b->id]++;
refcounters[face.b->id]++;
}
vertices.erase(std::remove_if(vertices.begin(),
vertices.end(),
[](Vertex& vertex){
return refcounters[vertex.id]==0;
}),
vertices.end());
even if NO visually unintelligible vertices are found, if I comment out the detection part, the "remove slack" section breaks the mesh. any idea?