From 85132eea04c7c8c6994b0b7b8821f4f56c134e51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 17 Oct 2022 17:02:29 +0200 Subject: [PATCH] More re-indentation --- .../Weights/internal/pmp_weights_deprecated.h | 744 ++++++++---------- 1 file changed, 329 insertions(+), 415 deletions(-) diff --git a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h index 942ad0dc8d5..fb44deac937 100644 --- a/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h +++ b/Weights/include/CGAL/Weights/internal/pmp_weights_deprecated.h @@ -41,19 +41,18 @@ namespace deprecated { // (i.e. for v0, v1, v2 and v2, v1, v0 the returned cot weights can be slightly different). // This one provides stable results. template -struct Cotangent_value_Meyer_impl { - +struct Cotangent_value_Meyer_impl +{ typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; template - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap& ppmap) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + const VertexPointMap& ppmap) + { typedef typename Kernel_traits< - typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; + typename boost::property_traits::value_type >::Kernel::Vector_3 Vector; const Vector a = get(ppmap, v0) - get(ppmap, v1); const Vector b = get(ppmap, v2) - get(ppmap, v1); @@ -66,28 +65,27 @@ struct Cotangent_value_Meyer_impl { // double divider = CGAL::sqrt(dot_aa * dot_bb - dot_ab * dot_ab); const Vector cross_ab = CGAL::cross_product(a, b); - const double divider = CGAL::to_double( - CGAL::approximate_sqrt(cross_ab * cross_ab)); + const double divider = CGAL::to_double(CGAL::approximate_sqrt(cross_ab * cross_ab)); - if (divider == 0.0 /* || divider != divider */) { + if (divider == 0.0 /* || divider != divider */) + { CGAL::collinear(get(ppmap, v0), get(ppmap, v1), get(ppmap, v2)) ? - CGAL_warning_msg(false, "Infinite Cotangent value with the degenerate triangle!") : - CGAL_warning_msg(false, "Infinite Cotangent value due to the floating point arithmetic!"); + CGAL_warning_msg(false, "Infinite Cotangent value with the degenerate triangle!") : + CGAL_warning_msg(false, "Infinite Cotangent value due to the floating point arithmetic!"); - return dot_ab > 0.0 ? - (std::numeric_limits::max)() : - -(std::numeric_limits::max)(); + return dot_ab > 0.0 ? (std::numeric_limits::max)() : + -(std::numeric_limits::max)(); } + return dot_ab / divider; } }; // Same as above but with a different API. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_value_Meyer { - +template::type> +class Cotangent_value_Meyer +{ protected: typedef VertexPointMap Point_property_map; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -98,36 +96,27 @@ protected: Point_property_map ppmap_; public: - Cotangent_value_Meyer( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + Cotangent_value_Meyer(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { - return pmesh_; - } - - Point_property_map& ppmap() { - return ppmap_; - } - - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + PolygonMesh& pmesh() { return pmesh_; } + Point_property_map& ppmap() { return ppmap_; } + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { return Cotangent_value_Meyer_impl()(v0, v1, v2, ppmap()); } }; // Imported from skeletonization. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_value_Meyer_secure { - +template::type> +class Cotangent_value_Meyer_secure +{ typedef VertexPointMap Point_property_map; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::property_traits::value_type Point; @@ -137,26 +126,18 @@ class Cotangent_value_Meyer_secure { Point_property_map ppmap_; public: - Cotangent_value_Meyer_secure( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - pmesh_(pmesh_), - ppmap_(vpmap_) + Cotangent_value_Meyer_secure(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : pmesh_(pmesh_), ppmap_(vpmap_) { } - PolygonMesh& pmesh() { - return pmesh_; - } - - Point_property_map& ppmap() { - return ppmap_; - } - - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + PolygonMesh& pmesh() { return pmesh_; } + Point_property_map& ppmap() { return ppmap_; } + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector a = get(ppmap(), v0) - get(ppmap(), v1); const Vector b = get(ppmap(), v2) - get(ppmap(), v1); @@ -174,37 +155,28 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by clamping between // [1, 89] degrees as suggested by -[Friedel] Unconstrained Spherical Parameterization-. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_clamped : CotangentValue { - - Cotangent_value_clamped() - { } +template::type, +typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_clamped : CotangentValue +{ + Cotangent_value_clamped() { } public: - Cotangent_value_clamped( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_clamped(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double cot_1 = 57.289962; const double cot_89 = 0.017455; const double value = CotangentValue::operator()(v0, v1, v2); @@ -212,37 +184,28 @@ public: } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_clamped_2 : CotangentValue { - - Cotangent_value_clamped_2() - { } +template::type, +typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_clamped_2 : CotangentValue +{ + Cotangent_value_clamped_2() { } public: - Cotangent_value_clamped_2( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_clamped_2(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double cot_5 = 5.671282; const double cot_175 = -cot_5; const double value = CotangentValue::operator()(v0, v1, v2); @@ -250,80 +213,66 @@ public: } }; -template< - typename PolygonMesh, - typename CotangentValue = Cotangent_value_Meyer_impl > -struct Cotangent_value_minimum_zero_impl : CotangentValue { - +template > +struct Cotangent_value_minimum_zero_impl + : CotangentValue +{ typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; template - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2, - const VertexPointMap ppmap) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2, + const VertexPointMap ppmap) + { const double value = CotangentValue::operator()(v0, v1, v2, ppmap); return (std::max)(0.0, value); } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_minimum_zero : CotangentValue { - +template::type, +typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_minimum_zero : CotangentValue +{ Cotangent_value_minimum_zero() { } public: - Cotangent_value_minimum_zero( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_value_minimum_zero(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const double value = CotangentValue::operator()(v0, v1, v2); return (std::max)(0.0, value); } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Voronoi_area : CotangentValue { - +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Voronoi_area + : CotangentValue +{ public: - Voronoi_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Voronoi_area(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::in_edge_iterator in_edge_iterator; @@ -333,13 +282,13 @@ public: typedef typename boost::property_traits::value_type Point; typedef typename Kernel_traits::Kernel::Vector_3 Vector; - double operator()(vertex_descriptor v0) { - + double operator()(vertex_descriptor v0) + { // return 1.0; double voronoi_area = 0.0; for (const halfedge_descriptor he : - halfedges_around_target(halfedge(v0, pmesh()), pmesh())) { - + halfedges_around_target(halfedge(v0, pmesh()), pmesh())) + { if (is_border(he, pmesh()) ) { continue; } CGAL_assertion(CGAL::is_triangle_mesh(pmesh())); @@ -356,12 +305,12 @@ public: const CGAL::Angle angle1 = CGAL::angle(v_op_p, v1_p, v0_p); const CGAL::Angle angle_op = CGAL::angle(v0_p, v_op_p, v1_p); - bool obtuse = - (angle0 == CGAL::OBTUSE) || - (angle1 == CGAL::OBTUSE) || - (angle_op == CGAL::OBTUSE); + bool obtuse = (angle0 == CGAL::OBTUSE) || + (angle1 == CGAL::OBTUSE) || + (angle_op == CGAL::OBTUSE); - if (!obtuse) { + if (!obtuse) + { const double cot_v1 = CotangentValue::operator()(v_op, v1, v0); const double cot_v_op = CotangentValue::operator()(v0, v_op, v1); @@ -369,18 +318,18 @@ public: const double term2 = cot_v_op * to_double((v1_p - v0_p).squared_length()); voronoi_area += (1.0 / 8.0) * (term1 + term2); - } else { - const double area_t = to_double( - CGAL::approximate_sqrt( - CGAL::squared_area(v0_p, v1_p, v_op_p))); + } + else + { + const double area_t = to_double(CGAL::approximate_sqrt(CGAL::squared_area(v0_p, v1_p, v_op_p))); - if (angle0 == CGAL::OBTUSE) { + if (angle0 == CGAL::OBTUSE) voronoi_area += area_t / 2.0; - } else { + else voronoi_area += area_t / 4.0; - } } } + CGAL_warning_msg(voronoi_area != 0.0, "Zero Voronoi area!"); return voronoi_area; } @@ -388,118 +337,103 @@ public: // Returns the cotangent value of the half angle [v0, v1, v2] by dividing the triangle area // as suggested by -[Mullen08] Spectral Conformal Parameterization-. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_value_area_weighted : CotangentValue { - - Cotangent_value_area_weighted() - { } +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_value_area_weighted + : CotangentValue +{ + Cotangent_value_area_weighted() { } public: - Cotangent_value_area_weighted( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : + Cotangent_value_area_weighted(PolygonMesh& pmesh_, + VertexPointMap vpmap_) : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double operator()( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double operator()(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { return CotangentValue::operator()(v0, v1, v2) / - CGAL::sqrt(CGAL::squared_area( - get(this->ppmap(), v0), - get(this->ppmap(), v1), - get(this->ppmap(), v2))); + CGAL::sqrt(CGAL::squared_area(get(this->ppmap(), v0), + get(this->ppmap(), v1), + get(this->ppmap(), v2))); } }; // Cotangent weight calculator: // Cotangent_value: as suggested by -[Sorkine07] ARAP Surface Modeling-. // Cotangent_value_area_weighted: as suggested by -[Mullen08] Spectral Conformal Parameterization-. -template< - typename PolygonMesh, - typename CotangentValue = Cotangent_value_minimum_zero_impl > -struct Cotangent_weight_impl : CotangentValue { - +template > +struct Cotangent_weight_impl + : CotangentValue +{ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; // Returns the cotangent weight of the specified halfedge_descriptor. // Edge orientation is trivial. template - double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { - + double operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + const VertexPointMap& ppmap) + { const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); // Only one triangle for border edges. - if (is_border_edge(he, pmesh)) { - + if (is_border_edge(he, pmesh)) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); vertex_descriptor v2 = source(he_cw, pmesh); - if (is_border_edge(he_cw, pmesh)) { + if (is_border_edge(he_cw, pmesh)) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); v2 = source(he_ccw, pmesh); } - return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0); - } else { + return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh), pmesh); const vertex_descriptor v2 = source(he_cw, pmesh); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh), pmesh); const vertex_descriptor v3 = source(he_ccw, pmesh); - return ( - CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + - CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); + return (CotangentValue::operator()(v0, v2, v1, ppmap) / 2.0 + + CotangentValue::operator()(v0, v3, v1, ppmap) / 2.0 ); } } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_minimum_zero > -class Cotangent_weight : CotangentValue { - - Cotangent_weight() - { } +template::type, + typename CotangentValue = Cotangent_value_minimum_zero > +class Cotangent_weight + : CotangentValue +{ + Cotangent_weight() { } public: - Cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_weight(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - Cotangent_weight(PolygonMesh& pmesh_) : - CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight(PolygonMesh& pmesh_) + : CotangentValue(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -510,52 +444,55 @@ public: // Returns the cotangent weight of the specified halfedge_descriptor. // Edge orientation is trivial. - double operator()(halfedge_descriptor he) { + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { - + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } - return (CotangentValue::operator()(v0, v2, v1) / 2.0); - } else { + return (CotangentValue::operator()(v0, v2, v1) / 2.0); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); const vertex_descriptor v3 = source(he_ccw, pmesh()); - return ( - CotangentValue::operator()(v0, v2, v1) / 2.0 + - CotangentValue::operator()(v0, v3, v1) / 2.0 ); + return (CotangentValue::operator()(v0, v2, v1) / 2.0 + + CotangentValue::operator()(v0, v3, v1) / 2.0 ); } } }; // Single cotangent from -[Chao10] Simple Geometric Model for Elastic Deformation. -template< - typename PolygonMesh, - typename CotangentValue = Cotangent_value_Meyer_impl > -struct Single_cotangent_weight_impl : CotangentValue { - +template > +struct Single_cotangent_weight_impl + : CotangentValue +{ typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; // Returns the cotangent of the opposite angle of the edge // 0 for border edges (which does not have an opposite angle). template - double operator()( - halfedge_descriptor he, - PolygonMesh& pmesh, - const VertexPointMap& ppmap) { - - if (is_border(he, pmesh)) { return 0.0; } + double operator()(halfedge_descriptor he, + PolygonMesh& pmesh, + const VertexPointMap& ppmap) + { + if (is_border(he, pmesh)) + return 0.0; const vertex_descriptor v0 = target(he, pmesh); const vertex_descriptor v1 = source(he, pmesh); @@ -564,29 +501,22 @@ struct Single_cotangent_weight_impl : CotangentValue { } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Single_cotangent_weight : CotangentValue { - - Single_cotangent_weight() - { } +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Single_cotangent_weight + : CotangentValue +{ + Single_cotangent_weight() { } public: - Single_cotangent_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Single_cotangent_weight(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } - - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -597,9 +527,10 @@ public: // Returns the cotangent of the opposite angle of the edge // 0 for border edges (which does not have an opposite angle). - double operator()(halfedge_descriptor he) { - - if (is_border(he, pmesh())) { return 0.0; } + double operator()(halfedge_descriptor he) + { + if (is_border(he, pmesh())) + return 0.0; const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); @@ -608,12 +539,12 @@ public: } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type, - typename CotangentValue = Cotangent_value_Meyer > -class Cotangent_weight_with_triangle_area : CotangentValue { - +template::type, + typename CotangentValue = Cotangent_value_Meyer > +class Cotangent_weight_with_triangle_area + : CotangentValue +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; typedef typename boost::property_traits::value_type Point; @@ -621,33 +552,29 @@ class Cotangent_weight_with_triangle_area : CotangentValue { typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - Cotangent_weight_with_triangle_area() - { } + Cotangent_weight_with_triangle_area() { } public: - Cotangent_weight_with_triangle_area( - PolygonMesh& pmesh_, - VertexPointMap vpmap_) : - CotangentValue(pmesh_, vpmap_) + Cotangent_weight_with_triangle_area(PolygonMesh& pmesh_, + VertexPointMap vpmap_) + : CotangentValue(pmesh_, vpmap_) { } - PolygonMesh& pmesh() { - return CotangentValue::pmesh(); - } + PolygonMesh& pmesh() { return CotangentValue::pmesh(); } + VertexPointMap& ppmap() { return CotangentValue::ppmap(); } - VertexPointMap& ppmap() { - return CotangentValue::ppmap(); - } - - double operator()(halfedge_descriptor he) { + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } @@ -655,11 +582,11 @@ public: const Point& v0_p = get(ppmap(), v0); const Point& v1_p = get(ppmap(), v1); const Point& v2_p = get(ppmap(), v2); - const double area_t = to_double( - CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); + const double area_t = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); return (CotangentValue::operator()(v0, v2, v1) / area_t); - - } else { + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); @@ -672,37 +599,31 @@ public: const double area_t1 = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v2_p))); const double area_t2 = to_double(CGAL::sqrt(CGAL::squared_area(v0_p, v1_p, v3_p))); - return ( - CotangentValue::operator()(v0, v2, v1) / area_t1 + - CotangentValue::operator()(v0, v3, v1) / area_t2 ); + return (CotangentValue::operator()(v0, v2, v1) / area_t1 + + CotangentValue::operator()(v0, v3, v1) / area_t2 ); } + return 0.0; } }; // Mean value calculator described in -[Floater04] Mean Value Coordinates- -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Mean_value_weight { - - // Mean_value_weight() - // {} +template::type> +class Mean_value_weight +{ + // Mean_value_weight() {} PolygonMesh& pmesh_; VertexPointMap vpmap_; public: - Mean_value_weight( - PolygonMesh& pmesh_, - VertexPointMap vpmap) : - pmesh_(pmesh_), - vpmap_(vpmap) + Mean_value_weight(PolygonMesh& pmesh_, + VertexPointMap vpmap) + : pmesh_(pmesh_), vpmap_(vpmap) { } - PolygonMesh& pmesh() { - return pmesh_; - } + PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -714,42 +635,43 @@ public: // Returns the mean-value coordinate of the specified halfedge_descriptor. // Returns different value for different edge orientation (which is a normal // behavior according to the formula). - double operator()(halfedge_descriptor he) { - + double operator()(halfedge_descriptor he) + { const vertex_descriptor v0 = target(he, pmesh()); const vertex_descriptor v1 = source(he, pmesh()); const Vector vec = get(vpmap_, v0) - get(vpmap_, v1); const double norm = CGAL::sqrt(vec.squared_length()); // Only one triangle for border edges. - if (is_border_edge(he, pmesh())) { - + if (is_border_edge(he, pmesh())) + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); vertex_descriptor v2 = source(he_cw, pmesh()); - if (is_border_edge(he_cw, pmesh())) { + if (is_border_edge(he_cw, pmesh())) + { const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); v2 = source(he_ccw, pmesh()); } - return (half_tan_value_2(v1, v0, v2) / norm); - } else { + return (half_tan_value_2(v1, v0, v2) / norm); + } + else + { const halfedge_descriptor he_cw = opposite(next(he, pmesh()), pmesh()); const vertex_descriptor v2 = source(he_cw, pmesh()); const halfedge_descriptor he_ccw = prev(opposite(he, pmesh()), pmesh()); const vertex_descriptor v3 = source(he_ccw, pmesh()); - return ( - half_tan_value_2(v1, v0, v2) / norm + - half_tan_value_2(v1, v0, v3) / norm); + return (half_tan_value_2(v1, v0, v2) / norm + + half_tan_value_2(v1, v0, v3) / norm); } } private: // Returns the tangent value of the half angle v0_v1_v2 / 2. - double half_tan_value( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double half_tan_value(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector vec0 = get(vpmap_, v1) - get(vpmap_, v2); const Vector vec1 = get(vpmap_, v2) - get(vpmap_, v0); const Vector vec2 = get(vpmap_, v0) - get(vpmap_, v1); @@ -765,11 +687,10 @@ private: } // My deviation built on Meyer_02. - double half_tan_value_2( - vertex_descriptor v0, - vertex_descriptor v1, - vertex_descriptor v2) { - + double half_tan_value_2(vertex_descriptor v0, + vertex_descriptor v1, + vertex_descriptor v2) + { const Vector a = get(vpmap_, v0) - get(vpmap_, v1); const Vector b = get(vpmap_, v2) - get(vpmap_, v1); const double dot_ab = a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; @@ -787,32 +708,28 @@ private: } }; -template< - typename PolygonMesh, - typename PrimaryWeight = Cotangent_weight, - typename SecondaryWeight = Mean_value_weight > -class Hybrid_weight : public PrimaryWeight, SecondaryWeight { - +template, + typename SecondaryWeight = Mean_value_weight > +class Hybrid_weight + : public PrimaryWeight, SecondaryWeight +{ PrimaryWeight primary; SecondaryWeight secondary; - Hybrid_weight() - { } + Hybrid_weight() { } public: - Hybrid_weight(PolygonMesh& pmesh_) : - primary(pmesh_), - secondary(pmesh_) + Hybrid_weight(PolygonMesh& pmesh_) + : primary(pmesh_), secondary(pmesh_) { } - PolygonMesh& pmesh() { - return primary.pmesh(); - } + PolygonMesh& pmesh() { return primary.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - double operator()(halfedge_descriptor he) { - + double operator()(halfedge_descriptor he) + { const double weight = primary(he); // if (weight < 0.0) { std::cout << "Negative weight!" << std::endl; } return (weight >= 0.0) ? weight : secondary(he); @@ -821,27 +738,25 @@ public: // Trivial uniform weights (created for test purposes). template -class Uniform_weight { +class Uniform_weight +{ public: typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; - double operator()(halfedge_descriptor /* e */) - { return 1.0; } + double operator()(halfedge_descriptor /* e */) { return 1.0; } }; template -class Scale_dependent_weight_fairing { - +class Scale_dependent_weight_fairing +{ PolygonMesh& pmesh_; public: - Scale_dependent_weight_fairing(PolygonMesh& pmesh_) : - pmesh_(pmesh_) + Scale_dependent_weight_fairing(PolygonMesh& pmesh_) + : pmesh_(pmesh_) { } - PolygonMesh& pmesh() { - return pmesh_; - } + PolygonMesh& pmesh() { return pmesh_; } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; @@ -852,53 +767,53 @@ public: double w_i(vertex_descriptor /* v_i */) { return 1.0; } - double w_ij(halfedge_descriptor he) { - + double w_ij(halfedge_descriptor he) + { const Vector v = target(he, pmesh())->point() - source(he, pmesh())->point(); const double divider = CGAL::sqrt(v.squared_length()); - if (divider == 0.0) { + if (divider == 0.0) + { CGAL_warning_msg(false, "Scale dependent weight - zero length edge."); return (std::numeric_limits::max)(); } + return 1.0 / divider; } }; -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_weight_with_voronoi_area_fairing { - +template::type> +class Cotangent_weight_with_voronoi_area_fairing +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; Voronoi_area voronoi_functor; Cotangent_weight > cotangent_functor; public: - Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_) + : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - Cotangent_weight_with_voronoi_area_fairing( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + Cotangent_weight_with_voronoi_area_fairing(PM& pmesh_, + VPMap vpmap_) + : voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } - PM& pmesh() { - return voronoi_functor.pmesh(); - } + PM& pmesh() { return voronoi_functor.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double w_i(vertex_descriptor v_i) { + double w_i(vertex_descriptor v_i) + { return 0.5 / voronoi_functor(v_i); } - double w_ij(halfedge_descriptor he) { + double w_ij(halfedge_descriptor he) + { return cotangent_functor(he) * 2.0; } }; @@ -906,54 +821,51 @@ public: // Cotangent_value_Meyer has been changed to the version: // Cotangent_value_Meyer_secure to avoid imprecisions from // the issue #4706 - https://github.com/CGAL/cgal/issues/4706. -template< - typename PolygonMesh, - typename VertexPointMap = typename boost::property_map::type> -class Cotangent_weight_with_voronoi_area_fairing_secure { - +template::type> +class Cotangent_weight_with_voronoi_area_fairing_secure +{ typedef PolygonMesh PM; typedef VertexPointMap VPMap; Voronoi_area voronoi_functor; Cotangent_weight > cotangent_functor; public: - Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) : - voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), - cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) + Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_) + : voronoi_functor(pmesh_, get(CGAL::vertex_point, pmesh_)), + cotangent_functor(pmesh_, get(CGAL::vertex_point, pmesh_)) { } - Cotangent_weight_with_voronoi_area_fairing_secure( - PM& pmesh_, - VPMap vpmap_) : - voronoi_functor(pmesh_, vpmap_), - cotangent_functor(pmesh_, vpmap_) + Cotangent_weight_with_voronoi_area_fairing_secure(PM& pmesh_, + VPMap vpmap_) + : voronoi_functor(pmesh_, vpmap_), + cotangent_functor(pmesh_, vpmap_) { } - PM& pmesh() { - return voronoi_functor.pmesh(); - } + PM& pmesh() { return voronoi_functor.pmesh(); } typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - double w_i(vertex_descriptor v_i) { + double w_i(vertex_descriptor v_i) + { return 0.5 / voronoi_functor(v_i); } - double w_ij(halfedge_descriptor he) { + double w_ij(halfedge_descriptor he) + { return cotangent_functor(he) * 2.0; } }; template -class Uniform_weight_fairing { - +class Uniform_weight_fairing +{ public: typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; - Uniform_weight_fairing(PolygonMesh&) - { } + Uniform_weight_fairing(PolygonMesh&) { } double w_ij(halfedge_descriptor /* e */) { return 1.0; } double w_i(vertex_descriptor /* v_i */) { return 1.0; } @@ -965,4 +877,6 @@ public: } // namespace Weights } // namespace CGAL +#endif // CGAL_NO_DEPRECATED_CODE + #endif // CGAL_WEIGHTS_PMP_DEPRECATED_H