From 61735be71c41fb1455a0d525ea7aa27b5cd37f80 Mon Sep 17 00:00:00 2001 From: Konstantinos Katrioplas Date: Fri, 16 Mar 2018 14:08:43 +0100 Subject: [PATCH 1/4] deny triangulation for input of 3 points or less when using all search space --- .../internal/Hole_filling/Triangulate_hole_polyline.h | 2 +- .../triangulate_hole_polyline_test.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h index e3c16de3575..3b95209a73c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Hole_filling/Triangulate_hole_polyline.h @@ -1142,7 +1142,7 @@ public: triangulate_all(P, Q, WC, std::make_pair(0,n-1), W, lambda); - if(W.get(0,n-1) == Weight::NOT_VALID()) { + if(W.get(0,n-1) == Weight::NOT_VALID() || n <= 2) { #ifndef CGAL_TEST_SUITE CGAL_warning(!"Returning no output. No possible triangulation is found!"); #else diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp index 04cc90402c7..83be7542ce9 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp @@ -198,6 +198,8 @@ void test_should_be_no_output(const char* file_name, bool use_DT) { } Main() { + + std::vector input_files_1; input_files_1.push_back("data/triangle.polylines.txt"); input_files_1.push_back("data/quad.polylines.txt"); @@ -223,6 +225,8 @@ void test_should_be_no_output(const char* file_name, bool use_DT) { test_should_be_no_output("data/collinear.polylines.txt", true); test_should_be_no_output("data/collinear.polylines.txt", false); + test_should_be_no_output("data/null_edge.polylines.txt", true); + test_should_be_no_output("data/null_edge.polylines.txt", false); std::cerr << "All Done!" << std::endl; } From 9b4c24223b2137291674e05126a47a848f7f1bab Mon Sep 17 00:00:00 2001 From: Konstantinos Katrioplas Date: Fri, 16 Mar 2018 14:47:02 +0100 Subject: [PATCH 2/4] fix warning message on Polyhedron demo when not using DT --- .../Plugins/PMP/Hole_filling_polyline_plugin.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp index 561dbeb7163..0b1c3a79f5f 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Hole_filling_polyline_plugin.cpp @@ -114,8 +114,14 @@ public Q_SLOTS: print_message(QString("Triangulated in %1 sec.").arg(timer.time())); if(patch.empty()) { - print_message("Warning: generating patch is not successful, please try it without 'Delaunay Triangulation'!"); - continue; + if(use_DT){ + print_message("Warning: generating patch is not successful, please try it without 'Delaunay Triangulation'!"); + continue; + } + else{ + print_message("Warning: generating patch is not successful, skipping."); + continue; + } } if(mw->property("is_polyhedron_mode").toBool()){ From 0f14c1fad0d8d539b04846ed4f7d53780d098991 Mon Sep 17 00:00:00 2001 From: Konstantinos Katrioplas Date: Fri, 16 Mar 2018 15:10:40 +0100 Subject: [PATCH 3/4] rm empty lines --- .../Polygon_mesh_processing/triangulate_hole_polyline_test.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp index 83be7542ce9..c6998746633 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_polyline_test.cpp @@ -198,8 +198,6 @@ void test_should_be_no_output(const char* file_name, bool use_DT) { } Main() { - - std::vector input_files_1; input_files_1.push_back("data/triangle.polylines.txt"); input_files_1.push_back("data/quad.polylines.txt"); From bec3227a00f8316fdf73025948aa88744758d170 Mon Sep 17 00:00:00 2001 From: Konstantinos Katrioplas Date: Fri, 16 Mar 2018 15:13:42 +0100 Subject: [PATCH 4/4] add data test file --- .../test/Polygon_mesh_processing/data/null_edge.polylines.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 Polygon_mesh_processing/test/Polygon_mesh_processing/data/null_edge.polylines.txt diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/data/null_edge.polylines.txt b/Polygon_mesh_processing/test/Polygon_mesh_processing/data/null_edge.polylines.txt new file mode 100644 index 00000000000..5ef80544145 --- /dev/null +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/data/null_edge.polylines.txt @@ -0,0 +1 @@ +3 -1 -1 0 1 1 0 -1 -1 0