From 0a44740ee380b06abfb6496d208e712ef7acc030 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 12 Nov 2024 15:30:34 +0100 Subject: [PATCH] use triple intersection --- .../Polygon_mesh_processing/CMakeLists.txt | 3 ++- .../snap_and_corefinement_union.cpp | 19 +++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt index b9e21bf8fab5..fb20c8fa7e49 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/CMakeLists.txt @@ -37,7 +37,6 @@ create_single_source_cgal_program("test_corefinement_and_constraints.cpp") create_single_source_cgal_program("test_corefinement_and_constraints_nearest.cpp") create_single_source_cgal_program("test_corefinement_bool_op.cpp") create_single_source_cgal_program("test_corefine.cpp") -create_single_source_cgal_program("snap_and_corefinement_union.cpp") create_single_source_cgal_program("test_coref_epic_points_identity.cpp") create_single_source_cgal_program("test_does_bound_a_volume.cpp") create_single_source_cgal_program("test_pmp_clip.cpp") @@ -88,6 +87,8 @@ if(TARGET CGAL::Eigen3_support) target_link_libraries(test_decimation_of_planar_patches PUBLIC CGAL::Eigen3_support) create_single_source_cgal_program("remeshing_quality_test.cpp" ) target_link_libraries(remeshing_quality_test PUBLIC CGAL::Eigen3_support) + create_single_source_cgal_program("snap_and_corefinement_union.cpp") + target_link_libraries(snap_and_corefinement_union PUBLIC CGAL::Eigen3_support) else() message(STATUS "NOTICE: Tests that use the Eigen library will not be compiled.") endif() diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/snap_and_corefinement_union.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/snap_and_corefinement_union.cpp index f02bd3a935f0..d7a921074968 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/snap_and_corefinement_union.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/snap_and_corefinement_union.cpp @@ -303,17 +303,13 @@ void coregularize(MeshRange meshes, FT epsilon, FT angle, FT reg_epsilon, FT reg const EPlane_3& second = to_exact(*it++); const EPlane_3& third = to_exact(*it++); - const auto inter = CGAL::intersection(first, second); - CGAL_assertion(bool(inter)); - ELine_3 l; - if (!CGAL::assign(l, inter)) - continue; - const auto inter2 = CGAL::intersection(l, third); + const auto inter = CGAL::intersection(first, second, third); EPoint_3 p; + ELine_3 l; - if (CGAL::assign(p, inter2)) + if (CGAL::assign(p, inter)) m.point(v) = from_exact(p); - else if (CGAL::assign(l, inter2)) + else if (CGAL::assign(l, inter)) m.point(v) = from_exact(l.projection(to_exact(m.point(v)))); } else { @@ -370,7 +366,10 @@ int main(int argc, char* argv[]) //std::vector meshes = load_folder("C:/Data/Unite"); coregularize(meshes, epsilon, 90.0, epsilon, 0.1, true, true, CGAL::Epick()); - /*PMP::experimental::surface_snapping(mesh1, mesh2, epsilon); + // PMP::experimental::surface_snapping(mesh1, mesh2, epsilon); + + std::ofstream("reg_m1.off") << std::setprecision(17) << mesh1; + std::ofstream("reg_m2.off") << std::setprecision(17) << mesh2; Mesh out; bool valid_union = PMP::corefine_and_compute_union(mesh1,mesh2, out); @@ -380,7 +379,7 @@ int main(int argc, char* argv[]) std::cout << "Union was successfully computed\n"; CGAL::IO::write_polygon_mesh("snap_union.off", out, CGAL::parameters::stream_precision(17)); return 0; - }*/ + } std::cout << "Union could not be computed\n";