diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp index de7e3ee347f..a873edba038 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/hole_filling_example_SM.cpp @@ -62,7 +62,17 @@ struct Progress { Progress(const Progress&) = delete; - void start_quadratic_phase(int n) + void start_planar_phase() const + { + std::cout << "Start planar phase"<< std::endl; + } + + void end_planar_phase(bool success) const + { + std::cout << "End planar phase " << (success? "(success)" : "(failed)") << std::endl; + } + + void start_quadratic_phase(int n) { timer.start(); quadratic_i = 0; @@ -82,7 +92,7 @@ struct Progress { void end_quadratic_phase(bool success) const { timer.stop(); - std::cout << "End Quadratic phase " << timer.time() << " sec. " << (success ? "(success)" : "(falied)") << std::endl; + std::cout << "End Quadratic phase " << timer.time() << " sec. " << (success ? "(success)" : "(failed)") << std::endl; timer.reset(); } 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 731f24b5ca1..3af5e28b102 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 @@ -1341,6 +1341,8 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, typedef typename Traits::Vector_3 Vector_3; typedef typename Traits::Collinear_3 Collinear_3; + visitor.start_planar_phase(); + // Compute an average normal of the hole. const Collinear_3 collinear_3 = traits.collinear_3_object(); @@ -1383,6 +1385,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, if (num_normals < 1) { // std::cerr << "WARNING: num normals, cdt 2 falls back to the original solution!" << std::endl; + visitor.end_planar_phase(false); return false; } @@ -1394,11 +1397,14 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, const Vector_3 avg_normal = Vector_3(x, y, z); // std::cout << "avg normal: " << avg_normal << std::endl; - if (avg_normal==NULL_VECTOR) return false; - + if (avg_normal==NULL_VECTOR){ + visitor.end_planar_phase(false); + return false; + } // Checking the hole planarity. if (!is_planar_2(P, avg_normal, max_squared_distance, traits)) { // std::cerr << "WARNING: planarity, cdt 2 falls back to the original solution!" << std::endl; + visitor.end_planar_phase(false); return false; } @@ -1407,6 +1413,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, const P_traits p_traits(avg_normal); if (!is_simple_2(P.begin(), P.end() - 1, p_traits)) { // std::cerr << "WARNING: simplicity, cdt 2 falls back to the original solution!" << std::endl; + visitor.end_planar_phase(false); return false; } @@ -1468,6 +1475,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, if (cdt.dimension() != 2 || cdt.number_of_vertices() != size) { // std::cerr << "WARNING: dim + num vertices, cdt 2 falls back to the original solution!" << std::endl; + visitor.end_planar_phase(false); return false; } @@ -1485,6 +1493,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, lambda.put(is[0], is[2], is[1]); if (!is_valid(P, is[0], is[1], is[2])) { // std::cerr << "WARNING: validity, cdt 2 falls back to the original solution!" << std::endl; + visitor.end_planar_phase(false); return false; } } @@ -1493,6 +1502,7 @@ triangulate_hole_polyline_with_cdt(const PointRange& points, // Call the tracer. It correctly orients the patch faces. // std::cout << "CDT is being used!" << std::endl; tracer(lambda, 0, static_cast(size) - 1); + visitor.end_planar_phase(true); return true; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h index 4c9cbc916d7..bf69f1e6e0c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_hole.h @@ -37,6 +37,12 @@ namespace Polygon_mesh_processing { struct Hole_fill_visitor{ + void start_planar_phase() const + {} + + void end_planar_phase(bool) const + {} + void start_quadratic_phase(int /* N*/) const {}