diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h index 12d0a273651..c312e67228f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Isotropic_remeshing/remesh_impl.h @@ -441,18 +441,24 @@ namespace internal { //insert new edges to keep triangular faces, and update long_edges if (!is_border(hnew, mesh_)) { + Patch_id patch_id = get_patch_id(face(hnew, mesh_)); halfedge_descriptor hnew2 = CGAL::Euler::split_face(hnew, next(next(hnew, mesh_), mesh_), mesh_); put(ecmap_, edge(hnew2, mesh_), false); + set_patch_id(face(hnew2, mesh_), patch_id); + set_patch_id(face(opposite(hnew2, mesh_), mesh_), patch_id); } //do it again on the other side if we're not on boundary halfedge_descriptor hnew_opp = opposite(hnew, mesh_); if (!is_border(hnew_opp, mesh_)) { + Patch_id patch_id = get_patch_id(face(hnew_opp, mesh_)); halfedge_descriptor hnew2 = CGAL::Euler::split_face(prev(hnew_opp, mesh_), next(hnew_opp, mesh_), mesh_); put(ecmap_, edge(hnew2, mesh_), false); + set_patch_id(face(hnew2, mesh_), patch_id); + set_patch_id(face(opposite(hnew2, mesh_), mesh_), patch_id); } } #ifdef CGAL_PMP_REMESHING_VERBOSE diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h index 5a9de5fbdb3..9b6b8c173c9 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/remesh.h @@ -377,6 +377,17 @@ void isotropic_remeshing(const FaceRange& faces * \cgalParamDefault{an automatically indexed internal map} * \cgalParamNEnd * +* \cgalParamNBegin{face_patch_map} +* \cgalParamDescription{a property map with the patch id's associated to the faces of `faces`} +* \cgalParamType{a class model of `ReadWritePropertyMap` with `boost::graph_traits::%face_descriptor` +* as key type and the desired property, model of `CopyConstructible` and `LessThanComparable` as value type.} +* \cgalParamDefault{a default property map where each face is associated with the ID of +* the connected component it belongs to. Connected components are +* computed with respect to the constrained edges listed in the property map +* `edge_is_constrained_map`} +* \cgalParamExtra{The map is updated during the remeshing process while new faces are created.} +* \cgalParamNEnd +* * \cgalParamNBegin{edge_is_constrained_map} * \cgalParamDescription{a property map containing the constrained-or-not status of each edge of `pmesh`} * \cgalParamType{a class model of `ReadWritePropertyMap` with `boost::graph_traits::%edge_descriptor` @@ -421,14 +432,22 @@ void split_long_edges(const EdgeRange& edges ECMap ecmap = choose_parameter(get_parameter(np, internal_np::edge_is_constrained), Static_boolean_property_map()); + typedef typename internal_np::Lookup_named_param_def < + internal_np::face_patch_t, + NamedParameters, + internal::Connected_components_pmap//default + > ::type FPMap; + FPMap fpmap = choose_parameter( + get_parameter(np, internal_np::face_patch), + internal::Connected_components_pmap(faces(pmesh), pmesh, ecmap, fimap, false)); + typename internal::Incremental_remesher, // no constraint pmap - internal::Connected_components_pmap, - FIMap + FPMap,FIMap > remesher(pmesh, vpmap, gt, false/*protect constraints*/, ecmap, Static_boolean_property_map(), - internal::Connected_components_pmap(faces(pmesh), pmesh, ecmap, fimap, false), + fpmap, fimap, false/*need aabb_tree*/);