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/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 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..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 @@ -223,6 +223,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; } 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()){