I am using CGAL Clip method to create intersected mesh, and I am trying to get the split face using the callback void before_subface_creations(face_descriptor f_old, Mesh&)
, and the following code is its official example:
void before_subface_creations(face_descriptor fd)
{
std::cout << "split : " << fd << " into:" << std::endl;
Container::iterator it = container.find(fd);
qfd = it->second;
container.erase(it);
}
However, when I use this code in my test, a face_descriptor
which has the same idx_ run into this callback twice.
I am confused about it because I think face_descriptor
should be unique and if a face_descriptor
get called, the container will erase it, then why a face_descriptor
that has the same idx_ run into the callback twice?
what I am really curious about is the logic of Clip(which is among corefinement operations) and why it may result one triangle face be splitted twice? and should the example code in CGAL be updated as follows:
void before_subface_creations(face_descriptor f_old, Mesh&)
{
std::cout << "split : " << f_old << " into:" << std::endl;
Container::iterator it = container.find(f_old);
if (it == container.end())
{
std::cout << "not found";
}
else
{
qfd = it->second;
container.erase(it);
}
}
You are mixing things up. The example you are pointing out is for triangulating a mesh, and the visitor must model the concept PMPTriangulateFaceVisitor. If you are using corefinement, the visitor must model the concept PMPCorefinementVisitor. In clip (and corefinement) you have 2 meshes so the same id might appear twice but with different meshes.