From 16da969e88cf9ca926de63c40a1d21fea550d5f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 17:06:22 +0100 Subject: [PATCH 1/3] Use OpenMesh::DefaultTraitsDouble directly instead of using custom traits --- .../Linear_cell_complex_2/openmesh_performance.h | 11 +---------- .../Cactus_deformation_session_OpenMesh.cpp | 15 ++++----------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h b/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h index 71ff72ea813..afdb700c75b 100644 --- a/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h +++ b/Linear_cell_complex/benchmark/Linear_cell_complex_2/openmesh_performance.h @@ -22,19 +22,10 @@ public: mesh.request_face_normals(); } - private: - - struct MyTraits : public OpenMesh::DefaultTraits - { - typedef OpenMesh::Vec3d Point; - typedef OpenMesh::Vec3d Normal; - }; - - typedef OpenMesh::TriMesh_ArrayKernelT Mesh; + typedef OpenMesh::TriMesh_ArrayKernelT Mesh; Mesh mesh; - private: void display_info() { diff --git a/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp b/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp index fe1aded57c0..06817a78b71 100644 --- a/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp +++ b/Surface_mesh_deformation/test/Surface_mesh_deformation/Cactus_deformation_session_OpenMesh.cpp @@ -13,17 +13,10 @@ #include -struct DoubleTraits : public OpenMesh::DefaultTraits -{ - typedef OpenMesh::Vec3d Point; - typedef OpenMesh::Vec3d Normal; -}; - - -typedef OpenMesh::PolyMesh_ArrayKernelT Mesh; -typedef Mesh::Point Point; -typedef boost::graph_traits::vertex_descriptor vertex_descriptor; -typedef boost::graph_traits::vertex_iterator vertex_iterator; +typedef OpenMesh::PolyMesh_ArrayKernelT Mesh; +typedef Mesh::Point Point; +typedef boost::graph_traits::vertex_descriptor vertex_descriptor; +typedef boost::graph_traits::vertex_iterator vertex_iterator; typedef CGAL::Surface_mesh_deformation Deform_mesh_arap; typedef CGAL::Surface_mesh_deformation Deform_mesh_spoke; From adb10155fcc87552897a2ba1d245c768d932ec77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 17:22:05 +0100 Subject: [PATCH 2/3] Use kernel traits to adapt put() to point coordinates type --- BGL/include/CGAL/boost/graph/properties_OpenMesh.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h index 7f1d44979d1..6b2e69c1bb2 100644 --- a/BGL/include/CGAL/boost/graph/properties_OpenMesh.h +++ b/BGL/include/CGAL/boost/graph/properties_OpenMesh.h @@ -13,6 +13,8 @@ #include #include #include +#include + #include #ifndef OPEN_MESH_CLASS @@ -231,8 +233,8 @@ public: #if defined(CGAL_USE_OM_POINTS) const_cast(*pm.sm_).set_point(v,p); #else - const_cast(*pm.sm_).set_point - (v, typename OpenMesh::Point((float)p[0], (float)p[1], (float)p[2])); + typedef typename CGAL::Kernel_traits::type FT; + const_cast(*pm.sm_).set_point(v, typename OpenMesh::Point(FT(p[0]), FT(p[1]), FT(p[2]))); #endif } From 3abb7366d5a5704a1e69cbb0eb15b9f2c5b67f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Tue, 22 Nov 2022 17:46:01 +0100 Subject: [PATCH 3/3] Try to fix compatibility between Weights and OpenMesh --- .../include/CGAL/Weights/cotangent_weights.h | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Weights/include/CGAL/Weights/cotangent_weights.h b/Weights/include/CGAL/Weights/cotangent_weights.h index ba128a98502..dc070c5c493 100644 --- a/Weights/include/CGAL/Weights/cotangent_weights.h +++ b/Weights/include/CGAL/Weights/cotangent_weights.h @@ -193,6 +193,9 @@ public: // Surface_mesh_deformation -> Surface_mesh_deformation.h (default version) // Surface_mesh_parameterizer -> Orbifold_Tutte_parameterizer_3.h (default version) // Surface_mesh_skeletonization -> Mean_curvature_flow_skeletonization.h (clamped version) +// +// The API is a bit awkward: the template parameters VertexPointMap and GeomTraits +// are only meaningful in the API that calls the operator with a single parameter. template::type, typename GeomTraits = typename Kernel_traits< @@ -202,8 +205,6 @@ class Cotangent_weight using vertex_descriptor = typename boost::graph_traits::vertex_descriptor; using halfedge_descriptor = typename boost::graph_traits::halfedge_descriptor; - using FT = typename GeomTraits::FT; - private: // These class members are used only when the constructor initializing them // is used, but Surface_mesh_deformation has its own weight API locked @@ -224,12 +225,14 @@ public: // Common API whether mesh/vpm/traits are initialized in the constructor, // or passed in the operator() template - FT operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, - const VPM vpm, - const GT& traits) const + typename GT::FT + operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm, + const GT& traits) const { using Point_ref = typename boost::property_traits::reference; + using FT = typename GT::FT; if(is_border(he, pmesh)) return FT{0}; @@ -265,9 +268,10 @@ public: // That is the API called by Surface_mesh_deformation template - FT operator()(const halfedge_descriptor he, - const PolygonMesh& pmesh, - const VPM vpm) const + auto // kernel_traits::type::FT + operator()(const halfedge_descriptor he, + const PolygonMesh& pmesh, + const VPM vpm) const { using Point = typename boost::property_traits::value_type; using GT = typename Kernel_traits::type; @@ -286,7 +290,7 @@ public: m_bound_from_below(bound_from_below) { } - FT operator()(const halfedge_descriptor he) const + typename GeomTraits::FT operator()(const halfedge_descriptor he) const { CGAL_precondition(m_pmesh_ptr != nullptr); return this->operator()(he, *m_pmesh_ptr, m_vpm, m_traits);