From e834971904a1bd8183f716f3c3e5a98f76cdec11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 1 Oct 2019 13:03:43 +0200 Subject: [PATCH] Minor code fixes --- .../CGAL/Polygon_mesh_processing/connected_components.h | 3 +-- .../include/CGAL/Polygon_mesh_processing/repair.h | 9 ++++----- .../connected_component_polyhedron.cpp | 4 +++- .../Polygon_mesh_processing/remove_degeneracies_test.cpp | 3 +-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h index 8ca645c7fc2..d356b8dce23 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/connected_components.h @@ -473,8 +473,7 @@ std::size_t keep_large_connected_components(PolygonMesh& pmesh, FaceSizeMap face_size_pmap = choose_parameter(get_parameter(np, internal_np::face_size_map), Constant_property_map(1)); - bool dry_run = choose_parameter(get_parameter(np, internal_np::dry_run), - false); + const bool dry_run = choose_parameter(get_parameter(np, internal_np::dry_run), false); // vector_property_map boost::vector_property_map face_cc(fim); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h index 735906e9a05..f4412e5182e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair.h @@ -168,8 +168,7 @@ std::size_t remove_connected_components_of_negligible_size(TriangleMesh& tmesh, // If no threshold is provided, compute it as a % of the bbox const bool is_default_area_threshold = is_default_parameter(get_parameter(np, internal_np::area_threshold)); const bool is_default_volume_threshold = is_default_parameter(get_parameter(np, internal_np::volume_threshold)); - const bool dry_run = choose_parameter(get_parameter(np, internal_np::dry_run), - false); + const bool dry_run = choose_parameter(get_parameter(np, internal_np::dry_run), false); #ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL std::cout << "default threshold? " << is_default_area_threshold << " " << is_default_volume_threshold << std::endl; @@ -211,9 +210,8 @@ std::size_t remove_connected_components_of_negligible_size(TriangleMesh& tmesh, #ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL std::cout << num << " different connected components" << std::endl; #endif - if(!dry_run){ + if(!dry_run) CGAL::Polygon_mesh_processing::remove_isolated_vertices(tmesh); - } // Compute CC-wide and total areas/volumes FT total_area = 0; @@ -285,7 +283,8 @@ std::size_t remove_connected_components_of_negligible_size(TriangleMesh& tmesh, #ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL std::cout << "Removing " << ccs_to_remove.size() << " CCs" << std::endl; #endif - if(!dry_run){ + if(!dry_run) + { remove_connected_components(tmesh, ccs_to_remove, face_cc, np); CGAL_postcondition(is_valid_polygon_mesh(tmesh)); } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_polyhedron.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_polyhedron.cpp index 618324f490e..d64a43d1ab4 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_polyhedron.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/connected_component_polyhedron.cpp @@ -50,10 +50,12 @@ void mesh_with_id(const char* argv1, const bool save_output) CGAL::parameters::face_size_map( CGAL::Constant_property_map(1)) .dry_run(true)); - if (strcmp(argv1, "data/blobby_3cc.off") == 0){ + if (strcmp(argv1, "data/blobby_3cc.off") == 0) + { assert(nb_to_remove == 1); assert(num_faces(sm) == nb_faces); } + PMP::keep_largest_connected_components(sm, 2, CGAL::parameters::face_size_map( CGAL::Constant_property_map(1))); diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/remove_degeneracies_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/remove_degeneracies_test.cpp index 7058549ed4a..1d1411d2140 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/remove_degeneracies_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/remove_degeneracies_test.cpp @@ -250,8 +250,7 @@ void remove_negligible_connected_components(const char* filename) std::cout << "---------\ndefault values..." << std::endl; std::size_t nb_to_be_rm = PMP::remove_connected_components_of_negligible_size(mesh_cpy, CGAL::parameters::dry_run(true)); - assert(nb_to_be_rm == - PMP::remove_connected_components_of_negligible_size(mesh_cpy)); + assert(nb_to_be_rm == PMP::remove_connected_components_of_negligible_size(mesh_cpy)); assert(PMP::internal::number_of_connected_components(mesh_cpy) == 1); }