Minor code fixes

This commit is contained in:
Mael Rouxel-Labbé 2019-10-01 13:03:43 +02:00
parent 978a3f9504
commit e834971904
4 changed files with 9 additions and 10 deletions

View File

@ -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), FaceSizeMap face_size_pmap = choose_parameter(get_parameter(np, internal_np::face_size_map),
Constant_property_map<face_descriptor, std::size_t>(1)); Constant_property_map<face_descriptor, std::size_t>(1));
bool dry_run = choose_parameter(get_parameter(np, internal_np::dry_run), const bool dry_run = choose_parameter(get_parameter(np, internal_np::dry_run), false);
false);
// vector_property_map // vector_property_map
boost::vector_property_map<std::size_t, FaceIndexMap> face_cc(fim); boost::vector_property_map<std::size_t, FaceIndexMap> face_cc(fim);

View File

@ -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 // 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_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 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), const bool dry_run = choose_parameter(get_parameter(np, internal_np::dry_run), false);
false);
#ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL #ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL
std::cout << "default threshold? " << is_default_area_threshold << " " << is_default_volume_threshold << std::endl; 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 #ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL
std::cout << num << " different connected components" << std::endl; std::cout << num << " different connected components" << std::endl;
#endif #endif
if(!dry_run){ if(!dry_run)
CGAL::Polygon_mesh_processing::remove_isolated_vertices(tmesh); CGAL::Polygon_mesh_processing::remove_isolated_vertices(tmesh);
}
// Compute CC-wide and total areas/volumes // Compute CC-wide and total areas/volumes
FT total_area = 0; 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 #ifdef CGAL_PMP_DEBUG_SMALL_CC_REMOVAL
std::cout << "Removing " << ccs_to_remove.size() << " CCs" << std::endl; std::cout << "Removing " << ccs_to_remove.size() << " CCs" << std::endl;
#endif #endif
if(!dry_run){ if(!dry_run)
{
remove_connected_components(tmesh, ccs_to_remove, face_cc, np); remove_connected_components(tmesh, ccs_to_remove, face_cc, np);
CGAL_postcondition(is_valid_polygon_mesh(tmesh)); CGAL_postcondition(is_valid_polygon_mesh(tmesh));
} }

View File

@ -50,10 +50,12 @@ void mesh_with_id(const char* argv1, const bool save_output)
CGAL::parameters::face_size_map( CGAL::parameters::face_size_map(
CGAL::Constant_property_map<face_descriptor, std::size_t>(1)) CGAL::Constant_property_map<face_descriptor, std::size_t>(1))
.dry_run(true)); .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(nb_to_remove == 1);
assert(num_faces(sm) == nb_faces); assert(num_faces(sm) == nb_faces);
} }
PMP::keep_largest_connected_components(sm, 2, PMP::keep_largest_connected_components(sm, 2,
CGAL::parameters::face_size_map( CGAL::parameters::face_size_map(
CGAL::Constant_property_map<face_descriptor, std::size_t>(1))); CGAL::Constant_property_map<face_descriptor, std::size_t>(1)));

View File

@ -250,8 +250,7 @@ void remove_negligible_connected_components(const char* filename)
std::cout << "---------\ndefault values..." << std::endl; 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)); 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 == assert(nb_to_be_rm == PMP::remove_connected_components_of_negligible_size(mesh_cpy));
PMP::remove_connected_components_of_negligible_size(mesh_cpy));
assert(PMP::internal::number_of_connected_components(mesh_cpy) == 1); assert(PMP::internal::number_of_connected_components(mesh_cpy) == 1);
} }