From a57dab7b0b6576e095b7eb1fd5659de8c6965b01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Fri, 21 Oct 2022 13:12:25 +0200 Subject: [PATCH] Misc minor code improvements --- .../Surface_mesh_geodesic_distances_3.h | 13 +++++++++---- .../Intrinsic_Delaunay_triangulation_3.h | 19 +++++++++++-------- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h index d60a7ec5a2f..27194ef7baf 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/Surface_mesh_geodesic_distances_3.h @@ -92,8 +92,13 @@ public: /*! \brief Constructor */ - Surface_mesh_geodesic_distances_3(const TriangleMesh& tm) - : vertex_id_map(get(Vertex_property_tag(),tm)), face_id_map(get(Face_property_tag(),tm)), v2v(tm), tm(tm), vpm(get(vertex_point,tm)) + Surface_mesh_geodesic_distances_3(const TriangleMesh& tm, + VertexPointMap vpm) + : vertex_id_map(get(Vertex_property_tag(), tm)), + face_id_map(get(Face_property_tag(), tm)), + v2v(tm), + tm(tm), + vpm(vpm) { build(); } @@ -101,8 +106,8 @@ public: /*! \brief Constructor */ - Surface_mesh_geodesic_distances_3(const TriangleMesh& tm, VertexPointMap vpm) - : vertex_id_map(get(Vertex_property_tag(),tm)), face_id_map(get(Face_property_tag(),tm)), v2v(tm), tm(tm), vpm(vpm) + Surface_mesh_geodesic_distances_3(const TriangleMesh& tm) + : Surface_mesh_geodesic_distances_3(tm, get(vertex_point, tm)) { build(); } diff --git a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h index c4fecf865fa..2d8432e0f08 100644 --- a/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h +++ b/Heat_method_3/include/CGAL/Heat_method_3/internal/Intrinsic_Delaunay_triangulation_3.h @@ -66,13 +66,16 @@ bool has_degenerate_faces(const TriangleMesh& tm, const Traits& traits) typename Traits::Construct_cross_product_vector_3 cross_product = traits.construct_cross_product_vector_3_object(); - typename boost::property_map< TriangleMesh, boost::vertex_point_t>::const_type - vpm = get(boost::vertex_point, tm); + typedef typename boost::property_map< TriangleMesh, boost::vertex_point_t>::const_type VPM; + typedef typename boost::property_traits::reference Point_ref; + + VPM vpm = get(boost::vertex_point, tm); + for (typename boost::graph_traits::face_descriptor f : faces(tm)) { - const Point p1 = get(vpm, target(halfedge(f, tm), tm)); - const Point p2 = get(vpm, target(next(halfedge(f, tm), tm), tm)); - const Point p3 = get(vpm, target(next(next(halfedge(f, tm), tm), tm), tm)); + const Point_ref p1 = get(vpm, target(halfedge(f, tm), tm)); + const Point_ref p2 = get(vpm, target(next(halfedge(f, tm), tm), tm)); + const Point_ref p3 = get(vpm, target(next(next(halfedge(f, tm), tm), tm), tm)); Vector_3 v = cross_product(construct_vector(p1, p2), construct_vector(p1, p3)); if(scalar_product(v, v) == 0.) return true; @@ -278,7 +281,7 @@ private: } - //returns true if edge is locally Delaunay (opposing angles are less than pi): + //returns `true` if edge is locally Delaunay (opposing angles are less than pi): //Two ways of doing this: taking angles directly (not good with virtual edges) //OR: taking edge length and using law of cosines, //The second way checks cotan weights @@ -797,11 +800,11 @@ struct IDT_vertex_distance_property_map { friend void put(IDT_vertex_distance_property_map idtpm, key_type vd, - value_type v) + value_type val) { typename boost::graph_traits::vertex_descriptor tm_vd = target(vd.hd, idtpm.idt.triangle_mesh()); - put(idtpm.pm, idtpm.idt.v2v.at(tm_vd), v); + put(idtpm.pm, idtpm.idt.v2v.at(tm_vd), val); } };