From f2ff13d6c4243d81697349edc3f30c16557dbeda Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 1 Aug 2018 11:25:52 +0200 Subject: [PATCH 01/21] Add a visitor that allows to map each triangle to its original face # Conflicts: # BGL/include/CGAL/boost/graph/named_params_helper.h # Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp # Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h --- .../CGAL/boost/graph/named_params_helper.h | 27 +++++++ .../CGAL/boost/graph/parameters_interface.h | 1 + .../Polygon_mesh_processing/CMakeLists.txt | 1 + .../triangulate_faces_example.cpp | 76 ++++++++++++++++++- .../triangulate_faces.h | 55 ++++++++++---- 5 files changed, 141 insertions(+), 19 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index d3cd5b68461..689d84239a4 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -303,6 +303,33 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa > ::type type; }; + + template + class GetSplitVisitor + { + public: + struct DummySplitVisitor + { + template + void start(const T&) const + {} + + template + void operator()(const T&) const + {} + + void done() const + {} + }; + + typedef typename boost::lookup_named_param_def < + internal_np::split_visitor_t, + NamedParameters, + DummySplitVisitor//default + > ::type type; + }; + + } // namespace Polygon_mesh_processing namespace internal { BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_iterator, iterator, false) diff --git a/BGL/include/CGAL/boost/graph/parameters_interface.h b/BGL/include/CGAL/boost/graph/parameters_interface.h index 5086319451b..3918b5df2d6 100644 --- a/BGL/include/CGAL/boost/graph/parameters_interface.h +++ b/BGL/include/CGAL/boost/graph/parameters_interface.h @@ -47,6 +47,7 @@ CGAL_add_named_parameter(geom_traits_t, geom_traits, geom_traits) CGAL_add_named_parameter(vertex_incident_patches_t, vertex_incident_patches, vertex_incident_patches_map) CGAL_add_named_parameter(density_control_factor_t, density_control_factor, density_control_factor) CGAL_add_named_parameter(use_delaunay_triangulation_t, use_delaunay_triangulation, use_delaunay_triangulation) +CGAL_add_named_parameter(split_visitor_t, split_visitor, split_visitor) CGAL_add_named_parameter(fairing_continuity_t, fairing_continuity, fairing_continuity) CGAL_add_named_parameter(sparse_linear_solver_t, sparse_linear_solver, sparse_linear_solver) CGAL_add_named_parameter(number_of_relaxation_steps_t, number_of_relaxation_steps, number_of_relaxation_steps) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt index 8f748d69246..ec8bb41756b 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/CMakeLists.txt @@ -67,6 +67,7 @@ create_single_source_cgal_program( "compute_normals_example_Polyhedron.cpp" CXX create_single_source_cgal_program( "compute_normals_example.cpp" CXX_FEATURES cxx_range_for cxx_auto_type ) create_single_source_cgal_program( "point_inside_example.cpp") create_single_source_cgal_program( "triangulate_faces_example.cpp") +create_single_source_cgal_program( "triangulate_faces_split_visitor_example.cpp") create_single_source_cgal_program( "connected_components_example.cpp") create_single_source_cgal_program( "face_filtered_graph_example.cpp") create_single_source_cgal_program( "orient_polygon_soup_example.cpp") diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp index 63528119d44..4e2e7808278 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp @@ -2,28 +2,98 @@ #include #include +#include +#include #include +#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::Point_3 Point; typedef CGAL::Surface_mesh Surface_mesh; +typedef boost::graph_traits::face_descriptor face_descriptor; + + + +class Insert_iterator +{ + typedef boost::unordered_map Container; + Container& container; +public: + + Insert_iterator(Container &c) + : container(c) {} + + Insert_iterator& + operator=(const std::pair& p) + { + container[p.second] = p.first; + return *this; + } + + Insert_iterator& + operator*() { return *this; } + + Insert_iterator + operator++(int) { return *this; } + +}; + + +struct Visitor { + typedef boost::unordered_map Container; + + Container& container; + face_descriptor qfd; + + Visitor(Container& container) + : container(container) + {} + + void start(face_descriptor fd) + { + std::cout << "split : " << fd << " into:" << std::endl; + Container::iterator it = container.find(fd); + qfd = it->second; + container.erase(it); + } + + void operator()(face_descriptor fd) + { + std::cout << " " << fd; + container[fd]=qfd; + } + + void done() + { + std::cout << std::endl; + } +}; + int main(int argc, char* argv[]) { const char* filename = (argc > 1) ? argv[1] : "data/P.off"; - const char* outfilename = (argc > 2) ? argv[2] : "P_tri.off"; std::ifstream input(filename); - + Surface_mesh mesh; if (!input || !(input >> mesh) || mesh.is_empty()) { std::cerr << "Not a valid off file." << std::endl; return 1; } + + boost::unordered_map t2q; + + Surface_mesh copy; + + copy_face_graph(mesh, copy, CGAL::Emptyset_iterator(), CGAL::Emptyset_iterator(),Insert_iterator(t2q)); + + Visitor v(t2q); + CGAL::Polygon_mesh_processing::triangulate_faces(copy, + CGAL::Polygon_mesh_processing::parameters::split_visitor(v)); - CGAL::Polygon_mesh_processing::triangulate_faces(mesh); // Confirm that all faces are triangles. for(boost::graph_traits::face_descriptor fit : faces(mesh)) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 9abbfeadf1c..ebd1aa9cea5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -49,7 +49,8 @@ namespace internal { template + , typename Kernel + , typename Visitor> class Triangulate_modifier { typedef Kernel Traits; @@ -80,7 +81,7 @@ public: return fh->info().is_external; } - bool triangulate_face(face_descriptor f, PM& pmesh, bool use_cdt) + bool triangulate_face(face_descriptor f, PM& pmesh, bool use_cdt, Visitor visitor) { typedef typename Traits::FT FT; @@ -116,14 +117,19 @@ public: */ FT p1p3 = CGAL::cross_product(p2-p1,p3-p2) * CGAL::cross_product(p0-p3,p1-p0); FT p0p2 = CGAL::cross_product(p1-p0,p1-p2) * CGAL::cross_product(p3-p2,p3-p0); + visitor.start(f); + halfedge_descriptor res; if(p0p2>p1p3) { - CGAL::Euler::split_face(v0, v2, pmesh); + res = CGAL::Euler::split_face(v0, v2, pmesh); } else { - CGAL::Euler::split_face(v1, v3, pmesh); + res = CGAL::Euler::split_face(v1, v3, pmesh); } + visitor(face(res,pmesh)); + visitor(face(opposite(res,pmesh),pmesh)); + visitor.done(); } else { @@ -143,19 +149,20 @@ public: Itag> CDT; P_traits cdt_traits(normal); CDT cdt(cdt_traits); - return triangulate_face_with_CDT(f, pmesh, cdt); + return triangulate_face_with_CDT(f, pmesh, cdt, visitor); } #else CGAL_USE(use_cdt); #endif - return triangulate_face_with_hole_filling(f, pmesh); + return triangulate_face_with_hole_filling(f, pmesh, visitor); } return true; } template - bool triangulate_face_with_CDT(face_descriptor f, PM& pmesh, CDT& cdt) + bool triangulate_face_with_CDT(face_descriptor f, PM& pmesh, CDT& cdt, Visitor visitor) { + std::cout << "triangulate_face_with_CDT"<< std::endl; std::size_t original_size = CGAL::halfedges_around_face(halfedge(f, pmesh), pmesh).size(); // Halfedge_around_facet_circulator @@ -212,6 +219,7 @@ public: // then modify the polyhedron + visitor.start(f); // make_hole. (see comment in function body) this->make_hole(halfedge(f, pmesh), pmesh); @@ -268,12 +276,14 @@ public: set_next(h2, h0, pmesh); Euler::fill_hole(h0, pmesh); + visitor(face(h0, pmesh)); } } + visitor.done(); return true; } - bool triangulate_face_with_hole_filling(face_descriptor f, PM& pmesh) + bool triangulate_face_with_hole_filling(face_descriptor f, PM& pmesh, Visitor visitor) { namespace PMP = CGAL::Polygon_mesh_processing; @@ -307,6 +317,7 @@ public: ++i; } + visitor.start(f); bool first = true; std::vector hedges; hedges.reserve(4); @@ -316,7 +327,8 @@ public: first=false; else f=add_face(pmesh); - + visitor(f); + std::array indices = make_array( triangle.first, triangle.second, @@ -346,11 +358,12 @@ public: set_halfedge(f, hedges[0], pmesh); hedges.clear(); } + visitor.done(); return true; } template - bool operator()(FaceRange face_range, PM& pmesh, bool use_cdt) + bool operator()(FaceRange face_range, PM& pmesh, bool use_cdt, Visitor visitor) { bool result = true; // One need to store facet handles into a vector, because the list of @@ -368,7 +381,7 @@ public: // Iterates on the vector of face descriptors for(face_descriptor f : facets) { - if(!this->triangulate_face(f, pmesh, use_cdt)) + if(!this->triangulate_face(f, pmesh, use_cdt, visitor)) result = false; } return result; @@ -445,9 +458,14 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor //Option bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); - - internal::Triangulate_modifier modifier(vpmap, traits); - return modifier.triangulate_face(f, pmesh, use_cdt); + + typedef typename GetSplitVisitor::type SplitVisitor; + typedef typename GetSplitVisitor::DummySplitVisitor DummySplitVisitor; + SplitVisitor visitor = choose_param(get_param(np, internal_np::split_visitor), + DummySplitVisitor()); + + internal::Triangulate_modifier modifier(vpmap); + return modifier.triangulate_face(f, pmesh, use_cdt, visitor); } template @@ -513,8 +531,13 @@ bool triangulate_faces(FaceRange face_range, //Option bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); - internal::Triangulate_modifier modifier(vpmap, traits); - return modifier(face_range, pmesh, use_cdt); + typedef typename GetSplitVisitor::type SplitVisitor; + typedef typename GetSplitVisitor::DummySplitVisitor DummySplitVisitor; + SplitVisitor visitor = choose_param(get_param(np, internal_np::split_visitor), + DummySplitVisitor()); + + internal::Triangulate_modifier modifier(vpmap); + return modifier(face_range, pmesh, use_cdt, visitor); } template From 903fff4751343dbecf3095873d0befaff9b7ef7c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 1 Aug 2018 11:38:01 +0200 Subject: [PATCH 02/21] Restore example and add one for the visitor # Conflicts: # Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp --- .../triangulate_faces_example.cpp | 76 +------------ ...riangulate_faces_split_visitor_example.cpp | 104 ++++++++++++++++++ 2 files changed, 107 insertions(+), 73 deletions(-) create mode 100644 Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp index 4e2e7808278..63528119d44 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_example.cpp @@ -2,98 +2,28 @@ #include #include -#include -#include #include -#include typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; typedef Kernel::Point_3 Point; typedef CGAL::Surface_mesh Surface_mesh; -typedef boost::graph_traits::face_descriptor face_descriptor; - - - -class Insert_iterator -{ - typedef boost::unordered_map Container; - Container& container; -public: - - Insert_iterator(Container &c) - : container(c) {} - - Insert_iterator& - operator=(const std::pair& p) - { - container[p.second] = p.first; - return *this; - } - - Insert_iterator& - operator*() { return *this; } - - Insert_iterator - operator++(int) { return *this; } - -}; - - -struct Visitor { - typedef boost::unordered_map Container; - - Container& container; - face_descriptor qfd; - - Visitor(Container& container) - : container(container) - {} - - void start(face_descriptor fd) - { - std::cout << "split : " << fd << " into:" << std::endl; - Container::iterator it = container.find(fd); - qfd = it->second; - container.erase(it); - } - - void operator()(face_descriptor fd) - { - std::cout << " " << fd; - container[fd]=qfd; - } - - void done() - { - std::cout << std::endl; - } -}; - int main(int argc, char* argv[]) { const char* filename = (argc > 1) ? argv[1] : "data/P.off"; + const char* outfilename = (argc > 2) ? argv[2] : "P_tri.off"; std::ifstream input(filename); - + Surface_mesh mesh; if (!input || !(input >> mesh) || mesh.is_empty()) { std::cerr << "Not a valid off file." << std::endl; return 1; } - - boost::unordered_map t2q; - - Surface_mesh copy; - - copy_face_graph(mesh, copy, CGAL::Emptyset_iterator(), CGAL::Emptyset_iterator(),Insert_iterator(t2q)); - - Visitor v(t2q); - CGAL::Polygon_mesh_processing::triangulate_faces(copy, - CGAL::Polygon_mesh_processing::parameters::split_visitor(v)); + CGAL::Polygon_mesh_processing::triangulate_faces(mesh); // Confirm that all faces are triangles. for(boost::graph_traits::face_descriptor fit : faces(mesh)) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp new file mode 100644 index 00000000000..c0d9f363723 --- /dev/null +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp @@ -0,0 +1,104 @@ +#include +#include + +#include +#include + +#include +#include + +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel; +typedef Kernel::Point_3 Point; +typedef CGAL::Surface_mesh Surface_mesh; +typedef boost::graph_traits::face_descriptor face_descriptor; + + + +class Insert_iterator +{ + typedef boost::unordered_map Container; + Container& container; +public: + + Insert_iterator(Container &c) + : container(c) {} + + Insert_iterator& + operator=(const std::pair& p) + { + container[p.second] = p.first; + return *this; + } + + Insert_iterator& + operator*() { return *this; } + + Insert_iterator + operator++(int) { return *this; } + +}; + + +struct Visitor { + typedef boost::unordered_map Container; + + Container& container; + face_descriptor qfd; + + Visitor(Container& container) + : container(container) + {} + + void start(face_descriptor fd) + { + std::cout << "split : " << fd << " into:" << std::endl; + Container::iterator it = container.find(fd); + qfd = it->second; + container.erase(it); + } + + void operator()(face_descriptor fd) + { + std::cout << " " << fd; + container[fd]=qfd; + } + + void done() + { + std::cout << std::endl; + } +}; + + +int main(int argc, char* argv[]) +{ + const char* filename = (argc > 1) ? argv[1] : "data/P.off"; + std::ifstream input(filename); + + Surface_mesh mesh; + if (!input || !(input >> mesh) || mesh.is_empty()) + { + std::cerr << "Not a valid off file." << std::endl; + return 1; + } + + boost::unordered_map t2q; + + Surface_mesh copy; + + copy_face_graph(mesh, copy, CGAL::Emptyset_iterator(), CGAL::Emptyset_iterator(),Insert_iterator(t2q)); + + Visitor v(t2q); + CGAL::Polygon_mesh_processing::triangulate_faces(copy, + CGAL::Polygon_mesh_processing::parameters::split_visitor(v)); + + + for(boost::unordered_map::iterator it = t2q.begin(); it != t2q.end(); ++it){ + std::cout << it->first << " " << it->second << std::endl; + } + + return 0; +} From 5490227707b858567d08a974a945ca5d70dfd14f Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Sep 2020 18:45:30 +0200 Subject: [PATCH 03/21] fix compilation after rebase --- .../CGAL/boost/graph/named_params_helper.h | 15 ++++++++------- .../Polygon_mesh_processing/triangulate_faces.h | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 689d84239a4..b74fa4a8c16 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -303,7 +303,8 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa > ::type type; }; - + namespace Polygon_mesh_processing + { template class GetSplitVisitor { @@ -313,20 +314,20 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa template void start(const T&) const {} - + template - void operator()(const T&) const + void operator()(const T&) const {} - + void done() const {} }; - typedef typename boost::lookup_named_param_def < + typedef typename internal_np::Lookup_named_param_def< internal_np::split_visitor_t, NamedParameters, DummySplitVisitor//default - > ::type type; + >::type type; }; } // namespace Polygon_mesh_processing @@ -336,7 +337,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa } template, + typename NamedParameters = CGAL::Named_function_parameters, bool has_nested_iterator = internal::Has_nested_type_iterator::value> class GetPointMap { diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index ebd1aa9cea5..a35056271ad 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -533,7 +533,7 @@ bool triangulate_faces(FaceRange face_range, typedef typename GetSplitVisitor::type SplitVisitor; typedef typename GetSplitVisitor::DummySplitVisitor DummySplitVisitor; - SplitVisitor visitor = choose_param(get_param(np, internal_np::split_visitor), + SplitVisitor visitor = choose_parameter(get_parameter(np, internal_np::split_visitor), DummySplitVisitor()); internal::Triangulate_modifier modifier(vpmap); From 7f154f5c4141c89fe3f5488052acb60de0416017 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Sep 2020 18:45:47 +0200 Subject: [PATCH 04/21] remove trailing whitespaces --- ...riangulate_faces_split_visitor_example.cpp | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp index c0d9f363723..77d302d96e2 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp @@ -32,13 +32,13 @@ public: container[p.second] = p.first; return *this; } - + Insert_iterator& operator*() { return *this; } Insert_iterator operator++(int) { return *this; } - + }; @@ -51,7 +51,7 @@ struct Visitor { Visitor(Container& container) : container(container) {} - + void start(face_descriptor fd) { std::cout << "split : " << fd << " into:" << std::endl; @@ -59,13 +59,13 @@ struct Visitor { qfd = it->second; container.erase(it); } - + void operator()(face_descriptor fd) { std::cout << " " << fd; container[fd]=qfd; } - + void done() { std::cout << std::endl; @@ -77,20 +77,20 @@ int main(int argc, char* argv[]) { const char* filename = (argc > 1) ? argv[1] : "data/P.off"; std::ifstream input(filename); - + Surface_mesh mesh; if (!input || !(input >> mesh) || mesh.is_empty()) { std::cerr << "Not a valid off file." << std::endl; return 1; } - + boost::unordered_map t2q; - + Surface_mesh copy; - + copy_face_graph(mesh, copy, CGAL::Emptyset_iterator(), CGAL::Emptyset_iterator(),Insert_iterator(t2q)); - + Visitor v(t2q); CGAL::Polygon_mesh_processing::triangulate_faces(copy, CGAL::Polygon_mesh_processing::parameters::split_visitor(v)); From 268c0eabee6d235ae98db2389b21cdd752f15f0a Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Sep 2020 19:03:34 +0200 Subject: [PATCH 05/21] replace operator() with more explicit visit() function --- BGL/include/CGAL/boost/graph/named_params_helper.h | 2 +- .../triangulate_faces_split_visitor_example.cpp | 5 +++-- .../Polygon_mesh_processing/triangulate_faces.h | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index b74fa4a8c16..2e6a53b63fd 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -316,7 +316,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa {} template - void operator()(const T&) const + void visit(const T&) const {} void done() const diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp index 77d302d96e2..1fbfe9d0a0a 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp @@ -42,7 +42,8 @@ public: }; -struct Visitor { +struct Visitor +{ typedef boost::unordered_map Container; Container& container; @@ -60,7 +61,7 @@ struct Visitor { container.erase(it); } - void operator()(face_descriptor fd) + void visit(face_descriptor fd) { std::cout << " " << fd; container[fd]=qfd; diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index a35056271ad..9f9fbcddb4f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -127,8 +127,8 @@ public: { res = CGAL::Euler::split_face(v1, v3, pmesh); } - visitor(face(res,pmesh)); - visitor(face(opposite(res,pmesh),pmesh)); + visitor.visit(face(res,pmesh)); + visitor.visit(face(opposite(res,pmesh),pmesh)); visitor.done(); } else @@ -276,7 +276,7 @@ public: set_next(h2, h0, pmesh); Euler::fill_hole(h0, pmesh); - visitor(face(h0, pmesh)); + visitor.visit(face(h0, pmesh)); } } visitor.done(); @@ -327,8 +327,8 @@ public: first=false; else f=add_face(pmesh); - visitor(f); - + visitor.visit(f); + std::array indices = make_array( triangle.first, triangle.second, @@ -458,12 +458,12 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor //Option bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); - + typedef typename GetSplitVisitor::type SplitVisitor; typedef typename GetSplitVisitor::DummySplitVisitor DummySplitVisitor; SplitVisitor visitor = choose_param(get_param(np, internal_np::split_visitor), DummySplitVisitor()); - + internal::Triangulate_modifier modifier(vpmap); return modifier.triangulate_face(f, pmesh, use_cdt, visitor); } From 626ba2745c267688d120a40c8d282f0ecca4a7d6 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Sep 2020 21:42:00 +0200 Subject: [PATCH 06/21] replace done() by end() to be consistent with start() --- BGL/include/CGAL/boost/graph/named_params_helper.h | 2 +- .../triangulate_faces_split_visitor_example.cpp | 2 +- .../CGAL/Polygon_mesh_processing/triangulate_faces.h | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 2e6a53b63fd..ec4dfe43ba5 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -319,7 +319,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa void visit(const T&) const {} - void done() const + void end() const {} }; diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp index 1fbfe9d0a0a..931a0a0e0c7 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp @@ -67,7 +67,7 @@ struct Visitor container[fd]=qfd; } - void done() + void end() { std::cout << std::endl; } diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 9f9fbcddb4f..47c9516cb10 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -129,7 +129,7 @@ public: } visitor.visit(face(res,pmesh)); visitor.visit(face(opposite(res,pmesh),pmesh)); - visitor.done(); + visitor.end(); } else { @@ -279,7 +279,7 @@ public: visitor.visit(face(h0, pmesh)); } } - visitor.done(); + visitor.end(); return true; } @@ -358,7 +358,7 @@ public: set_halfedge(f, hedges[0], pmesh); hedges.clear(); } - visitor.done(); + visitor.end(); return true; } From cba55b26b58dfb7ce39f7962b9bc7c94f2f87a4a Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Sep 2020 22:05:45 +0200 Subject: [PATCH 07/21] start doc --- .../CGAL/Polygon_mesh_processing/triangulate_faces.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 47c9516cb10..fc479a3718e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -435,6 +435,14 @@ public: * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd +* +* \cgalParamNBegin{split_visitor} +* \cgalParamDescription{a visitor that allows track how faces are split} +* \cgalParamType{a class model of `SplitVisitor`} +* \cgalParamDefault{No visitor.} +* \cgalParamExtra{Note that the visitor will be copied, so +* it should not have any data member that does have a reference-like type.} +* `\cgalParamNEnd * \cgalNamedParamsEnd * * @return `true` if the face has been triangulated. From 07c538743859cf1bd6f6ba1077019b9f5981af4a Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Sep 2020 22:07:35 +0200 Subject: [PATCH 08/21] avoid uninitialized warning --- .../Polygon_mesh_processing/triangulate_faces.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index fc479a3718e..032a230c0db 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -118,15 +118,10 @@ public: FT p1p3 = CGAL::cross_product(p2-p1,p3-p2) * CGAL::cross_product(p0-p3,p1-p0); FT p0p2 = CGAL::cross_product(p1-p0,p1-p2) * CGAL::cross_product(p3-p2,p3-p0); visitor.start(f); - halfedge_descriptor res; - if(p0p2>p1p3) - { - res = CGAL::Euler::split_face(v0, v2, pmesh); - } - else - { - res = CGAL::Euler::split_face(v1, v3, pmesh); - } + halfedge_descriptor res = (p0p2>p1p3) + ? CGAL::Euler::split_face(v0, v2, pmesh) + : CGAL::Euler::split_face(v1, v3, pmesh); + visitor.visit(face(res,pmesh)); visitor.visit(face(opposite(res,pmesh),pmesh)); visitor.end(); From 767ff1074c10c7840c0ff65c42eef123fb7f5a8d Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 8 Sep 2020 22:10:57 +0200 Subject: [PATCH 09/21] remove debug code --- .../include/CGAL/Polygon_mesh_processing/triangulate_faces.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 032a230c0db..ca546a6ba81 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -157,7 +157,6 @@ public: template bool triangulate_face_with_CDT(face_descriptor f, PM& pmesh, CDT& cdt, Visitor visitor) { - std::cout << "triangulate_face_with_CDT"<< std::endl; std::size_t original_size = CGAL::halfedges_around_face(halfedge(f, pmesh), pmesh).size(); // Halfedge_around_facet_circulator From 39e75e7530399e7858d1a2aae8e582cf066c4c59 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 10 Sep 2020 12:06:10 +0200 Subject: [PATCH 10/21] rename split_visitor to triangulate_visitor and add PMPTriangulateFaceVisitor --- .../CGAL/boost/graph/named_params_helper.h | 29 ------- .../CGAL/boost/graph/parameters_interface.h | 2 +- .../Concepts/PMPTriangulateFaceVisitor.h | 34 ++++++++ ...riangulate_faces_split_visitor_example.cpp | 8 +- .../triangulate_faces.h | 83 +++++++++++++------ 5 files changed, 98 insertions(+), 58 deletions(-) create mode 100644 Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index ec4dfe43ba5..4c9dab18b43 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -303,35 +303,6 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa > ::type type; }; - namespace Polygon_mesh_processing - { - template - class GetSplitVisitor - { - public: - struct DummySplitVisitor - { - template - void start(const T&) const - {} - - template - void visit(const T&) const - {} - - void end() const - {} - }; - - typedef typename internal_np::Lookup_named_param_def< - internal_np::split_visitor_t, - NamedParameters, - DummySplitVisitor//default - >::type type; - }; - - } // namespace Polygon_mesh_processing - namespace internal { BOOST_MPL_HAS_XXX_TRAIT_NAMED_DEF(Has_nested_type_iterator, iterator, false) } diff --git a/BGL/include/CGAL/boost/graph/parameters_interface.h b/BGL/include/CGAL/boost/graph/parameters_interface.h index 3918b5df2d6..391ded449e5 100644 --- a/BGL/include/CGAL/boost/graph/parameters_interface.h +++ b/BGL/include/CGAL/boost/graph/parameters_interface.h @@ -47,7 +47,7 @@ CGAL_add_named_parameter(geom_traits_t, geom_traits, geom_traits) CGAL_add_named_parameter(vertex_incident_patches_t, vertex_incident_patches, vertex_incident_patches_map) CGAL_add_named_parameter(density_control_factor_t, density_control_factor, density_control_factor) CGAL_add_named_parameter(use_delaunay_triangulation_t, use_delaunay_triangulation, use_delaunay_triangulation) -CGAL_add_named_parameter(split_visitor_t, split_visitor, split_visitor) +CGAL_add_named_parameter(triangulate_visitor_t, triangulate_visitor, triangulate_visitor) CGAL_add_named_parameter(fairing_continuity_t, fairing_continuity, fairing_continuity) CGAL_add_named_parameter(sparse_linear_solver_t, sparse_linear_solver, sparse_linear_solver) CGAL_add_named_parameter(number_of_relaxation_steps_t, number_of_relaxation_steps, number_of_relaxation_steps) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h new file mode 100644 index 00000000000..a9445369792 --- /dev/null +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h @@ -0,0 +1,34 @@ +/// \ingroup PkgPolygonMeshProcessingConcepts +/// \cgalConcept +/// +/// The concept `PMPTriangulateFaceVisitor` defines the requirements for the visitor +/// used in \link PMP_meshing_grp triangulation-related functions \endlink to track +/// the creation of new faces. +/// +/// \cgalRefines `CopyConstructible` +/// \cgalHasModel `CGAL::Polygon_mesh_processing::Corefinement::Default_visitor`. + + +class PMPTriangulateFaceVisitor { +public: +/// Face decriptor type +typedef unspecified_type face_descriptor; + +/// @name Functions used by `triangulate_face()` and `triangulate_faces()` +/// @{ + /// called before the triangulation of `f_split`. Note that `f_split` + /// will be one of the faces of the triangulation. Each subsequent call to + /// `after_subface_created()` will correspond to + /// the creation of a new face of the triangulation of `f_split`. + void before_subface_creations(face_descriptor f_split); + + /// called when the triangulation of a face in `tm` is finished + void after_subface_creations(); + + /// called after creating a new triangle face `f_new` to triangulate the face passed to `before_subface_creations()`. + /// Note that the call is placed just after a call to `add_face()` so the halfedge pointer is not set yet. + void after_subface_created(face_descriptor f_new); + + /// @} + +}; diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp index 931a0a0e0c7..1e5ed579627 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp @@ -53,7 +53,7 @@ struct Visitor : container(container) {} - void start(face_descriptor fd) + void before_subface_creations(face_descriptor fd) { std::cout << "split : " << fd << " into:" << std::endl; Container::iterator it = container.find(fd); @@ -61,13 +61,13 @@ struct Visitor container.erase(it); } - void visit(face_descriptor fd) + void after_subface_created(face_descriptor fd) { std::cout << " " << fd; container[fd]=qfd; } - void end() + void after_subface_creations() { std::cout << std::endl; } @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) Visitor v(t2q); CGAL::Polygon_mesh_processing::triangulate_faces(copy, - CGAL::Polygon_mesh_processing::parameters::split_visitor(v)); + CGAL::Polygon_mesh_processing::parameters::triangulate_visitor(v)); for(boost::unordered_map::iterator it = t2q.begin(); it != t2q.end(); ++it){ diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index ca546a6ba81..0cba62ebd28 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -45,6 +45,26 @@ namespace CGAL { namespace Polygon_mesh_processing { +namespace Triangulate_faces +{ +/** \ingroup PMP_meshing_grp +* Default new face visitor model of `PMPTriangulateFaceVisitor`. +* All its functions have an empty body. This class can be used as a +* base class if only some of the functions of the concept require to be +* overriden. +*/ +template +struct Default_visitor { + typedef boost::graph_traits GT; + typedef typename GT::face_descriptor face_descriptor; + + void before_subface_creations(face_descriptor /*f_old*/) {} + void after_subface_creations() {} + void after_subface_created(face_descriptor /*f_new*/) {} +}; + +} //end namespace Triangulate_faces + namespace internal { template p1p3) ? CGAL::Euler::split_face(v0, v2, pmesh) : CGAL::Euler::split_face(v1, v3, pmesh); - visitor.visit(face(res,pmesh)); - visitor.visit(face(opposite(res,pmesh),pmesh)); - visitor.end(); + visitor.after_subface_created(face(res,pmesh)); + visitor.after_subface_created(face(opposite(res,pmesh),pmesh)); } else { @@ -213,7 +232,7 @@ public: // then modify the polyhedron - visitor.start(f); + visitor.before_subface_creations(f); // make_hole. (see comment in function body) this->make_hole(halfedge(f, pmesh), pmesh); @@ -270,10 +289,10 @@ public: set_next(h2, h0, pmesh); Euler::fill_hole(h0, pmesh); - visitor.visit(face(h0, pmesh)); + visitor.after_subface_created(face(h0, pmesh)); } } - visitor.end(); + visitor.after_subface_creations(); return true; } @@ -311,7 +330,7 @@ public: ++i; } - visitor.start(f); + visitor.before_subface_creations(f); bool first = true; std::vector hedges; hedges.reserve(4); @@ -321,7 +340,7 @@ public: first=false; else f=add_face(pmesh); - visitor.visit(f); + visitor.after_subface_created(f); std::array indices = make_array( triangle.first, @@ -352,7 +371,7 @@ public: set_halfedge(f, hedges[0], pmesh); hedges.clear(); } - visitor.end(); + visitor.after_subface_creations(); return true; } @@ -430,10 +449,10 @@ public: * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd * -* \cgalParamNBegin{split_visitor} -* \cgalParamDescription{a visitor that allows track how faces are split} -* \cgalParamType{a class model of `SplitVisitor`} -* \cgalParamDefault{No visitor.} +* \cgalParamNBegin{triangulate_visitor} +* \cgalParamDescription{a visitor that allows to track how faces are triangulated into subfaces} +* \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} +* \cgalParamDefault{`Triangulate_faces::Default_visitor`} * \cgalParamExtra{Note that the visitor will be copied, so * it should not have any data member that does have a reference-like type.} * `\cgalParamNEnd @@ -461,12 +480,16 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor //Option bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); - typedef typename GetSplitVisitor::type SplitVisitor; - typedef typename GetSplitVisitor::DummySplitVisitor DummySplitVisitor; - SplitVisitor visitor = choose_param(get_param(np, internal_np::split_visitor), - DummySplitVisitor()); + typedef typename internal_np::Lookup_named_param_def< + internal_np::triangulate_visitor_t, + NamedParameters, + Triangulate_faces::Default_visitor//default + >::type Visitor; + Visitor visitor = choose_parameter( + get_parameter(np, internal_np::triangulate_visitor), + Triangulate_faces::Default_visitor()); - internal::Triangulate_modifier modifier(vpmap); + internal::Triangulate_modifier modifier(vpmap); return modifier.triangulate_face(f, pmesh, use_cdt, visitor); } @@ -507,6 +530,14 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd +* +* \cgalParamNBegin{triangulate_visitor} +* \cgalParamDescription{a visitor that allows to track how faces are triangulated into subfaces} +* \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} +* \cgalParamDefault{`Triangulate_faces::Default_visitor`} +* \cgalParamExtra{Note that the visitor will be copied, so +* it should not have any data member that does have a reference-like type.} +* `\cgalParamNEnd * \cgalNamedParamsEnd * * @return `true` if all the faces have been triangulated. @@ -533,12 +564,16 @@ bool triangulate_faces(FaceRange face_range, //Option bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); - typedef typename GetSplitVisitor::type SplitVisitor; - typedef typename GetSplitVisitor::DummySplitVisitor DummySplitVisitor; - SplitVisitor visitor = choose_parameter(get_parameter(np, internal_np::split_visitor), - DummySplitVisitor()); + typedef typename internal_np::Lookup_named_param_def< + internal_np::triangulate_visitor_t, + NamedParameters, + Triangulate_faces::Default_visitor//default + >::type Visitor; + Visitor visitor = choose_parameter( + get_parameter(np, internal_np::triangulate_visitor), + Triangulate_faces::Default_visitor()); - internal::Triangulate_modifier modifier(vpmap); + internal::Triangulate_modifier modifier(vpmap); return modifier(face_range, pmesh, use_cdt, visitor); } From 0c39f355a5879e90f7a9c9a33d4152dbefd0292c Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 10 Sep 2020 12:12:46 +0200 Subject: [PATCH 11/21] small fixes in doc --- .../Concepts/PMPTriangulateFaceVisitor.h | 4 ++-- .../CGAL/Polygon_mesh_processing/triangulate_faces.h | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h index a9445369792..9b9bbddc64f 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h @@ -6,7 +6,7 @@ /// the creation of new faces. /// /// \cgalRefines `CopyConstructible` -/// \cgalHasModel `CGAL::Polygon_mesh_processing::Corefinement::Default_visitor`. +/// \cgalHasModel `CGAL::Polygon_mesh_processing::Triangulate_faces::Default_visitor`. class PMPTriangulateFaceVisitor { @@ -22,7 +22,7 @@ typedef unspecified_type face_descriptor; /// the creation of a new face of the triangulation of `f_split`. void before_subface_creations(face_descriptor f_split); - /// called when the triangulation of a face in `tm` is finished + /// called when the triangulation of a face in `tm` is finished. void after_subface_creations(); /// called after creating a new triangle face `f_new` to triangulate the face passed to `before_subface_creations()`. diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 0cba62ebd28..7b140d76f16 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -455,7 +455,7 @@ public: * \cgalParamDefault{`Triangulate_faces::Default_visitor`} * \cgalParamExtra{Note that the visitor will be copied, so * it should not have any data member that does have a reference-like type.} -* `\cgalParamNEnd +* \cgalParamNEnd * \cgalNamedParamsEnd * * @return `true` if the face has been triangulated. @@ -608,6 +608,14 @@ bool triangulate_faces(FaceRange face_range, PolygonMesh& pmesh) * \cgalParamDefault{a \cgal Kernel deduced from the point type, using `CGAL::Kernel_traits`} * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd +* +* \cgalParamNBegin{triangulate_visitor} +* \cgalParamDescription{a visitor that allows to track how faces are triangulated into subfaces} +* \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} +* \cgalParamDefault{`Triangulate_faces::Default_visitor`} +* \cgalParamExtra{Note that the visitor will be copied, so +* it should not have any data member that does have a reference-like type.} +* \cgalParamNEnd * \cgalNamedParamsEnd * * @return `true` if all the faces have been triangulated. From be7d9d1728b84be5ffe9dc10609bebbb2062dec7 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 10 Sep 2020 14:31:48 +0200 Subject: [PATCH 12/21] doc fixes --- .../CGAL/boost/graph/named_params_helper.h | 2 +- .../Polygon_mesh_processing.txt | 5 +++++ .../doc/Polygon_mesh_processing/examples.txt | 1 + .../triangulate_faces.h | 18 +++++++++--------- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/named_params_helper.h b/BGL/include/CGAL/boost/graph/named_params_helper.h index 4c9dab18b43..a0856f2069f 100644 --- a/BGL/include/CGAL/boost/graph/named_params_helper.h +++ b/BGL/include/CGAL/boost/graph/named_params_helper.h @@ -308,7 +308,7 @@ CGAL_DEF_GET_INITIALIZED_INDEX_MAP(face, typename boost::graph_traits::fa } template, + typename NamedParameters = Named_function_parameters, bool has_nested_iterator = internal::Has_nested_type_iterator::value> class GetPointMap { diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index da098ddb327..acfd22a2276 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -193,6 +193,11 @@ as shown in the following example. \cgalExample{Polygon_mesh_processing/triangulate_faces_example.cpp} +An additional parameter, named `triangulate_visitor` can be used to track the how faces +are triangulated into subfaces. The following examples shows how to use it. + +\cgalExample{Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp} + \subsubsection RemeshingExample_1 Isotropic Remeshing of a Region on a Polygon Mesh diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt index 66c4609d25c..9fa1de58990 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/examples.txt @@ -29,4 +29,5 @@ \example Polygon_mesh_processing/shape_smoothing_example.cpp \example Polygon_mesh_processing/locate_example.cpp \example Polygon_mesh_processing/orientation_pipeline_example.cpp +\example Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp */ diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 7b140d76f16..595e2cf560d 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -450,11 +450,11 @@ public: * \cgalParamNEnd * * \cgalParamNBegin{triangulate_visitor} -* \cgalParamDescription{a visitor that allows to track how faces are triangulated into subfaces} +* \cgalParamDescription{a visitor that enables to track how faces are triangulated into subfaces} * \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} -* \cgalParamDefault{`Triangulate_faces::Default_visitor`} +* \cgalParamDefault{`Triangulate_faces::Default_visitor`} * \cgalParamExtra{Note that the visitor will be copied, so -* it should not have any data member that does have a reference-like type.} +* it must not have any data member that does not have a reference-like type.} * \cgalParamNEnd * \cgalNamedParamsEnd * @@ -532,11 +532,11 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor * \cgalParamNEnd * * \cgalParamNBegin{triangulate_visitor} -* \cgalParamDescription{a visitor that allows to track how faces are triangulated into subfaces} +* \cgalParamDescription{a visitor that enables to track how faces are triangulated into subfaces} * \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} -* \cgalParamDefault{`Triangulate_faces::Default_visitor`} +* \cgalParamDefault{`Triangulate_faces::Default_visitor`} * \cgalParamExtra{Note that the visitor will be copied, so -* it should not have any data member that does have a reference-like type.} +* it must not have any data member that does not have a reference-like type.} * `\cgalParamNEnd * \cgalNamedParamsEnd * @@ -610,11 +610,11 @@ bool triangulate_faces(FaceRange face_range, PolygonMesh& pmesh) * \cgalParamNEnd * * \cgalParamNBegin{triangulate_visitor} -* \cgalParamDescription{a visitor that allows to track how faces are triangulated into subfaces} +* \cgalParamDescription{a visitor that enables to track how faces are triangulated into subfaces} * \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} -* \cgalParamDefault{`Triangulate_faces::Default_visitor`} +* \cgalParamDefault{`Triangulate_faces::Default_visitor`} * \cgalParamExtra{Note that the visitor will be copied, so -* it should not have any data member that does have a reference-like type.} +* it must not have any data member that does not have a reference-like type.} * \cgalParamNEnd * \cgalNamedParamsEnd * From 435df16eb7da2807e987d15b091e528d62236d69 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 11 Sep 2020 09:33:32 +0200 Subject: [PATCH 13/21] add missing `after_subface_creations` --- .../include/CGAL/Polygon_mesh_processing/triangulate_faces.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 595e2cf560d..7be6ec5b82c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -144,6 +144,8 @@ public: visitor.after_subface_created(face(res,pmesh)); visitor.after_subface_created(face(opposite(res,pmesh),pmesh)); + + visitor.after_subface_creations(); } else { From adb1b560b12275a944d13ddac43b860d27b9189b Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 15 Sep 2020 12:22:12 +0200 Subject: [PATCH 14/21] edit CHANGES.md --- Installation/CHANGES.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Installation/CHANGES.md b/Installation/CHANGES.md index 420781a827c..40492b132b4 100644 --- a/Installation/CHANGES.md +++ b/Installation/CHANGES.md @@ -1,6 +1,19 @@ Release History =============== +[Release 5.2](https://github.com/CGAL/cgal/releases/tag/releases%2FCGAL-5.2) +----------- + +Release date: + +### [Polygon Mesh Processing](https://doc.cgal.org/latest/Manual/packages.html#PkgPolygonMeshProcessing) + +- Added a visitor to the functions +[`CGAL::Polygon_mesh_processing::triangulate_face()`](https://doc.cgal.org/5.1/Polygon_mesh_processing/group__PMP__meshing__grp.html#ga70d65044f8c7309c24ade88fa280124a) +and [`CGAL::Polygon_mesh_processing::triangulate_faces()`](https://doc.cgal.org/5.1/Polygon_mesh_processing/group__PMP__meshing__grp.html#gacaaff4d520500c530d9c3d5ebe2a0760), +that enables the user to keep track of the newly created faces through the triangulation process. + + [Release 5.1](https://github.com/CGAL/cgal/releases/tag/releases%2FCGAL-5.1) ----------- From d000af1d5453bc9c5dff3270e9f138ec7cb75661 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 15 Sep 2020 12:29:54 +0200 Subject: [PATCH 15/21] apply doc reviews --- .../Concepts/PMPTriangulateFaceVisitor.h | 2 +- .../CGAL/Polygon_mesh_processing/triangulate_faces.h | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h index 9b9bbddc64f..1ab5a7b94e8 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Concepts/PMPTriangulateFaceVisitor.h @@ -14,7 +14,7 @@ public: /// Face decriptor type typedef unspecified_type face_descriptor; -/// @name Functions used by `triangulate_face()` and `triangulate_faces()` +/// @name Functions used by triangulate_face() and triangulate_faces() /// @{ /// called before the triangulation of `f_split`. Note that `f_split` /// will be one of the faces of the triangulation. Each subsequent call to diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 7be6ec5b82c..b6af902cba5 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -48,14 +48,14 @@ namespace Polygon_mesh_processing { namespace Triangulate_faces { /** \ingroup PMP_meshing_grp -* Default new face visitor model of `PMPTriangulateFaceVisitor`. +* %Default new face visitor model of `PMPTriangulateFaceVisitor`. * All its functions have an empty body. This class can be used as a * base class if only some of the functions of the concept require to be * overriden. */ -template +template struct Default_visitor { - typedef boost::graph_traits GT; + typedef boost::graph_traits GT; typedef typename GT::face_descriptor face_descriptor; void before_subface_creations(face_descriptor /*f_old*/) {} From 070fa52b6e06f14bac3e3ee157be72654cff4367 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 15 Sep 2020 12:39:55 +0200 Subject: [PATCH 16/21] use (removed?) input geom traits --- .../include/CGAL/Polygon_mesh_processing/triangulate_faces.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index b6af902cba5..29316365de0 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -491,7 +491,7 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor get_parameter(np, internal_np::triangulate_visitor), Triangulate_faces::Default_visitor()); - internal::Triangulate_modifier modifier(vpmap); + internal::Triangulate_modifier modifier(vpmap, traits); return modifier.triangulate_face(f, pmesh, use_cdt, visitor); } @@ -575,7 +575,7 @@ bool triangulate_faces(FaceRange face_range, get_parameter(np, internal_np::triangulate_visitor), Triangulate_faces::Default_visitor()); - internal::Triangulate_modifier modifier(vpmap); + internal::Triangulate_modifier modifier(vpmap, traits); return modifier(face_range, pmesh, use_cdt, visitor); } From 4745308384bd690eeab458535fc96dfe61accb3b Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 15 Sep 2020 14:38:29 +0200 Subject: [PATCH 17/21] use graph_visitor instead of creating new triangulate_visitor --- .../CGAL/boost/graph/parameters_interface.h | 1 - .../Polygon_mesh_processing.txt | 2 +- .../triangulate_faces_split_visitor_example.cpp | 2 +- .../Polygon_mesh_processing/triangulate_faces.h | 14 +++++++------- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/parameters_interface.h b/BGL/include/CGAL/boost/graph/parameters_interface.h index 391ded449e5..5086319451b 100644 --- a/BGL/include/CGAL/boost/graph/parameters_interface.h +++ b/BGL/include/CGAL/boost/graph/parameters_interface.h @@ -47,7 +47,6 @@ CGAL_add_named_parameter(geom_traits_t, geom_traits, geom_traits) CGAL_add_named_parameter(vertex_incident_patches_t, vertex_incident_patches, vertex_incident_patches_map) CGAL_add_named_parameter(density_control_factor_t, density_control_factor, density_control_factor) CGAL_add_named_parameter(use_delaunay_triangulation_t, use_delaunay_triangulation, use_delaunay_triangulation) -CGAL_add_named_parameter(triangulate_visitor_t, triangulate_visitor, triangulate_visitor) CGAL_add_named_parameter(fairing_continuity_t, fairing_continuity, fairing_continuity) CGAL_add_named_parameter(sparse_linear_solver_t, sparse_linear_solver, sparse_linear_solver) CGAL_add_named_parameter(number_of_relaxation_steps_t, number_of_relaxation_steps, number_of_relaxation_steps) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt index acfd22a2276..cc322c8e939 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/Polygon_mesh_processing.txt @@ -193,7 +193,7 @@ as shown in the following example. \cgalExample{Polygon_mesh_processing/triangulate_faces_example.cpp} -An additional parameter, named `triangulate_visitor` can be used to track the how faces +An additional parameter, named `visitor` can be used to track the how faces are triangulated into subfaces. The following examples shows how to use it. \cgalExample{Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp} diff --git a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp index 1e5ed579627..4036a4c504a 100644 --- a/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp +++ b/Polygon_mesh_processing/examples/Polygon_mesh_processing/triangulate_faces_split_visitor_example.cpp @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) Visitor v(t2q); CGAL::Polygon_mesh_processing::triangulate_faces(copy, - CGAL::Polygon_mesh_processing::parameters::triangulate_visitor(v)); + CGAL::Polygon_mesh_processing::parameters::visitor(v)); for(boost::unordered_map::iterator it = t2q.begin(); it != t2q.end(); ++it){ diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h index 29316365de0..f2110aa14f3 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/triangulate_faces.h @@ -451,7 +451,7 @@ public: * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd * -* \cgalParamNBegin{triangulate_visitor} +* \cgalParamNBegin{visitor} * \cgalParamDescription{a visitor that enables to track how faces are triangulated into subfaces} * \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} * \cgalParamDefault{`Triangulate_faces::Default_visitor`} @@ -483,12 +483,12 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); typedef typename internal_np::Lookup_named_param_def< - internal_np::triangulate_visitor_t, + internal_np::graph_visitor_t, NamedParameters, Triangulate_faces::Default_visitor//default >::type Visitor; Visitor visitor = choose_parameter( - get_parameter(np, internal_np::triangulate_visitor), + get_parameter(np, internal_np::graph_visitor), Triangulate_faces::Default_visitor()); internal::Triangulate_modifier modifier(vpmap, traits); @@ -533,7 +533,7 @@ bool triangulate_face(typename boost::graph_traits::face_descriptor * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd * -* \cgalParamNBegin{triangulate_visitor} +* \cgalParamNBegin{visitor} * \cgalParamDescription{a visitor that enables to track how faces are triangulated into subfaces} * \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} * \cgalParamDefault{`Triangulate_faces::Default_visitor`} @@ -567,12 +567,12 @@ bool triangulate_faces(FaceRange face_range, bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); typedef typename internal_np::Lookup_named_param_def< - internal_np::triangulate_visitor_t, + internal_np::graph_visitor_t, NamedParameters, Triangulate_faces::Default_visitor//default >::type Visitor; Visitor visitor = choose_parameter( - get_parameter(np, internal_np::triangulate_visitor), + get_parameter(np, internal_np::graph_visitor), Triangulate_faces::Default_visitor()); internal::Triangulate_modifier modifier(vpmap, traits); @@ -611,7 +611,7 @@ bool triangulate_faces(FaceRange face_range, PolygonMesh& pmesh) * \cgalParamExtra{The geometric traits class must be compatible with the vertex point type.} * \cgalParamNEnd * -* \cgalParamNBegin{triangulate_visitor} +* \cgalParamNBegin{visitor} * \cgalParamDescription{a visitor that enables to track how faces are triangulated into subfaces} * \cgalParamType{a class model of `PMPTriangulateFaceVisitor`} * \cgalParamDefault{`Triangulate_faces::Default_visitor`} From 66fa7d1d1d07688fbf5cd1f58f0fad64fcc4763b Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 15 Sep 2020 15:00:06 +0200 Subject: [PATCH 18/21] remove remeshing_visitor and use graph_visitor instead --- BGL/include/CGAL/boost/graph/parameters_interface.h | 1 - .../include/CGAL/tetrahedral_remeshing.h | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/parameters_interface.h b/BGL/include/CGAL/boost/graph/parameters_interface.h index 5086319451b..67e07522a82 100644 --- a/BGL/include/CGAL/boost/graph/parameters_interface.h +++ b/BGL/include/CGAL/boost/graph/parameters_interface.h @@ -171,7 +171,6 @@ CGAL_add_named_parameter(pca_plane_t, pca_plane, pca_plane) CGAL_add_named_parameter(remesh_boundaries_t, remesh_boundaries, remesh_boundaries) CGAL_add_named_parameter(cell_selector_t, cell_selector, cell_selector) CGAL_add_named_parameter(facet_is_constrained_t, facet_is_constrained, facet_is_constrained_map) -CGAL_add_named_parameter(remeshing_visitor_t, remeshing_visitor, remeshing_visitor) CGAL_add_named_parameter(smooth_constrained_edges_t, smooth_constrained_edges, smooth_constrained_edges) // output parameters diff --git a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h index 115f735f128..e5e0860de53 100644 --- a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h +++ b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h @@ -244,12 +244,12 @@ void tetrahedral_isotropic_remeshing( No_facet()); typedef typename internal_np::Lookup_named_param_def < - internal_np::remeshing_visitor_t, + internal_np::graph_visitor_t, NamedParameters, Tetrahedral_remeshing::internal::Default_remeshing_visitor > ::type Visitor; Visitor visitor - = choose_parameter(get_parameter(np, internal_np::remeshing_visitor), + = choose_parameter(get_parameter(np, internal_np::graph_visitor), Tetrahedral_remeshing::internal::Default_remeshing_visitor()); #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE @@ -439,12 +439,12 @@ void tetrahedral_isotropic_remeshing( No_facet()); typedef typename internal_np::Lookup_named_param_def < - internal_np::remeshing_visitor_t, + internal_np::graph_visitor_t, NamedParameters, Tetrahedral_remeshing::internal::Default_remeshing_visitor > ::type Visitor; Visitor visitor - = choose_parameter(get_parameter(np, internal_np::remeshing_visitor), + = choose_parameter(get_parameter(np, internal_np::graph_visitor), Tetrahedral_remeshing::internal::Default_remeshing_visitor()); #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE From bfd4e9915fb5417ead32abe12c4b9cdb6f819db5 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 15 Sep 2020 15:42:24 +0200 Subject: [PATCH 19/21] rename named parameter graph_visitor to visitor --- .../CGAL/boost/graph/parameters_interface.h | 2 +- .../CGAL/Polygon_mesh_processing/corefinement.h | 16 ++++++++-------- .../Polygon_mesh_processing/triangulate_faces.h | 8 ++++---- .../Surface_mesh_simplification/edge_collapse.h | 2 +- .../include/CGAL/tetrahedral_remeshing.h | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/parameters_interface.h b/BGL/include/CGAL/boost/graph/parameters_interface.h index 67e07522a82..97f5509b44c 100644 --- a/BGL/include/CGAL/boost/graph/parameters_interface.h +++ b/BGL/include/CGAL/boost/graph/parameters_interface.h @@ -15,7 +15,7 @@ CGAL_add_named_parameter(halfedge_index_t, halfedge_index, halfedge_index_map) CGAL_add_named_parameter(edge_index_t, edge_index, edge_index_map) CGAL_add_named_parameter(face_index_t, face_index, face_index_map) CGAL_add_named_parameter(vertex_index_t, vertex_index, vertex_index_map) -CGAL_add_named_parameter(graph_visitor_t, graph_visitor, visitor) +CGAL_add_named_parameter(visitor_t, visitor, visitor) CGAL_add_named_parameter(point_t, point_map, point_map) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h index a3c64422946..8c288aa3f1f 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/corefinement.h @@ -367,11 +367,11 @@ corefine_and_compute_boolean_operations( // User visitor typedef typename internal_np::Lookup_named_param_def < - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters1, Corefinement::Default_visitor//default > ::type User_visitor; - User_visitor uv(choose_parameter(get_parameter(np1, internal_np::graph_visitor))); + User_visitor uv(choose_parameter(get_parameter(np1, internal_np::visitor))); // surface intersection algorithm call typedef Corefinement::Face_graph_output_builder//default > ::type User_visitor; - User_visitor uv(choose_parameter(get_parameter(np1, internal_np::graph_visitor))); + User_visitor uv(choose_parameter(get_parameter(np1, internal_np::visitor))); // surface intersection algorithm call typedef Corefinement::No_extra_output_from_corefinement Ob; @@ -846,11 +846,11 @@ autorefine( TriangleMesh& tm, // User visitor typedef typename internal_np::Lookup_named_param_def < - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters, Corefinement::Default_visitor//default > ::type User_visitor; - User_visitor uv(choose_parameter(get_parameter(np, internal_np::graph_visitor))); + User_visitor uv(choose_parameter(get_parameter(np, internal_np::visitor))); // surface intersection algorithm call @@ -943,11 +943,11 @@ autorefine_and_remove_self_intersections( TriangleMesh& tm, // User visitor typedef typename internal_np::Lookup_named_param_def < - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters, Corefinement::Default_visitor//default > ::type User_visitor; - User_visitor uv(choose_parameter(get_parameter(np, internal_np::graph_visitor))); + User_visitor uv(choose_parameter(get_parameter(np, internal_np::visitor))); // surface intersection algorithm call typedef Corefinement::Output_builder_for_autorefinement::face_descriptor bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); typedef typename internal_np::Lookup_named_param_def< - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters, Triangulate_faces::Default_visitor//default >::type Visitor; Visitor visitor = choose_parameter( - get_parameter(np, internal_np::graph_visitor), + get_parameter(np, internal_np::visitor), Triangulate_faces::Default_visitor()); internal::Triangulate_modifier modifier(vpmap, traits); @@ -567,12 +567,12 @@ bool triangulate_faces(FaceRange face_range, bool use_cdt = choose_parameter(get_parameter(np, internal_np::use_delaunay_triangulation), true); typedef typename internal_np::Lookup_named_param_def< - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters, Triangulate_faces::Default_visitor//default >::type Visitor; Visitor visitor = choose_parameter( - get_parameter(np, internal_np::graph_visitor), + get_parameter(np, internal_np::visitor), Triangulate_faces::Default_visitor()); internal::Triangulate_modifier modifier(vpmap, traits); diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/edge_collapse.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/edge_collapse.h index 2bacc02174a..826cadc8581 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/edge_collapse.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/edge_collapse.h @@ -98,7 +98,7 @@ int edge_collapse(TM& tmesh, choose_parameter >(get_parameter(np, internal_np::edge_is_constrained)), choose_parameter >(get_parameter(np, internal_np::get_cost_policy)), choose_parameter >(get_parameter(np, internal_np::get_placement_policy)), - choose_parameter(get_parameter(np, internal_np::graph_visitor))); + choose_parameter(get_parameter(np, internal_np::visitor))); } template diff --git a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h index e5e0860de53..b1818bbded1 100644 --- a/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h +++ b/Tetrahedral_remeshing/include/CGAL/tetrahedral_remeshing.h @@ -244,12 +244,12 @@ void tetrahedral_isotropic_remeshing( No_facet()); typedef typename internal_np::Lookup_named_param_def < - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters, Tetrahedral_remeshing::internal::Default_remeshing_visitor > ::type Visitor; Visitor visitor - = choose_parameter(get_parameter(np, internal_np::graph_visitor), + = choose_parameter(get_parameter(np, internal_np::visitor), Tetrahedral_remeshing::internal::Default_remeshing_visitor()); #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE @@ -439,12 +439,12 @@ void tetrahedral_isotropic_remeshing( No_facet()); typedef typename internal_np::Lookup_named_param_def < - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters, Tetrahedral_remeshing::internal::Default_remeshing_visitor > ::type Visitor; Visitor visitor - = choose_parameter(get_parameter(np, internal_np::graph_visitor), + = choose_parameter(get_parameter(np, internal_np::visitor), Tetrahedral_remeshing::internal::Default_remeshing_visitor()); #ifdef CGAL_TETRAHEDRAL_REMESHING_VERBOSE From 41435b32cd2f77dd4835c5461ec328479adca750 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 17 Sep 2020 11:20:45 +0200 Subject: [PATCH 20/21] rename graph_visitor to visitor in BGL test --- BGL/test/BGL/test_cgal_bgl_named_params.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BGL/test/BGL/test_cgal_bgl_named_params.cpp b/BGL/test/BGL/test_cgal_bgl_named_params.cpp index 1d65c3cd1c2..ebbcda19a01 100644 --- a/BGL/test/BGL/test_cgal_bgl_named_params.cpp +++ b/BGL/test/BGL/test_cgal_bgl_named_params.cpp @@ -28,7 +28,7 @@ void test(const NamedParameters& np) // Named parameters that we use in CGAL assert(get_parameter(np, CGAL::internal_np::vertex_index).v == 0); - assert(get_parameter(np, CGAL::internal_np::graph_visitor).v == 1); + assert(get_parameter(np, CGAL::internal_np::visitor).v == 1); assert(get_parameter(np, CGAL::internal_np::vertex_point).v == 2); assert(get_parameter(np, CGAL::internal_np::halfedge_index).v == 3); assert(get_parameter(np, CGAL::internal_np::edge_index).v == 4); @@ -124,7 +124,7 @@ void test(const NamedParameters& np) // Named parameters that we use in CGAL check_same_type<0>(get_parameter(np, CGAL::internal_np::vertex_index)); - check_same_type<1>(get_parameter(np, CGAL::internal_np::graph_visitor)); + check_same_type<1>(get_parameter(np, CGAL::internal_np::visitor)); check_same_type<2>(get_parameter(np, CGAL::internal_np::vertex_point)); check_same_type<3>(get_parameter(np, CGAL::internal_np::halfedge_index)); check_same_type<4>(get_parameter(np, CGAL::internal_np::edge_index)); From 16656872d0cdbb2f84e13d1cc3729f4563c15500 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Fri, 18 Sep 2020 14:20:46 +0200 Subject: [PATCH 21/21] rename graph_visitor to visitor --- .../include/CGAL/Polygon_mesh_processing/clip.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h index ae94faba8e2..d2e8942ba17 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/clip.h @@ -469,11 +469,11 @@ generic_clip_impl( // User visitor typedef typename internal_np::Lookup_named_param_def < - internal_np::graph_visitor_t, + internal_np::visitor_t, NamedParameters1, Corefinement::Default_visitor//default > ::type User_visitor; - User_visitor uv(choose_parameter(get_parameter(np1, internal_np::graph_visitor))); + User_visitor uv(choose_parameter(get_parameter(np1, internal_np::visitor))); // surface intersection algorithm call typedef Corefinement::Generic_clip_output_builder