diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h index e4d9f60d1a2..44c4756c9ac 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/Face_graph_output_builder.h @@ -1091,6 +1091,10 @@ class Face_graph_output_builder boost::dynamic_bitset<> coplanar_patches_of_tm2_for_union_and_intersection(nb_patches_tm2,false); patch_status_not_set_tm1.set(); patch_status_not_set_tm2.set(); + // extra containers used when entire connected components are identical (filled only if needed) + std::vector coplanar_tm1_to_coplanar_tm2; + std::vector extreme_vertex_per_cc_1; + std::vector extreme_vertex_per_cc_2; // first set coplanar status of patches using the coplanar faces collected during the // extra intersection edges collected. This is important in the case of full connected components @@ -1107,71 +1111,6 @@ class Face_graph_output_builder coplanar_patches_of_tm2.set(tm2_patch_ids[ fid2 ]); } - - //we have the correspondance between cpln patches thanks to faces in tm1_coplanar_faces and tm2_coplanar_faces - CGAL_assertion(tm1_coplanar_faces.size()==tm2_coplanar_faces.size()); - // TODO: move it to do it lazily - std::vector coplanar_tm1_to_coplanar_tm2; - std::vector is_oo_tm1(nb_patches_tm1, false); - std::vector is_oo_tm2(nb_patches_tm2, false); - if (!tm1_coplanar_faces.empty()) - { - coplanar_tm1_to_coplanar_tm2.resize(nb_patches_tm1, NID); - for (std::size_t i=0; i> max_pts_1(nb_patches_tm1); - for (face_descriptor fd : faces(tm1)) - { - std::size_t patch_id = tm1_patch_ids[get(fids1, fd)]; - if (!coplanar_patches_of_tm1.test(patch_id)) continue; - halfedge_descriptor hd=halfedge(fd, tm1); - for (halfedge_descriptor h : CGAL::halfedges_around_face(hd, tm1)) - { - vertex_descriptor vd = target(h, tm1); - if (!max_pts_1[patch_id].has_value() || get(vpm1,max_pts_1[patch_id].value())> max_pts_2(nb_patches_tm2); - for (face_descriptor fd : faces(tm2)) - { - std::size_t patch_id = tm2_patch_ids[get(fids2, fd)]; - if (!coplanar_patches_of_tm2.test(patch_id)) continue; - halfedge_descriptor hd=halfedge(fd, tm2); - for (halfedge_descriptor h : CGAL::halfedges_around_face(hd, tm2)) - { - vertex_descriptor vd = target(h, tm2); - if (!max_pts_2[patch_id].has_value() || get(vpm2,max_pts_2[patch_id].value())::null_vertex(); + extreme_vertex_per_cc_1.assign(nb_patches_tm1, null_v); + for (face_descriptor fd : faces(tm1)) + { + std::size_t patch_id = tm1_patch_ids[get(fids1, fd)]; + if (!coplanar_patches_of_tm1.test(patch_id)) continue; + halfedge_descriptor hd=halfedge(fd, tm1); + for (halfedge_descriptor h : CGAL::halfedges_around_face(hd, tm1)) + { + vertex_descriptor vd = target(h, tm1); + if (extreme_vertex_per_cc_1[patch_id]==null_v || get(vpm1,extreme_vertex_per_cc_1[patch_id])