add a way to collect input coplanar faces after corefinement

This commit is contained in:
Sébastien Loriot 2024-04-25 20:50:07 +02:00
parent 6257109821
commit 86bf5305c8
3 changed files with 32 additions and 0 deletions

View File

@ -119,6 +119,9 @@ public:
/// The point has already been put in the vertex point map.
void after_vertex_copy(vertex_descriptor v_src, const Triangle_mesh& tm_src,
vertex_descriptor v_tgt, const Triangle_mesh& tm_tgt);
/// called for each face `f` in the output mesh `tm` that belongs to the intersection of two coplanar faces of the input meshes.
void input_coplanar_face(face_descriptor f, TriangleMesh& tm);
/// @}
/// @name Functions used by corefine() for progress tracking

View File

@ -2131,6 +2131,34 @@ public:
Patches1 patches_of_tm1(tm1, tm1_patch_ids, fids1, intersection_edges1, nb_patches_tm1);
Patches2 patches_of_tm2(tm2, tm2_patch_ids, fids2, intersection_edges2, nb_patches_tm2);
// report input coplanar faces
if (coplanar_patches_of_tm1.any())
{
for (std::size_t i = coplanar_patches_of_tm1.find_first();
i < coplanar_patches_of_tm1.npos;
i = coplanar_patches_of_tm1.find_next(i))
{
for (face_descriptor f : patches_of_tm1[i].faces)
{
user_visitor.input_coplanar_face(f, tm1);
}
}
}
if (coplanar_patches_of_tm2.any())
{
for (std::size_t i = coplanar_patches_of_tm2.find_first();
i < coplanar_patches_of_tm2.npos;
i = coplanar_patches_of_tm2.find_next(i))
{
for (face_descriptor f : patches_of_tm2[i].faces)
{
user_visitor.input_coplanar_face(f, tm2);
}
}
}
// for each boolean operation, define two bitsets of patches contributing
// to the result
std::vector< boost::dynamic_bitset<> > patches_of_tm1_used(4);

View File

@ -428,6 +428,7 @@ struct Default_visitor{
void before_face_copy(face_descriptor /*f_old*/, const TriangleMesh&, TriangleMesh&){}
void after_face_copy(face_descriptor /*f_old*/, const TriangleMesh&,
face_descriptor /* f_new */, TriangleMesh&){}
void input_coplanar_face(face_descriptor /*f*/, TriangleMesh&) {}
// edge visitor functions
void before_edge_split(halfedge_descriptor /* h */, TriangleMesh& /* tm */){}
void edge_split(halfedge_descriptor /* hnew */, TriangleMesh& /* tm */){}