From 54eb83f080e448096275fe22f468183c1c466622 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 14 Nov 2024 13:30:19 +0100 Subject: [PATCH] CGAL 6 compatibility regarding aabb_traits_3 and stdlib usage --- src/ifcconvert/validation_utils.h | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/ifcconvert/validation_utils.h b/src/ifcconvert/validation_utils.h index c8801d6537..c6952324a0 100644 --- a/src/ifcconvert/validation_utils.h +++ b/src/ifcconvert/validation_utils.h @@ -8,13 +8,23 @@ #include #include +#if CGAL_VERSION_NR >= 1060000000 +#include +#else #include +#endif #include #include #include #include +#if CGAL_VERSION_NR >= 1060000000 +#define variant_get std::get_if +#else +#define variant_get boost::get +#endif + template T enlarge(const T& t, double d = 1.e-5) { typename T::NT min[3]; @@ -163,8 +173,12 @@ struct remove_thickness { typedef CGAL::Polyhedron_3 Polyhedron; typedef CGAL::AABB_face_graph_triangle_primitive Primitive; - typedef CGAL::AABB_traits Traits; - typedef CGAL::AABB_tree Tree; +#if CGAL_VERSION_NR >= 1060000000 + typedef CGAL::AABB_traits_3 AAbbTraits; +#else + typedef CGAL::AABB_traits AAbbTraits; +#endif + typedef CGAL::AABB_tree Tree; typedef boost::optional::Type> Ray_intersection; cgal_shape_t polyhedron, polyhedron2, flattened; @@ -223,8 +237,8 @@ struct remove_thickness { double N = std::numeric_limits::infinity(); Point P; for (auto& intersection : intersections) { - if (boost::get(&(intersection->first))) { - const Point* p = boost::get(&(intersection->first)); + if (variant_get(&(intersection->first))) { + const Point* p = variant_get(&(intersection->first)); const double d = std::sqrt(CGAL::to_double((*p - O).squared_length())); if (d > 1.e-20 && d < N) { N = d; @@ -354,8 +368,8 @@ struct remove_thickness { if (intersections.size()) { for (auto& intersection : intersections) { - if (boost::get(&(intersection->first))) { - const Point* p = boost::get(&(intersection->first)); + if (variant_get(&(intersection->first))) { + const Point* p = variant_get(&(intersection->first)); const double d = std::sqrt(CGAL::to_double((*p - O).squared_length())); if (d < N && d > 1.e-20) { N = d;