From dccb3ddd5fd7180e82ae7ce96f1e0d5a17aa240d Mon Sep 17 00:00:00 2001 From: Julian Komaromy Date: Mon, 2 Aug 2021 15:53:42 +0200 Subject: [PATCH] change classic plane to use functions --- .../Edge_collapse/GarlandHeckbert_policies.h | 36 ++++++++++++++++--- .../internal/GarlandHeckbert_functions.h | 3 +- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_policies.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_policies.h index 1136d5c9da5..03fec0064d7 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_policies.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/GarlandHeckbert_policies.h @@ -16,9 +16,8 @@ #include #include -#include +#include #include -#include #include @@ -29,9 +28,6 @@ namespace Surface_mesh_simplification { // takes the derived class as template argument - see "CRTP" template class GarlandHeckbert_policies : - public internal::GarlandHeckbert_plane_edges, - public internal::GarlandHeckbert_plane_faces, - public internal::GarlandHeckbert_singular_optimizer, public internal::GarlandHeckbert_placement_base< typename boost::property_map< TriangleMesh, @@ -93,10 +89,40 @@ class GarlandHeckbert_policies : Cost_base::init_vcm(vcm_); Placement_base::init_vcm(vcm_); } + + template + Mat_4 construct_quadric_from_face( + const VertexPointMap& point_map, + const TriangleMesh& tmesh, + typename boost::graph_traits::face_descriptor f, + const GeomTraits& gt) const + { + return internal::construct_classic_plane_quadric_from_face( + point_map, tmesh, f, gt); + } + + template + Mat_4 construct_quadric_from_edge( + const VertexPointMap& point_map, + const TriangleMesh& tmesh, + typename boost::graph_traits::halfedge_descriptor he, + const GeomTraits& gt) const + { + return internal::construct_classic_plane_quadric_from_edge( + point_map, tmesh, he, gt); + } + + Col_4 construct_optimal_point(const Mat_4& quadric, const Col_4& p0, const Col_4& p1) const + { + return internal::construct_optimal_point_singular(quadric, p0, p1); + } const Get_cost& get_cost() const { return *this; } const Get_placement& get_placement() const { return *this; } + // return a copy of the vertex cost map to inspect quadrics + Vertex_cost_map get_vcm() const { return vcm_; } + private: Vertex_cost_map vcm_; diff --git a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_functions.h b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_functions.h index db813e129b9..11dd29f5661 100644 --- a/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_functions.h +++ b/Surface_mesh_simplification/include/CGAL/Surface_mesh_simplification/Policies/Edge_collapse/internal/GarlandHeckbert_functions.h @@ -185,7 +185,8 @@ Mat_4 construct_classic_plane_quadric_from_face( typename boost::graph_traits::face_descriptor f, const GeomTraits& gt) { - const Vector_3 normal = construct_unit_normal_from(point_map, mesh, f, gt); + const typename GeomTraits::Vector_3 normal + = construct_unit_normal_from_face(point_map, mesh, f, gt); // get any point of the face const auto p = get(point_map, source(halfedge(f, mesh), mesh));