From fbbff6794f6d3567231322ded5988d53b752274b Mon Sep 17 00:00:00 2001 From: Dmitry Anisimov Date: Fri, 8 Jan 2021 10:15:12 +0100 Subject: [PATCH] surface mesh approximation range loop analysis copy to ref warning fixed --- .../vsa_isotropic_metric_example.cpp | 2 +- .../Surface_mesh_approximation/L21_metric_plane_proxy.h | 2 +- .../CGAL/Surface_mesh_approximation/L2_metric_plane_proxy.h | 2 +- .../include/CGAL/Variational_shape_approximation.h | 6 +++--- .../test/Surface_mesh_approximation/vsa_metric_test.cpp | 2 +- .../Surface_mesh_approximation/vsa_teleportation_test.cpp | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp index d3e1dd71e8c..e8a066b59a8 100644 --- a/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp +++ b/Surface_mesh_approximation/examples/Surface_mesh_approximation/vsa_isotropic_metric_example.cpp @@ -46,7 +46,7 @@ struct Compact_metric_point_proxy // fitting center Vector_3 center = CGAL::NULL_VECTOR; FT sum_areas = FT(0.0); - for(const face_descriptor f : faces) { + for(const face_descriptor& f : faces) { center = center + (center_pmap[f] - CGAL::ORIGIN) * area_pmap[f]; sum_areas += area_pmap[f]; } diff --git a/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L21_metric_plane_proxy.h b/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L21_metric_plane_proxy.h index 75f324d7469..4a38a9783da 100644 --- a/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L21_metric_plane_proxy.h +++ b/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L21_metric_plane_proxy.h @@ -127,7 +127,7 @@ public: // fitting normal Vector_3 norm = CGAL::NULL_VECTOR; - for(const face_descriptor f : faces) { + for(const face_descriptor& f : faces) { norm = m_sum_functor(norm, m_scale_functor(get(m_fnmap, f), get(m_famap, f))); } diff --git a/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L2_metric_plane_proxy.h b/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L2_metric_plane_proxy.h index 9ced8858388..eee12468f63 100644 --- a/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L2_metric_plane_proxy.h +++ b/Surface_mesh_approximation/include/CGAL/Surface_mesh_approximation/L2_metric_plane_proxy.h @@ -125,7 +125,7 @@ public: CGAL_assertion(!faces.empty()); std::list tris; - for(const face_descriptor f : faces) { + for(const face_descriptor& f : faces) { const halfedge_descriptor he = halfedge(f, *m_tm); const Point_3 &p0 = m_vpmap[source(he, *m_tm)]; const Point_3 &p1 = m_vpmap[target(he, *m_tm)]; diff --git a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h index 59a85d361a5..53e6e4867f0 100644 --- a/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h +++ b/Surface_mesh_approximation/include/CGAL/Variational_shape_approximation.h @@ -1552,7 +1552,7 @@ private: std::cerr << "#chord_anchor " << m_bcycles.back().num_anchors << std::endl; #endif - for(const halfedge_descriptor he : chord) + for(const halfedge_descriptor& he : chord) he_candidates.erase(he); } while (he_start != he_mark); } @@ -1600,7 +1600,7 @@ private: FT dist_max(0.0); chord_vec = scale_functor(chord_vec, FT(1.0) / CGAL::approximate_sqrt(chord_vec.squared_length())); - for(const halfedge_descriptor he : chord) { + for(const halfedge_descriptor& he : chord) { Vector_3 vec = vector_functor(pt_begin, m_vpoint_map[target(he, *m_ptm)]); vec = cross_product_functor(chord_vec, vec); const FT dist = CGAL::approximate_sqrt(vec.squared_length()); @@ -1612,7 +1612,7 @@ private: } else { FT dist_max(0.0); - for(const halfedge_descriptor he : chord) { + for(const halfedge_descriptor& he : chord) { const FT dist = CGAL::approximate_sqrt(CGAL::squared_distance( pt_begin, m_vpoint_map[target(he, *m_ptm)])); if (dist > dist_max) { diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp index 4b8fe1e65d4..186048d8631 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_metric_test.cpp @@ -46,7 +46,7 @@ struct Compact_metric_point_proxy { // fitting center Vector_3 center = CGAL::NULL_VECTOR; FT sum_areas = FT(0.0); - for(const face_descriptor f : faces) { + for(const face_descriptor& f : faces) { center = center + (center_pmap[f] - CGAL::ORIGIN) * area_pmap[f]; sum_areas += area_pmap[f]; } diff --git a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp index 4e7411f1921..f1d10a9a57c 100644 --- a/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp +++ b/Surface_mesh_approximation/test/Surface_mesh_approximation/vsa_teleportation_test.cpp @@ -104,7 +104,7 @@ int main() CGAL::Bbox_3 bbox; - for(const vertex_descriptor v : vertices(mesh)) + for(const vertex_descriptor& v : vertices(mesh)) bbox += vpmap[v].bbox(); const FT ymin = bbox.ymin(), ymax = bbox.ymax(), yrange = ymax - ymin; std::cout << "Range along y axis: [" << ymin << ", " << ymax << "]" << std::endl; @@ -113,7 +113,7 @@ int main() std::size_t planar_pxidx = static_cast(-1); std::size_t num_planar_faces = 0; bool first = true; - for(const face_descriptor f : faces(mesh)) { + for(const face_descriptor& f : faces(mesh)) { const halfedge_descriptor he = halfedge(f, mesh); const Point_3 &p0 = vpmap[source(he, mesh)]; const Point_3 &p1 = vpmap[target(he, mesh)];