From 9e6eaa504a8ae59398efb7f4ccf1cd368a9f288c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Tue, 23 Mar 2021 13:42:10 +0100 Subject: [PATCH] Orientation requirements always on, as it won't work without it on non triangle meshes --- .../compare_meshes_example.cpp | 2 +- .../CGAL/Polygon_mesh_processing/measure.h | 24 ++++--------------- .../Polygon_mesh_processing/measures_test.cpp | 7 +++--- .../Diff_between_meshes_plugin.cpp | 11 +-------- 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/compare_meshes_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/compare_meshes_example.cpp index ad60ec7091d..08d3553947a 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/compare_meshes_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/compare_meshes_example.cpp @@ -36,7 +36,7 @@ int main(int argc, char* argv[]) } std::vector > common; std::vector m1_only, m2_only; - PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only), std::back_inserter(m2_only), CGAL::parameters::all_default(), CGAL::parameters::all_default()); + PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only), std::back_inserter(m2_only)); std::cout<<"Faces only in m1 : "<& ids, bool orientation_counts) +inline void rearrange_face_ids(boost::container::small_vector& ids) { - if(!orientation_counts) - { - std::sort(ids.begin(), ids.end()); - } - else - { auto min_elem = std::min_element(ids.begin(), ids.end()); std::rotate(ids.begin(), min_elem, ids.end()); - } } }//end pmp_internal /** @@ -843,6 +836,7 @@ centroid(const TriangleMesh& tmesh) * \ingroup measure_grp * given two meshes, separates the faces that are only in one, the faces * that are only in the other one, and the faces that are common to both. + * Faces with different orientations will be considered as not shared. * * @tparam PolygonMesh a model of `HalfedgeListGraph` and `FaceListGraph` * @tparam OutputFaceIterator model of `OutputIterator` @@ -882,15 +876,6 @@ centroid(const TriangleMesh& tmesh) * or using an external map. The latter might result in - slightly - worsened performance * in case of non-constant complexity for index access.} * \cgalParamNEnd - * \cgalParamNBegin{require_same_orientation} - * \cgalParamDescription{Parameter (np1 only) to indicate if face orientation should be taken - * into account when determining whether two faces are duplicates. - * If `true`, then the triangles `0,1,2` and `0,2,1` will not be considered - * as "shared" between the two meshes.} - * \cgalParamType{Boolean} - * \cgalParamDefault{`false`} - *\cgalParamNEnd - * \cgalNamedParamsEnd * */ @@ -911,7 +896,6 @@ void compare_meshes(const PolygonMesh& m1, const PolygonMesh& m2, get_const_property_map(vertex_point, m2)); VIMap1 vim1 = get_initialized_vertex_index_map(m1, np1); VIMap1 vim2 = get_initialized_vertex_index_map(m2, np2); - const bool same_orientation = choose_parameter(get_parameter(np1, internal_np::require_same_orientation), false); typedef typename boost::property_traits::value_type Point_3; typedef typename boost::graph_traits::face_descriptor face_descriptor; @@ -960,7 +944,7 @@ void compare_meshes(const PolygonMesh& m1, const PolygonMesh& m2, } if(all_shared) { - pmp_internal::rearrange_face_ids(ids, same_orientation); + pmp_internal::rearrange_face_ids(ids); m1_faces_map.insert({ids, f}); } else @@ -982,7 +966,7 @@ void compare_meshes(const PolygonMesh& m1, const PolygonMesh& m2, } if(all_shared) { - pmp_internal::rearrange_face_ids(ids, same_orientation); + pmp_internal::rearrange_face_ids(ids); auto it = m1_faces_map.find(ids); if(it != m1_faces_map.end()) { diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp index ed8d1b30019..3ce828e8faa 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/measures_test.cpp @@ -337,7 +337,8 @@ void test_compare() return; } input.close(); - PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only), std::back_inserter(m2_only), CGAL::parameters::require_same_orientation(true), CGAL::parameters::all_default()); + PMP::compare_meshes(mesh1, mesh2, std::back_inserter(common), std::back_inserter(m1_only), + std::back_inserter(m2_only)); assert(common.size() == 0); assert(m1_only.size() == 18); assert(m2_only.size() == 18); @@ -346,7 +347,7 @@ void test_compare() int main(int argc, char* argv[]) { -/* const char* filename_polyhedron = + const char* filename_polyhedron = (argc > 1) ? argv[1] : "data/mech-holes-shark.off"; test_polyhedron,Epic>(filename_polyhedron); test_polyhedron,Epec>(filename_polyhedron); @@ -359,7 +360,6 @@ int main(int argc, char* argv[]) // It won't work with Epec for large meshes as it builds up a deep DAG // leading to a stackoverflow when the destructor is called. test_centroid,Epic>(filename_surface_mesh); -*/ test_compare >(); test_compare >(); test_compare >(); @@ -367,3 +367,4 @@ int main(int argc, char* argv[]) std::cerr << "All done." << std::endl; return 0; } + diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp index 11d61ac8916..1fba8c28759 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Diff_between_meshes_plugin.cpp @@ -75,14 +75,6 @@ void Polyhedron_demo_diff_between_meshes_plugin::diff() typedef CGAL::Face_filtered_graph Filtered_graph; QCursor c(Qt::WaitCursor); - - QMessageBox msgBox; - msgBox.setText("Require the Same Orientation ?"); - msgBox.setInformativeText("Should face orientation count for duplicate detection ?"); - msgBox.setStandardButtons(QMessageBox::Yes| QMessageBox::No); - msgBox.setDefaultButton(QMessageBox::No); - int ret = msgBox.exec(); - bool same_orientation = (ret == QMessageBox::Yes); CGAL::Three::Three::CursorScopeGuard guard(c); //Get the two meshes. No need to check their existance, applicable() @@ -101,8 +93,7 @@ void Polyhedron_demo_diff_between_meshes_plugin::diff() m2, std::back_inserter(common), std::back_inserter(m1_only), - std::back_inserter(m2_only), - CGAL::parameters::require_same_orientation(same_orientation)); + std::back_inserter(m2_only)); Filtered_graph filter1(m1, m1_only); SMesh mesh1_only, mesh2_only, common_mesh;