From aa12591bc3a33b56db23c16627d4c15400c31d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 16 May 2023 15:48:50 +0200 Subject: [PATCH 1/5] Use VPM's reference --- .../CGAL/Polygon_mesh_processing/internal/refine_impl.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h index 06ddc868f0d..98a80e05a8e 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/refine_impl.h @@ -42,6 +42,8 @@ template class Refine_Polyhedron_3 { //// typedefs typedef typename boost::property_traits::value_type Point_3; + typedef typename boost::property_traits::reference Point_3_ref; + typedef typename boost::graph_traits::vertex_descriptor vertex_descriptor; typedef typename boost::graph_traits::halfedge_descriptor halfedge_descriptor; typedef typename boost::graph_traits::face_descriptor face_descriptor; @@ -88,7 +90,6 @@ private: bool relax(halfedge_descriptor h) { #ifdef CGAL_PMP_REFINE_DEBUG_PP - typedef typename boost::property_traits::reference Point_3_ref; Point_3_ref p = get(vpmap, source(h,pmesh)); Point_3_ref q = get(vpmap, target(h,pmesh)); Point_3_ref r = get(vpmap, target(next(h,pmesh),pmesh)); @@ -227,7 +228,7 @@ private: const std::set& interior_map, bool accept_internal_facets) { - const Point_3& vp = get(vpmap, vh); + const Point_3_ref vp = get(vpmap, vh); Halfedge_around_target_circulator circ(halfedge(vh,pmesh),pmesh), done(circ); int deg = 0; double sum = 0; @@ -239,7 +240,7 @@ private: { continue; } // which means current edge is an interior edge and should not be included in scale attribute calculation } - const Point_3& vq = get(vpmap, target(opposite(*circ,pmesh),pmesh)); + const Point_3_ref vq = get(vpmap, target(opposite(*circ,pmesh),pmesh)); sum += to_double(CGAL::approximate_sqrt(CGAL::squared_distance(vp, vq))); ++deg; } while(++circ != done); From eb1462ea562c7308a83af0c21563e7c60d3bf967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 16 May 2023 15:49:00 +0200 Subject: [PATCH 2/5] Remove needless reference --- .../include/CGAL/Polygon_mesh_processing/locate.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h index 2d5d92374ba..956262a6413 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/locate.h @@ -1666,7 +1666,7 @@ locate_with_AABB_tree(const typename internal::Location_traits::const_type VertexPointMap; typedef internal::Point_to_Point_3_VPM WrappedVPM; - const Point_3& p3 = P_to_P3()(p); + const Point_3 p3 = P_to_P3()(p); typename AABB_tree::Point_and_primitive_id result = tree.closest_point_and_primitive(p3); typedef typename GetGeomTraits::type Geom_traits; @@ -1763,7 +1763,7 @@ locate(const typename internal::Location_traits:: AABB_tree tree; build_AABB_tree(tm, tree, parameters::vertex_point_map(wrapped_vpm)); - const Point_3& p3 = P_to_P3()(p); + const Point_3 p3 = P_to_P3()(p); return locate_with_AABB_tree(p3, tree, tm, parameters::vertex_point_map(wrapped_vpm)); } From 752aa944907cbadf4317c1a0601a1b3a705acd57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 16 May 2023 15:49:18 +0200 Subject: [PATCH 3/5] Properly initialize kernel functors --- .../CGAL/Polygon_mesh_processing/measure.h | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h index ac5a340d816..468896b5a98 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/measure.h @@ -857,34 +857,38 @@ centroid(const TriangleMesh& tmesh, Vpm vpm = choose_parameter(get_parameter(np, internal_np::vertex_point), get_const_property_map(CGAL::vertex_point, tmesh)); - typedef typename GetGeomTraits::type Kernel; - typedef typename Kernel::Point_3 Point_3; + typedef typename GetGeomTraits::type Kernel; + Kernel k = choose_parameter(get_parameter(np, internal_np::geom_traits)); + + typedef typename Kernel::FT FT; + typedef typename boost::property_traits::reference Point_3_ref; typedef typename Kernel::Vector_3 Vector_3; + typedef typename Kernel::Construct_translated_point_3 Construct_translated_point_3; typedef typename Kernel::Construct_vector_3 Construct_vector_3; typedef typename Kernel::Construct_normal_3 Construct_normal_3; typedef typename Kernel::Compute_scalar_product_3 Scalar_product; typedef typename Kernel::Construct_scaled_vector_3 Scale; typedef typename Kernel::Construct_sum_of_vectors_3 Sum; + typedef typename boost::graph_traits::face_descriptor face_descriptor; - typedef typename Kernel::FT FT; FT volume = 0; Vector_3 centroid(NULL_VECTOR); - Construct_translated_point_3 point; - Construct_vector_3 vector; - Construct_normal_3 normal; - Scalar_product scalar_product; - Scale scale; - Sum sum; + Construct_translated_point_3 point = k.construct_translated_point_3_object(); + Construct_vector_3 vector = k.construct_vector_3_object(); + Construct_normal_3 normal = k.construct_normal_3_object(); + Scalar_product scalar_product = k.compute_scalar_product_3_object(); + Scale scale = k.construct_scaled_vector_3_object(); + Sum sum = k.construct_sum_of_vectors_3_object(); for(face_descriptor fd : faces(tmesh)) { - const Point_3& p = get(vpm, target(halfedge(fd, tmesh), tmesh)); - const Point_3& q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh)); - const Point_3& r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh)); + const Point_3_ref p = get(vpm, target(halfedge(fd, tmesh), tmesh)); + const Point_3_ref q = get(vpm, target(next(halfedge(fd, tmesh), tmesh), tmesh)); + const Point_3_ref r = get(vpm, target(prev(halfedge(fd, tmesh), tmesh), tmesh)); Vector_3 vp = vector(ORIGIN, p), vq = vector(ORIGIN, q), vr = vector(ORIGIN, r); From cb05427cf38da8d949fe45728f4002d5e50a00f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 16 May 2023 15:49:34 +0200 Subject: [PATCH 4/5] Remove std::move on temporary result --- .../include/CGAL/Polygon_mesh_processing/repair_degeneracies.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h index 798499f430b..40f480cbb7c 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/repair_degeneracies.h @@ -483,7 +483,7 @@ struct Filter_wrapper_for_cap_needle_removal link_faces; collect_link_faces(e, link_faces); - Functor f = std::move(m_make_envelope(link_faces)); + Functor f = m_make_envelope(link_faces); Base base(m_tm, m_vpm, f); return base.collapse(e); } From 0acb4e8fceaf7824eaec2f58f4f3bff950eeca92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 16 May 2023 15:49:49 +0200 Subject: [PATCH 5/5] Add missing closing parenthesis --- .../Surface_mesh_simplification/Surface_mesh_simplification.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt index 31c3939c926..7ca5146ab1f 100644 --- a/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt +++ b/Surface_mesh_simplification/doc/Surface_mesh_simplification/Surface_mesh_simplification.txt @@ -306,7 +306,7 @@ int r = edge_collapse(surface_mesh, stop_predicate, .edge_is_border_map(ebmap) .get_cost(cf) .get_placement(pf) - .filter(filter + .filter(filter) .visitor(vis)); \endcode