So here we have a Polyhedron mesh with signed faces. But how to put that signed faces into a new Polyhedron mesh? To smplify: say we loaded a 100 faces mesh, we want to pick 50 random faces from it and put them into a new mesh. How one can do it in CGAL?
There is the following undocumented function in CGAL/Polygon_mesh_processing/connected_components.h
:
CGAL::internal::corefinement::extract_connected_components(
const Polyhedron& P,
const Adjacency_criterium& adjacent,
Output_iterator out);
Adjacency_criterium is a function object like the following:
struct AC_example{
bool
operator()(Polyhedron::Halfedge_handle h) const
{
bool incident_faces_in_the_same_component = .... ;
return incident_faces_in_the_same_component;
}
};
It must return true for all but the patch border halfedges.
Output_iterator
is an output iterator of Polyhedron
In CGAL 4.10, the function moved into CGAL/internal/corefinemnt/connected_components.h
. A nicer and more generic function is on its way and should be published in an upcoming release.