From 27d329b1e9eb567a8a03f5d7fdce041c62e5a8ac Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Thu, 15 Jan 2015 17:11:00 +0100 Subject: [PATCH] move fair() and refine() to their own files - move fairing and refinement internal code to the subfolder Meshing_functions (they were in Hole_filling) - and fix namespaces --- .../PackageDescription.txt | 4 +- .../CGAL/Polygon_mesh_processing/fair.h | 87 +++++++++++++++++++ .../CGAL/Polygon_mesh_processing/refine.h | 51 +++++++++++ .../Triangulate_hole_Polyhedron_3.h | 22 +++-- .../Fair_Polyhedron_3.h | 81 +---------------- .../Refine_Polyhedron_3.h | 45 +--------- .../CGAL/polygon_mesh_self_intersections.h | 2 +- .../include/CGAL/triangulate_hole.h | 15 ++-- .../triangulate_hole_Polyhedron_3_test.cpp | 31 ++++--- .../triangulate_hole_polyline_test.cpp | 10 ++- .../Polyhedron_demo_fairing_plugin.cpp | 21 +++-- .../Scene_polyhedron_selection_item.h | 2 +- 12 files changed, 209 insertions(+), 162 deletions(-) create mode 100644 Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h create mode 100644 Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine.h rename Polygon_mesh_processing/include/CGAL/internal/{Hole_filling => Meshing_functions}/Fair_Polyhedron_3.h (65%) rename Polygon_mesh_processing/include/CGAL/internal/{Hole_filling => Meshing_functions}/Refine_Polyhedron_3.h (87%) diff --git a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt index 28c4a3a5f22..4c36f2f7519 100644 --- a/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt +++ b/Polygon_mesh_processing/doc/Polygon_mesh_processing/PackageDescription.txt @@ -48,8 +48,8 @@ - `CGAL::Polygon_mesh_processing::polygon_soup_to_polygon_mesh()` ## Meshing Functions ## -- `CGAL::fair()` -- `CGAL::refine()` +- `CGAL::Polygon_mesh_processing::fair()` +- `CGAL::Polygon_mesh_processing::refine()` - `CGAL::Polygon_mesh_processing::triangulate_faces()` ## Normal Computation Functions ## diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h new file mode 100644 index 00000000000..424ba116a44 --- /dev/null +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/fair.h @@ -0,0 +1,87 @@ + +#include + +namespace CGAL { + +namespace Polygon_mesh_processing { + + /*! + \ingroup PkgPolygonMeshProcessing + @brief Function fairing a region on polygon mesh. + The region denoted by @a vertex_begin and @a vertex_end might contain multiple disconnected components. + Note that the structure is not altered in any way, only positions of the vertices get updated. + + Fairing might fail if fixed vertices, which are used as boundary conditions, do not suffice to solve constructed linear system. + The larger @a continuity gets, the more fixed vertices are required. + + @tparam SparseLinearSolver a model of `SparseLinearAlgebraTraitsWithPreFactor_d`. If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available + and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter. + @tparam WeightCalculator a model of `FairWeightCalculator` and can be omitted to use default Cotangent weights + @tparam PolygonMesh must be a model of `MutableFaceGraph` + @tparam InputIterator iterator over input vertices + + @param pmesh polygon mesh to be faired + @param vertex_begin first iterator of the range of vertices + @param vertex_end past-the-end iterator of the range of vertices + @param weight_calculator function object to calculate weights, default to Cotangent weights and can be omitted + @param continuity tangential continuity, default to `FAIRING_C_1` and can be omitted + + @return `true` if fairing is successful, otherwise no vertex position is changed + + @todo accuracy of solvers are not good, for example when there is no boundary condition pre_factor should fail, but it does not. + \todo WeightCalculator should be a property map + */ + template + bool fair(PolygonMesh& pmesh, + InputIterator vertex_begin, + InputIterator vertex_end, + WeightCalculator weight_calculator, + Fairing_continuity continuity = FAIRING_C_1 + ) + { + internal::Fair_Polyhedron_3 fair_functor(pmesh, weight_calculator); + return fair_functor.fair(vertex_begin, vertex_end, continuity); + } + + //use default SparseLinearSolver + template + bool fair(PolygonMesh& pmesh, + InputIterator vb, + InputIterator ve, + WeightCalculator weight_calculator, + Fairing_continuity continuity = FAIRING_C_1 + ) + { + typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver; + return fair + (pmesh, vb, ve, weight_calculator, continuity); + } + + //use default WeightCalculator + template + bool fair(PolygonMesh& pmesh, + InputIterator vb, + InputIterator ve, + Fairing_continuity continuity = FAIRING_C_1 + ) + { + typedef internal::Cotangent_weight_with_voronoi_area_fairing Weight_calculator; + return fair + (pmesh, vb, ve, Weight_calculator(), continuity); + } + + //use default SparseLinearSolver and WeightCalculator + template + bool fair(PolygonMesh& pmesh, + InputIterator vb, + InputIterator ve, + Fairing_continuity continuity = FAIRING_C_1 + ) + { + typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver; + return fair(pmesh, vb, ve, continuity); + } + +} //end namespace Polygon_mesh_processing + +} //end namespace CGAL \ No newline at end of file diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine.h new file mode 100644 index 00000000000..22f99781ec3 --- /dev/null +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/refine.h @@ -0,0 +1,51 @@ + +#include + +namespace CGAL { + +namespace Polygon_mesh_processing { + + /*! + \ingroup PkgPolygonMeshProcessing + @brief Function refining a region on polygon mesh + + @tparam Polyhedron must be a model of `MutableFaceGraph` + @tparam InputIterator iterator over input facets + @tparam FacetOutputIterator iterator holding `boost::graph_traits::face_descriptor` for patch facets + @tparam VertexOutputIterator iterator holding `boost::graph_traits::vertex_descriptor` for patch vertices + + @param pmesh mesh to be refined + @param facet_begin first iterator of the range of facets + @param facet_end past-the-end iterator of the range of facets + @param facet_out iterator over newly created facets + @param vertex_out iterator over newly created vertices + @param density_control_factor factor for density where larger values cause denser refinements + + @return pair of @a facet_out and @a vertex_out + + @todo current algorithm iterates 10 times at most, since (I guess) there is no termination proof. + */ + template + std::pair + refine(PolygonMesh& pmesh, + InputIterator facet_begin, + InputIterator facet_end, + FacetOutputIterator facet_out, + VertexOutputIterator vertex_out, + double density_control_factor = std::sqrt(2.0)) + { + internal::Refine_Polyhedron_3 refine_functor(pmesh); + refine_functor.refine(facet_begin, + facet_end, + facet_out, + vertex_out, + density_control_factor); + return std::make_pair(facet_out, vertex_out); + } + +}//end namespace Polygon_mesh_processing + +}//end namespace CGAL diff --git a/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Triangulate_hole_Polyhedron_3.h b/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Triangulate_hole_Polyhedron_3.h index 0d9645493fb..97339b959d6 100644 --- a/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Triangulate_hole_Polyhedron_3.h +++ b/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Triangulate_hole_Polyhedron_3.h @@ -8,6 +8,7 @@ #include namespace CGAL { +namespace Polygon_mesh_processing { namespace internal { @@ -71,7 +72,7 @@ struct Tracer_polyhedron // This function is used in test cases (since it returns not just OutputIterator but also Weight) template -std::pair +std::pair triangulate_hole_Polyhedron(PolygonMesh& pmesh, typename boost::graph_traits::halfedge_descriptor border_halfedge, OutputIterator out, @@ -98,7 +99,8 @@ triangulate_hole_Polyhedron(PolygonMesh& pmesh, P_edges.push_back(*circ); if(!vertex_set.insert(std::make_pair(target(*circ,pmesh), n++)).second) { CGAL_warning(!"Returning no output. Non-manifold vertex is found on boundary!"); - return std::make_pair(out, Weight_min_max_dihedral_and_area::NOT_VALID()); + return std::make_pair(out, + CGAL::internal::Weight_min_max_dihedral_and_area::NOT_VALID()); } } while (++circ != done); @@ -129,18 +131,20 @@ triangulate_hole_Polyhedron(PolygonMesh& pmesh, //#define CGAL_USE_WEIGHT_INCOMPLETE #ifdef CGAL_USE_WEIGHT_INCOMPLETE - typedef Weight_calculator, Is_valid_existing_edges_and_degenerate_triangle> WC; + typedef CGAL::internal::Weight_calculator, + CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle> WC; #else - typedef Weight_calculator WC; + typedef CGAL::internal::Weight_calculator WC; #endif - Is_valid_existing_edges_and_degenerate_triangle iv(existing_edges); + CGAL::internal::Is_valid_existing_edges_and_degenerate_triangle iv(existing_edges); // fill hole using polyline function, with custom tracer for PolygonMesh Tracer_polyhedron tracer(out, pmesh, P_edges); - Weight_min_max_dihedral_and_area weight = - internal::triangulate_hole_polyline(P, Q, + CGAL::internal::Weight_min_max_dihedral_and_area weight = + triangulate_hole_polyline(P, Q, tracer, WC(iv), use_delaunay_triangulation) #ifdef CGAL_USE_WEIGHT_INCOMPLETE .weight; // get actual weight in Weight_incomplete @@ -153,6 +157,6 @@ triangulate_hole_Polyhedron(PolygonMesh& pmesh, } }// namespace internal - -}//namespace CGAL +}// namespace Polygon_mesh_processing +}// namespace CGAL #endif //CGAL_HOLE_FILLING_TRIANGULATE_HOLE_POLYHEDRON_3_H diff --git a/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Fair_Polyhedron_3.h b/Polygon_mesh_processing/include/CGAL/internal/Meshing_functions/Fair_Polyhedron_3.h similarity index 65% rename from Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Fair_Polyhedron_3.h rename to Polygon_mesh_processing/include/CGAL/internal/Meshing_functions/Fair_Polyhedron_3.h index 744016c6469..7d87e74a4f8 100644 --- a/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Fair_Polyhedron_3.h +++ b/Polygon_mesh_processing/include/CGAL/internal/Meshing_functions/Fair_Polyhedron_3.h @@ -14,6 +14,7 @@ #endif namespace CGAL { + /*! \ingroup PkgPolygonMeshProcessing @brief Fairing continuity type @@ -25,6 +26,8 @@ enum Fairing_continuity FAIRING_C_2 = 2 /**< C2 continuity */ }; +namespace Polygon_mesh_processing { + namespace internal { struct Fair_default_sparse_linear_solver { @@ -193,83 +196,7 @@ public: }//namespace internal -/*! -\ingroup PkgPolygonMeshProcessing -@brief Function fairing a region on polygon mesh. -The region denoted by @a vertex_begin and @a vertex_end might contain multiple disconnected components. -Note that the structure is not altered in any way, only positions of the vertices get updated. - -Fairing might fail if fixed vertices, which are used as boundary conditions, do not suffice to solve constructed linear system. -The larger @a continuity gets, the more fixed vertices are required. - -@tparam SparseLinearSolver a model of `SparseLinearAlgebraTraitsWithPreFactor_d`. If \ref thirdpartyEigen "Eigen" 3.2 (or greater) is available - and `CGAL_EIGEN3_ENABLED` is defined, then an overload of `Eigen_solver_traits` is provided as default parameter. -@tparam WeightCalculator a model of `FairWeightCalculator` and can be omitted to use default Cotangent weights -@tparam PolygonMesh must be a model of `MutableFaceGraph` -@tparam InputIterator iterator over input vertices - -@param pmesh polygon mesh to be faired -@param vertex_begin first iterator of the range of vertices -@param vertex_end past-the-end iterator of the range of vertices -@param weight_calculator function object to calculate weights, default to Cotangent weights and can be omitted -@param continuity tangential continuity, default to `FAIRING_C_1` and can be omitted - -@return `true` if fairing is successful, otherwise no vertex position is changed - -@todo accuracy of solvers are not good, for example when there is no boundary condition pre_factor should fail, but it does not. -\todo move to a non-internal header file -\todo WeightCalculator should be a property map -*/ -template -bool fair(PolygonMesh& pmesh, - InputIterator vertex_begin, - InputIterator vertex_end, - WeightCalculator weight_calculator, - Fairing_continuity continuity = FAIRING_C_1 - ) -{ - internal::Fair_Polyhedron_3 fair_functor(pmesh, weight_calculator); - return fair_functor.fair(vertex_begin, vertex_end, continuity); -} - -//use default SparseLinearSolver -template -bool fair(PolygonMesh& pmesh, - InputIterator vb, - InputIterator ve, - WeightCalculator weight_calculator, - Fairing_continuity continuity = FAIRING_C_1 - ) -{ - typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver; - return fair - (pmesh, vb, ve, weight_calculator, continuity); -} - -//use default WeightCalculator -template -bool fair(PolygonMesh& pmesh, - InputIterator vb, - InputIterator ve, - Fairing_continuity continuity = FAIRING_C_1 - ) -{ - typedef internal::Cotangent_weight_with_voronoi_area_fairing Weight_calculator; - return fair - (pmesh, vb, ve, Weight_calculator(), continuity); -} - -//use default SparseLinearSolver and WeightCalculator -template -bool fair(PolygonMesh& pmesh, - InputIterator vb, - InputIterator ve, - Fairing_continuity continuity = FAIRING_C_1 - ) -{ - typedef internal::Fair_default_sparse_linear_solver::Solver Sparse_linear_solver; - return fair(pmesh, vb, ve, continuity); -} +}//namespace Polygon_mesh_processing }//namespace CGAL #endif //CGAL_HOLE_FILLING_FAIR_POLYHEDRON_3_H diff --git a/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Refine_Polyhedron_3.h b/Polygon_mesh_processing/include/CGAL/internal/Meshing_functions/Refine_Polyhedron_3.h similarity index 87% rename from Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Refine_Polyhedron_3.h rename to Polygon_mesh_processing/include/CGAL/internal/Meshing_functions/Refine_Polyhedron_3.h index ae127c950c4..7cd7ba66cb8 100644 --- a/Polygon_mesh_processing/include/CGAL/internal/Hole_filling/Refine_Polyhedron_3.h +++ b/Polygon_mesh_processing/include/CGAL/internal/Meshing_functions/Refine_Polyhedron_3.h @@ -12,6 +12,9 @@ #include namespace CGAL { + +namespace Polygon_mesh_processing { + namespace internal { template @@ -272,47 +275,7 @@ public: }//namespace internal -/*! -\ingroup PkgPolygonMeshProcessing -@brief Function refining a region on polygon mesh - -@tparam Polyhedron must be a model of `MutableFaceGraph` -@tparam InputIterator iterator over input facets -@tparam FacetOutputIterator iterator holding `boost::graph_traits::face_descriptor` for patch facets -@tparam VertexOutputIterator iterator holding `boost::graph_traits::vertex_descriptor` for patch vertices - -@param pmesh mesh to be refined -@param facet_begin first iterator of the range of facets -@param facet_end past-the-end iterator of the range of facets -@param facet_out iterator over newly created facets -@param vertex_out iterator over newly created vertices -@param density_control_factor factor for density where larger values cause denser refinements - -@return pair of @a facet_out and @a vertex_out - -@todo current algorithm iterates 10 times at most, since (I guess) there is no termination proof. -\todo move to a non-internal header file - - */ -template< - class PolygonMesh, - class InputIterator, - class FacetOutputIterator, - class VertexOutputIterator -> -std::pair -refine(PolygonMesh& pmesh, - InputIterator facet_begin, - InputIterator facet_end, - FacetOutputIterator facet_out, - VertexOutputIterator vertex_out, - double density_control_factor = std::sqrt(2.0)) -{ - internal::Refine_Polyhedron_3 refine_functor(pmesh); - refine_functor.refine - (facet_begin, facet_end, facet_out, vertex_out, density_control_factor); - return std::make_pair(facet_out, vertex_out); -} +}//namespace Polygon_mesh_processing }//namespace CGAL #endif //CGAL_HOLE_FILLING_REFINE_POLYHEDRON_3_H diff --git a/Polygon_mesh_processing/include/CGAL/polygon_mesh_self_intersections.h b/Polygon_mesh_processing/include/CGAL/polygon_mesh_self_intersections.h index e5db9b8bf0e..26f0690e6a4 100644 --- a/Polygon_mesh_processing/include/CGAL/polygon_mesh_self_intersections.h +++ b/Polygon_mesh_processing/include/CGAL/polygon_mesh_self_intersections.h @@ -231,7 +231,7 @@ self_intersections(const PolygonMesh& pmesh, box_ptr.push_back(&*b); // compute self-intersections filtered out by boxes - internal::Intersect_facets intersect_facets(pmesh, out, geom_traits); + CGAL::internal::Intersect_facets intersect_facets(pmesh, out, geom_traits); std::ptrdiff_t cutoff = 2000; CGAL::box_self_intersection_d(box_ptr.begin(), box_ptr.end(),intersect_facets,cutoff); return intersect_facets.m_iterator; diff --git a/Polygon_mesh_processing/include/CGAL/triangulate_hole.h b/Polygon_mesh_processing/include/CGAL/triangulate_hole.h index e100efa4e69..861bf2d7992 100644 --- a/Polygon_mesh_processing/include/CGAL/triangulate_hole.h +++ b/Polygon_mesh_processing/include/CGAL/triangulate_hole.h @@ -2,9 +2,9 @@ #define CGAL_TRIANGULATE_HOLE_H #include -#include -#include #include +#include +#include #include #include @@ -149,7 +149,7 @@ namespace Polygon_mesh_processing { (pmesh, border_halfedge, face_out, std::back_inserter(patch), density_control_factor, use_delaunay_triangulation).first; - typedef CGAL::internal::Fair_default_sparse_linear_solver::Solver Default_solver; + typedef internal::Fair_default_sparse_linear_solver::Solver Default_solver; typedef typename Default::Get::type Solver; bool fair_success = fair(pmesh, patch.begin(), patch.end(), weight_calculator, continuity); @@ -212,8 +212,9 @@ namespace Polygon_mesh_processing { bool use_delaunay_triangulation = false) { typedef typename std::iterator_traits::value_type Point_3; - typedef internal::Weight_min_max_dihedral_and_area Weight; - typedef internal::Weight_calculator WC; + typedef CGAL::internal::Weight_min_max_dihedral_and_area Weight; + typedef CGAL::internal::Weight_calculator WC; typedef std::vector > Holes; typedef std::back_insert_iterator Holes_out; @@ -221,9 +222,9 @@ namespace Polygon_mesh_processing { std::vector Q(qbegin, qend); Holes holes;//just to check there is no holes - internal::Tracer_polyline_incomplete + CGAL::internal::Tracer_polyline_incomplete tracer(out, Holes_out(holes)); - internal::triangulate_hole_polyline(P, Q, tracer, WC(), use_delaunay_triangulation); + triangulate_hole_polyline(P, Q, tracer, WC(), use_delaunay_triangulation); CGAL_assertion(holes.empty()); return tracer.out; } diff --git a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_Polyhedron_3_test.cpp b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_Polyhedron_3_test.cpp index bf69535d194..c0fc59c3302 100644 --- a/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_Polyhedron_3_test.cpp +++ b/Polygon_mesh_processing/test/Polygon_mesh_processing/triangulate_hole_Polyhedron_3_test.cpp @@ -103,7 +103,8 @@ void test_triangulate_hole_weight(const char* file_name, bool use_DT) { for(std::vector::iterator it = border_reps.begin(); it != border_reps.end(); ++it) { std::vector patch; - Weight w_algo = CGAL::internal::triangulate_hole_Polyhedron(poly, *it, back_inserter(patch), use_DT).second; + Weight w_algo = CGAL::Polygon_mesh_processing::internal::triangulate_hole_Polyhedron(poly, + *it, back_inserter(patch), use_DT).second; if(patch.empty()) { continue; } Weight w_test = calculate_weight_for_patch(poly, patch.begin(), patch.end()); @@ -132,7 +133,7 @@ void test_triangulate_hole(const char* file_name) { for(std::vector::iterator it = border_reps.begin(); it != border_reps.end(); ++it) { std::vector patch; - CGAL::triangulate_hole(poly, *it, back_inserter(patch)); + CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch)); if(patch.empty()) { std::cerr << " Error: empty patch created." << std::endl; assert(false); @@ -156,13 +157,13 @@ void test_triangulate_hole_should_be_no_output(const char* file_name) { for(std::vector::iterator it = border_reps.begin(); it != border_reps.end(); ++it) { std::vector patch; - CGAL::triangulate_hole(poly, *it, back_inserter(patch), false); + CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), false); if(!patch.empty()) { std::cerr << " Error: patch should be empty" << std::endl; assert(false); } - CGAL::triangulate_hole(poly, *it, back_inserter(patch), true); + CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch), true); if(!patch.empty()) { std::cerr << " Error: patch should be empty" << std::endl; assert(false); @@ -182,7 +183,7 @@ void test_triangulate_and_refine_hole(const char* file_name) { for(std::vector::iterator it = border_reps.begin(); it != border_reps.end(); ++it) { std::vector patch_facets; std::vector patch_vertices; - CGAL::triangulate_and_refine_hole(poly, *it, + CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly, *it, back_inserter(patch_facets), back_inserter(patch_vertices)); if(patch_facets.empty()) { @@ -209,7 +210,8 @@ void test_triangulate_refine_and_fair_hole(const char* file_name) { for(std::vector::iterator it = border_reps.begin(); it != border_reps.end(); ++it) { std::vector patch_facets; std::vector patch_vertices; - CGAL::triangulate_refine_and_fair_hole(poly, *it, back_inserter(patch_facets), back_inserter(patch_vertices)); + CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole(poly, + *it, back_inserter(patch_facets), back_inserter(patch_vertices)); if(patch_facets.empty()) { std::cerr << " Error: empty patch created." << std::endl; @@ -238,10 +240,11 @@ void test_ouput_iterators_triangulate_hole(const char* file_name) { std::vector::iterator it_2 = border_reps_2.begin(); for(std::vector::iterator it = border_reps.begin(); it != border_reps.end(); ++it, ++it_2) { std::vector patch; - CGAL::triangulate_hole(poly, *it, back_inserter(patch)); + CGAL::Polygon_mesh_processing::triangulate_hole(poly, *it, back_inserter(patch)); std::vector patch_2 = patch; - Facet_handle* output_it = CGAL::triangulate_hole(poly_2, *it_2, &*patch_2.begin()); + Facet_handle* output_it = + CGAL::Polygon_mesh_processing::triangulate_hole(poly_2, *it_2, &*patch_2.begin()); if(patch.size() != (output_it - &*patch_2.begin())) { std::cerr << " Error: returned facet output iterator is not valid!" << std::endl; @@ -266,14 +269,16 @@ void test_ouput_iterators_triangulate_and_refine_hole(const char* file_name) { for(std::vector::iterator it = border_reps.begin(); it != border_reps.end(); ++it, ++it_2) { std::vector patch_facets; std::vector patch_vertices; - CGAL::triangulate_and_refine_hole(poly, *it, back_inserter(patch_facets), back_inserter(patch_vertices)); + CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly, + *it, back_inserter(patch_facets), back_inserter(patch_vertices)); // create enough space to hold outputs std::vector patch_facets_2 = patch_facets; std::vector patch_vertices_2 = patch_vertices; if(patch_vertices_2.empty()) { patch_vertices_2.push_back(Vertex_handle()); } //just allocate space for dereferencing std::pair output_its = - CGAL::triangulate_and_refine_hole(poly_2, *it_2, &*patch_facets_2.begin(), &*patch_vertices_2.begin()); + CGAL::Polygon_mesh_processing::triangulate_and_refine_hole(poly_2, + *it_2, &*patch_facets_2.begin(), &*patch_vertices_2.begin()); if(patch_facets.size() != (output_its.first - &*patch_facets_2.begin())) { std::cerr << " Error: returned facet output iterator is not valid!" << std::endl; @@ -306,19 +311,19 @@ void test_triangulate_refine_and_fair_hole_compile() { // use all param read_poly_with_borders("data/elephant_quad_hole.off", poly, border_reps); - CGAL::triangulate_refine_and_fair_hole + CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole (poly, border_reps[0], back_inserter(patch_facets), back_inserter(patch_vertices), CGAL::internal::Uniform_weight_fairing(poly), Default_solver()); // default solver read_poly_with_borders("data/elephant_quad_hole.off", poly, border_reps); - CGAL::triangulate_refine_and_fair_hole + CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole (poly, border_reps[0], back_inserter(patch_facets), back_inserter(patch_vertices), CGAL::internal::Uniform_weight_fairing(poly), CGAL::Default()); // default solver and weight read_poly_with_borders("data/elephant_quad_hole.off", poly, border_reps); - CGAL::triangulate_refine_and_fair_hole + CGAL::Polygon_mesh_processing::triangulate_refine_and_fair_hole (poly, border_reps[0], back_inserter(patch_facets), back_inserter(patch_vertices)); } 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 a52653d0c4a..954a3526b92 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 @@ -139,7 +139,8 @@ void test_1(const char* file_name, bool use_DT) { read_polyline_one_line(file_name, points); std::vector > tris; - CGAL::triangulate_hole_polyline(points.begin(), --points.end(), std::back_inserter(tris), use_DT); + CGAL::Polygon_mesh_processing::triangulate_hole_polyline(points.begin(), + --points.end(), std::back_inserter(tris), use_DT); check_triangles(points, tris); check_constructed_polyhedron(file_name, &tris, &points); @@ -155,8 +156,8 @@ void test_2(const char* file_name, bool use_DT) { read_polyline_with_extra_points(file_name, points, extras); std::vector > tris; - CGAL::triangulate_hole_polyline(points.begin(), points.end(), - extras.begin(), extras.end(), std::back_inserter(tris), use_DT); + CGAL::Polygon_mesh_processing::triangulate_hole_polyline(points.begin(), + points.end(), extras.begin(), extras.end(), std::back_inserter(tris), use_DT); check_triangles(points, tris); check_constructed_polyhedron(file_name, &tris, &points); @@ -171,7 +172,8 @@ void test_should_be_no_output(const char* file_name, bool use_DT) { read_polyline_one_line(file_name, points); std::vector > tris; - CGAL::triangulate_hole_polyline(points.begin(), points.end(), std::back_inserter(tris), use_DT); + CGAL::Polygon_mesh_processing::triangulate_hole_polyline( + points.begin(), points.end(), std::back_inserter(tris), use_DT); if(!tris.empty()) { std::cerr << " Error: patch should be empty" << std::endl; diff --git a/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp b/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp index 6419dc9b262..9ef59fc770b 100644 --- a/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Polyhedron_demo_fairing_plugin.cpp @@ -7,8 +7,9 @@ #include "ui_Fairing_widget.h" #include "Polyhedron_type.h" -#include #include +#include +#include #include #include @@ -74,14 +75,16 @@ public slots: CGAL::Fairing_continuity continuity = static_cast(ui_widget.Continuity_spin_box->value()); if(weight_index == 1) - CGAL::fair(*selection_item->polyhedron(), selection_item->selected_vertices.begin(), + CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(), + selection_item->selected_vertices.begin(), selection_item->selected_vertices.end(), - CGAL::internal::Uniform_weight_fairing(), + CGAL::internal::Uniform_weight_fairing(*selection_item->polyhedron()), continuity); if(weight_index == 0) - CGAL::fair(*selection_item->polyhedron(), selection_item->selected_vertices.begin(), + CGAL::Polygon_mesh_processing::fair(*selection_item->polyhedron(), + selection_item->selected_vertices.begin(), selection_item->selected_vertices.end(), - CGAL::internal::Cotangent_weight_with_voronoi_area_fairing(), + CGAL::internal::Cotangent_weight_with_voronoi_area_fairing(*selection_item->polyhedron()), continuity); selection_item->changed_with_poly_item(); QApplication::restoreOverrideCursor(); @@ -98,8 +101,12 @@ public slots: double alpha = ui_widget.Density_control_factor_spin_box->value(); std::vector new_facets; - CGAL::refine(*selection_item->polyhedron(), selection_item->selected_facets.begin(), - selection_item->selected_facets.end(), std::back_inserter(new_facets), CGAL::Emptyset_iterator(), alpha); + CGAL::Polygon_mesh_processing::refine(*selection_item->polyhedron(), + selection_item->selected_facets.begin(), + selection_item->selected_facets.end(), + std::back_inserter(new_facets), + CGAL::Emptyset_iterator(), + alpha); // add new facets to selection for(std::vector::iterator it = new_facets.begin(); it != new_facets.end(); ++it) { selection_item->selected_facets.insert(*it); diff --git a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h index 508edf50754..8b9e71ce46b 100644 --- a/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h +++ b/Polyhedron/demo/Polyhedron/Scene_polyhedron_selection_item.h @@ -9,7 +9,7 @@ #include "Polyhedron_type.h" #include #include -#include +#include #include #include