From f6418c6145577d53a6ab305a33141c07bd7f3c96 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 9 Oct 2017 11:22:54 +0200 Subject: [PATCH 01/12] add a little verbosity --- .../internal/Isotropic_remeshing/remesh_impl.h | 7 +++++++ 1 file changed, 7 insertions(+) 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 fd3f765bbf0..8264eca04a3 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 @@ -616,6 +616,10 @@ namespace internal { #ifdef CGAL_PMP_REMESHING_VERBOSE std::cout << "Collapse short edges (" << low << ", " << high << ")..." << std::endl; +#endif +#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS + std::cout << "Fill bimap..."; + std::cout.flush(); #endif double sq_low = low*low; double sq_high = high*high; @@ -627,6 +631,9 @@ namespace internal { if( (sqlen < sq_low) && is_collapse_allowed(e) ) short_edges.insert(short_edge(halfedge(e, mesh_), sqlen)); } +#ifdef CGAL_PMP_REMESHING_VERBOSE_PROGRESS + std::cout << "done." << std::endl; +#endif unsigned int nb_collapses = 0; while (!short_edges.empty()) From 3e4e4968f7e732af5af2f43ef80837ad2b9a59c7 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 9 Oct 2017 11:26:34 +0200 Subject: [PATCH 02/12] add missing vertex_point_map --- .../internal/Isotropic_remeshing/remesh_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8264eca04a3..ea0e1e9b488 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 @@ -1437,7 +1437,7 @@ private: if (GeomTraits().collinear_3_object()(p,q,r)) return CGAL::NULL_VECTOR; else - return PMP::compute_face_normal(f, mesh_); + return PMP::compute_face_normal(f, mesh_, parameters::vertex_point_map(vpmap_)); } template From 6a5c46dd5029d901692ef547667bb00fa0d50e47 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 9 Oct 2017 11:27:06 +0200 Subject: [PATCH 03/12] remove duplicate member variable --- .../internal/Isotropic_remeshing/remesh_impl.h | 1 - 1 file changed, 1 deletion(-) 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 ea0e1e9b488..2ee5141fdf8 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 @@ -1918,7 +1918,6 @@ private: Patch_id_to_index_map patch_id_to_index_map; Triangle_list input_triangles_; Patch_id_list input_patch_ids_; - Patch_id_to_index_map patch_id_to_index_map_; Halfedge_status_pmap halfedge_status_pmap_; bool protect_constraints_; FacePatchMap patch_ids_map_; From 00def95173a1ddaa31f482650d0e6edd4a44ec73 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 9 Oct 2017 11:32:12 +0200 Subject: [PATCH 04/12] use the face_patch_map only when it is valid o.w. isotropic_remeshing "thinks" it is using a valid face_patch_map, does not compute the connected components from constraints, and fails remeshing properly next to constraints --- .../PMP/Isotropic_remeshing_plugin.cpp | 127 ++++++++++++------ 1 file changed, 88 insertions(+), 39 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index 7f19038424f..eb404da32ee 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -1,6 +1,7 @@ //#define CGAL_PMP_REMESHING_VERBOSE //#define CGAL_PMP_REMESHING_DEBUG //#define CGAL_PMP_REMESHING_VERY_VERBOSE +//#define CGAL_PMP_REMESHING_VERBOSE_PROGRESS #include @@ -346,6 +347,22 @@ public Q_SLOTS: : *selection_item->polyhedron(); reset_face_ids(pmesh); + + Patch_id_pmap fpmap; + bool fpmap_valid = false; + if(boost::graph_has_property()>::type::value) + { + fpmap = get(CGAL::face_patch_id_t(), *poly_item->polyhedron()); + BOOST_FOREACH(face_descriptor f, faces(pmesh)) + { + if (get(fpmap, f) != 1) + { + fpmap_valid = true; + break;/*1 is the default value for both Surface_mesh and Polyhedron*/ + } + } + } + if (selection_item) { if (edges_only) @@ -378,11 +395,8 @@ public Q_SLOTS: else std::cout << "No selected or boundary edges to be split" << std::endl; } - else + else //not edges_only { - if (selection_item->selected_facets.empty() && - (!selection_item->selected_edges.empty() || !selection_item->selected_vertices.empty())) - { if(protect && !CGAL::Polygon_mesh_processing::internal::constraints_are_short_enough( *selection_item->polyhedron(), @@ -399,31 +413,54 @@ public Q_SLOTS: return; } - CGAL::Polygon_mesh_processing::isotropic_remeshing( - faces(*selection_item->polyhedron()) - , target_length - , *selection_item->polyhedron() - , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) - .protect_constraints(protect) - .edge_is_constrained_map(selection_item->constrained_edges_pmap()) - .relax_constraints(smooth_features) - .number_of_relaxation_steps(nb_smooth) - .vertex_is_constrained_map(selection_item->constrained_vertices_pmap()) - - .face_patch_map(get(CGAL::face_patch_id_t(), *selection_item->polyhedron()))); - } - else - CGAL::Polygon_mesh_processing::isotropic_remeshing( - selection_item->selected_facets - , target_length - , *selection_item->polyhedron() - , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) - .protect_constraints(protect) - .edge_is_constrained_map(selection_item->constrained_edges_pmap()) - .relax_constraints(smooth_features) - .number_of_relaxation_steps(nb_smooth) - .vertex_is_constrained_map(selection_item->constrained_vertices_pmap()) - .face_patch_map(get(CGAL::face_patch_id_t(), *selection_item->polyhedron()))); + if (selection_item->selected_facets.empty() && !selection_item->isEmpty()) + { + if (fpmap_valid) + CGAL::Polygon_mesh_processing::isotropic_remeshing(faces(*selection_item->polyhedron()) + , target_length + , *selection_item->polyhedron() + , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) + .protect_constraints(protect) + .edge_is_constrained_map(selection_item->constrained_edges_pmap()) + .relax_constraints(smooth_features) + .number_of_relaxation_steps(nb_smooth) + .vertex_is_constrained_map(selection_item->constrained_vertices_pmap()) + .face_patch_map(fpmap)); + else + CGAL::Polygon_mesh_processing::isotropic_remeshing(faces(*selection_item->polyhedron()) + , target_length + , *selection_item->polyhedron() + , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) + .protect_constraints(protect) + .edge_is_constrained_map(selection_item->constrained_edges_pmap()) + .relax_constraints(smooth_features) + .number_of_relaxation_steps(nb_smooth) + .vertex_is_constrained_map(selection_item->constrained_vertices_pmap())); + } + else //selected_facets not empty + { + if (fpmap_valid) + CGAL::Polygon_mesh_processing::isotropic_remeshing(selection_item->selected_facets + , target_length + , *selection_item->polyhedron() + , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) + .protect_constraints(protect) + .edge_is_constrained_map(selection_item->constrained_edges_pmap()) + .relax_constraints(smooth_features) + .number_of_relaxation_steps(nb_smooth) + .vertex_is_constrained_map(selection_item->constrained_vertices_pmap()) + .face_patch_map(fpmap)); + else + CGAL::Polygon_mesh_processing::isotropic_remeshing(selection_item->selected_facets + , target_length + , *selection_item->polyhedron() + , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) + .protect_constraints(protect) + .edge_is_constrained_map(selection_item->constrained_edges_pmap()) + .relax_constraints(smooth_features) + .number_of_relaxation_steps(nb_smooth) + .vertex_is_constrained_map(selection_item->constrained_vertices_pmap())); + } } #ifdef USE_SURFACE_MESH selection_item->polyhedron_item()->setColor( @@ -475,16 +512,28 @@ public Q_SLOTS: } Scene_polyhedron_selection_item::Is_constrained_map ecm(&edges_to_protect); - CGAL::Polygon_mesh_processing::isotropic_remeshing( - faces(*poly_item->polyhedron()) - , target_length - , *poly_item->polyhedron() - , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) - .protect_constraints(protect) - .number_of_relaxation_steps(nb_smooth) - .face_patch_map(get(CGAL::face_patch_id_t(), *poly_item->polyhedron())) - .edge_is_constrained_map(ecm) - .relax_constraints(smooth_features)); + if (fpmap_valid) + CGAL::Polygon_mesh_processing::isotropic_remeshing( + faces(*poly_item->polyhedron()) + , target_length + , *poly_item->polyhedron() + , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) + .protect_constraints(protect) + .number_of_relaxation_steps(nb_smooth) + .edge_is_constrained_map(ecm) + .relax_constraints(smooth_features) + .face_patch_map(fpmap)); + else + CGAL::Polygon_mesh_processing::isotropic_remeshing( + faces(*poly_item->polyhedron()) + , target_length + , *poly_item->polyhedron() + , CGAL::Polygon_mesh_processing::parameters::number_of_iterations(nb_iter) + .protect_constraints(protect) + .number_of_relaxation_steps(nb_smooth) + .edge_is_constrained_map(ecm) + .relax_constraints(smooth_features)); + } //destroys the patch_id_map for the Surface_mesh_item to avoid assertions. #ifdef USE_SURFACE_MESH From ddaad24e635d188157afc8ffe3a556422612b8c7 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 10 Oct 2017 11:45:21 +0200 Subject: [PATCH 05/12] add corner case conditions for collapsibility --- .../internal/Isotropic_remeshing/remesh_impl.h | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 1cc413af89d..5d45ef11304 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 @@ -618,6 +618,14 @@ namespace internal { swap_done = true; CGAL_assertion(is_on_patch_border(vb) && !is_on_patch_border(va)); } + else if (is_corner(va) && !is_corner(vb)) + { + he = opposite(he, mesh_); + va = source(he, mesh_); + vb = target(he, mesh_); + swap_done = true; + CGAL_assertion(is_on_patch_border(vb) && !is_on_patch_border(va)); + } if(!collapse_does_not_invert_face(he)) { @@ -630,6 +638,8 @@ namespace internal { if (is_on_patch_border(va) && !is_on_patch_border(vb)) continue;//we cannot swap again. It would lead to a face inversion + else if (is_corner(va) && !is_corner(vb)) + continue;//idem } else continue;//both directions invert a face From 6e8bb6b03e83b8c8da77d3fc8e92bae6caa6439a Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 10 Oct 2017 11:48:37 +0200 Subject: [PATCH 06/12] deal with more than 2 patches in the collapsibility checks --- .../Isotropic_remeshing/remesh_impl.h | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) 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 5d45ef11304..67142860299 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 @@ -1318,9 +1318,10 @@ private: //collect normals to faces around vs AND vt //vertices are at the same location, but connectivity is still be same, //with plenty of degenerate triangles (which are common to both stars) - std::vector normals_patch1; - std::vector normals_patch2; - Patch_id patch1 = -1, patch2 = -1; + typedef std::multimap Normals_multimap; + typedef typename Normals_multimap::iterator Normals_iterator; + + Normals_multimap normals_per_patch; BOOST_FOREACH(halfedge_descriptor hd, hedges) { Vector_3 n = compute_normal(face(hd, mesh_)); @@ -1328,20 +1329,28 @@ private: continue; Patch_id pid = get_patch_id(face(hd, mesh_)); - if (patch1 == Patch_id(-1)) - patch1 = pid; //not met yet - else if (patch2 == Patch_id(-1) && patch1 != pid) - patch2 = pid; //not met yet - CGAL_assertion(pid == patch1 || pid == patch2); - - if (pid == patch1) normals_patch1.push_back(n); - else normals_patch2.push_back(n); + normals_per_patch.insert(std::make_pair(pid, n)); } //on each surface patch, //check all normals have same orientation - bool res = check_orientation(normals_patch1) - && check_orientation(normals_patch2); + bool res = true; + for (Normals_iterator it = normals_per_patch.begin(); + it != normals_per_patch.end();/*done inside loop*/) + { + std::vector normals; + std::pair n_range + = normals_per_patch.equal_range((*it).first); + for (Normals_iterator iit = n_range.first; iit != n_range.second; ++iit) + normals.push_back((*iit).second); + + if (!check_orientation(normals)) + { + res = false; + break; + } + it = n_range.second; + } //restore position put(vpmap_, vs, ps); From c657f43f199ca9724bddde19f0382f04eb90d1f8 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 10 Oct 2017 12:07:53 +0200 Subject: [PATCH 07/12] deal with more than 2 surface patches in check_normals(v) until now it did not deal with the corner cases --- .../Isotropic_remeshing/remesh_impl.h | 40 +++++++++++-------- 1 file changed, 23 insertions(+), 17 deletions(-) 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 67142860299..4b0bfee986e 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 @@ -1783,35 +1783,41 @@ private: //have all their 2 by 2 dot products > 0 bool check_normals(const vertex_descriptor& v) const { - if (is_corner(v)) - return true;//if we want to deal with this case, - //we should use a multimap to store + //collect normals to faces around vs AND vt + //vertices are at the same location, but connectivity is still be same, + //with plenty of degenerate triangles (which are common to both stars) + typedef std::multimap Normals_multimap; + typedef typename Normals_multimap::iterator Normals_iterator; - std::vector normals_patch1; - std::vector normals_patch2; - Patch_id patch1 = -1, patch2 = -1; + Normals_multimap normals_per_patch; BOOST_FOREACH(halfedge_descriptor hd, halfedges_around_target(halfedge(v, mesh_), mesh_)) { Vector_3 n = compute_normal(face(hd, mesh_)); - if (n == CGAL::NULL_VECTOR) + if (n == CGAL::NULL_VECTOR) //for degenerate faces continue; Patch_id pid = get_patch_id(face(hd, mesh_)); - if (patch1 == Patch_id(-1)) - patch1 = pid; //not met yet - else if (patch2 == Patch_id(-1) && patch1 != pid) - patch2 = pid; //not met yet - CGAL_assertion(pid == patch1 || pid == patch2); - - if (pid == patch1) normals_patch1.push_back(n); - else normals_patch2.push_back(n); + normals_per_patch.insert(std::make_pair(pid, n)); } //on each surface patch, //check all normals have same orientation - return check_orientation(normals_patch1) - && check_orientation(normals_patch2); + for (Normals_iterator it = normals_per_patch.begin(); + it != normals_per_patch.end();/*done inside loop*/) + { + std::vector normals; + std::pair n_range + = normals_per_patch.equal_range((*it).first); + for (Normals_iterator iit = n_range.first; iit != n_range.second; ++iit) + normals.push_back((*iit).second); + + if (!check_orientation(normals)) + return false; + + it = n_range.second; + } + return true; } bool check_normals(const halfedge_descriptor& h) const From 8d486694dc8395fc1de7da1a7af4671eee3d98b8 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 10 Oct 2017 12:51:04 +0200 Subject: [PATCH 08/12] use check_normals() inside collapse_does_not_invert_face() --- .../Isotropic_remeshing/remesh_impl.h | 59 ++++--------------- 1 file changed, 12 insertions(+), 47 deletions(-) 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 4b0bfee986e..20ed1824ca9 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 @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -1306,51 +1307,13 @@ private: //move source at target put(vpmap_, vs, get(vpmap_, vt)); - //collect halfedges around vs and vt - std::vector hedges; - BOOST_FOREACH(halfedge_descriptor hd, - halfedges_around_target(h, mesh_)) - hedges.push_back(hd); - BOOST_FOREACH(halfedge_descriptor hd, - halfedges_around_target(opposite(h, mesh_), mesh_)) - hedges.push_back(hd); - //collect normals to faces around vs AND vt //vertices are at the same location, but connectivity is still be same, //with plenty of degenerate triangles (which are common to both stars) - typedef std::multimap Normals_multimap; - typedef typename Normals_multimap::iterator Normals_iterator; - - Normals_multimap normals_per_patch; - BOOST_FOREACH(halfedge_descriptor hd, hedges) - { - Vector_3 n = compute_normal(face(hd, mesh_)); - if (n == CGAL::NULL_VECTOR) //for degenerate faces - continue; - Patch_id pid = get_patch_id(face(hd, mesh_)); - - normals_per_patch.insert(std::make_pair(pid, n)); - } - - //on each surface patch, - //check all normals have same orientation - bool res = true; - for (Normals_iterator it = normals_per_patch.begin(); - it != normals_per_patch.end();/*done inside loop*/) - { - std::vector normals; - std::pair n_range - = normals_per_patch.equal_range((*it).first); - for (Normals_iterator iit = n_range.first; iit != n_range.second; ++iit) - normals.push_back((*iit).second); - - if (!check_orientation(normals)) - { - res = false; - break; - } - it = n_range.second; - } + bool res = check_normals( + boost::range::join( + halfedges_around_target(h, mesh_), + halfedges_around_target(opposite(h, mesh_), mesh_))); //restore position put(vpmap_, vs, ps); @@ -1783,15 +1746,17 @@ private: //have all their 2 by 2 dot products > 0 bool check_normals(const vertex_descriptor& v) const { - //collect normals to faces around vs AND vt - //vertices are at the same location, but connectivity is still be same, - //with plenty of degenerate triangles (which are common to both stars) + return check_normals(halfedges_around_target(halfedge(v, mesh_), mesh_)); + } + + template + bool check_normals(const HalfedgeRange& hedges) const + { typedef std::multimap Normals_multimap; typedef typename Normals_multimap::iterator Normals_iterator; Normals_multimap normals_per_patch; - BOOST_FOREACH(halfedge_descriptor hd, - halfedges_around_target(halfedge(v, mesh_), mesh_)) + BOOST_FOREACH(halfedge_descriptor hd, hedges) { Vector_3 n = compute_normal(face(hd, mesh_)); if (n == CGAL::NULL_VECTOR) //for degenerate faces From 03e7265cefd98fbd3b5e8a007aea6e54e6f2cb20 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Mon, 16 Oct 2017 13:04:42 +0200 Subject: [PATCH 09/12] a Polyhedron_3 does not have an internal pmap for face_patch_id_t so the condition was always returning false for a Polyhedron we are inside the demo, so this condition can be safely removed --- .../internal/Isotropic_remeshing/remesh_impl.h | 3 +++ .../Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp | 4 +--- 2 files changed, 4 insertions(+), 3 deletions(-) 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 2ee5141fdf8..e6a0f47103e 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 @@ -189,6 +189,9 @@ namespace internal { patch_ids_map = CGAL::internal::add_property(Face_property_tag("PMP_patch_id"), pmesh); if (do_init) { +#ifdef CGAL_PMP_REMESHING_VERBOSE + std::cout << "Compute connected components property map." << std::endl; +#endif nb_cc = PMP::connected_components(pmesh, patch_ids_map, diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index eb404da32ee..d0b20dcb040 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -348,11 +348,9 @@ public Q_SLOTS: reset_face_ids(pmesh); - Patch_id_pmap fpmap; + Patch_id_pmap fpmap = get(CGAL::face_patch_id_t(), pmesh); bool fpmap_valid = false; - if(boost::graph_has_property()>::type::value) { - fpmap = get(CGAL::face_patch_id_t(), *poly_item->polyhedron()); BOOST_FOREACH(face_descriptor f, faces(pmesh)) { if (get(fpmap, f) != 1) From fb0d7840d595e41e7ce77321190925ccc82fe1a9 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 17 Oct 2017 15:30:37 +0200 Subject: [PATCH 10/12] remove useless check for reverse version --- .../internal/Isotropic_remeshing/remesh_impl.h | 8 -------- 1 file changed, 8 deletions(-) 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 20ed1824ca9..8b81645fe0d 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 @@ -619,14 +619,6 @@ namespace internal { swap_done = true; CGAL_assertion(is_on_patch_border(vb) && !is_on_patch_border(va)); } - else if (is_corner(va) && !is_corner(vb)) - { - he = opposite(he, mesh_); - va = source(he, mesh_); - vb = target(he, mesh_); - swap_done = true; - CGAL_assertion(is_on_patch_border(vb) && !is_on_patch_border(va)); - } if(!collapse_does_not_invert_face(he)) { From 47283bc7cb0eb4d16c7f3eb69b68158b12201851 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 17 Oct 2017 12:02:09 +0200 Subject: [PATCH 11/12] pmesh cannot be const when a property map is added by get() and add missing includes # Conflicts: # Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp --- .../Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index d0b20dcb040..aec9867409c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -9,11 +9,15 @@ #ifdef USE_SURFACE_MESH #include "Scene_surface_mesh_item.h" +#include #else #include "Scene_polyhedron_item.h" #include "Polyhedron_type.h" +#include #endif +#include + #include "Scene_polyhedron_selection_item.h" #include @@ -342,7 +346,7 @@ public Q_SLOTS: typedef boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef boost::graph_traits::face_descriptor face_descriptor; - const FaceGraph& pmesh = (poly_item != NULL) + FaceGraph& pmesh = (poly_item != NULL) ? *poly_item->polyhedron() : *selection_item->polyhedron(); From 96857e44ed6db307c0d658cebfe0aa5e93f25c2d Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 17 Oct 2017 15:11:45 +0200 Subject: [PATCH 12/12] fix multicolor Surface_mesh --- .../demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp index aec9867409c..afb5ea4213a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Isotropic_remeshing_plugin.cpp @@ -467,7 +467,7 @@ public Q_SLOTS: #ifdef USE_SURFACE_MESH selection_item->polyhedron_item()->setColor( selection_item->polyhedron_item()->color()); - selection_item->polyhedron_item()->setItemIsMulticolor(false); + selection_item->polyhedron_item()->setItemIsMulticolor(fpmap_valid); selection_item->polyhedron_item()->polyhedron()->collect_garbage(); #else if(!selection_item->polyhedron_item()->isItemMulticolor())