From 2540612e970082f0c743cc41eba5a985d9ce797a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20M=C3=B6ller?= Date: Tue, 27 Oct 2015 11:58:28 +0100 Subject: [PATCH] Drop-in for as_ray_parameter This needs to be replaced with a non-hacky solution. --- AABB_tree/include/CGAL/AABB_traits.h | 2 ++ .../CGAL/internal/AABB_tree/AABB_ray_intersection.h | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/AABB_tree/include/CGAL/AABB_traits.h b/AABB_tree/include/CGAL/AABB_traits.h index 3acae760889..6a421a60758 100644 --- a/AABB_tree/include/CGAL/AABB_traits.h +++ b/AABB_tree/include/CGAL/AABB_traits.h @@ -167,6 +167,8 @@ class AABB_traits: { typedef typename CGAL::Object Object; public: + typedef GeomTraits Geom_traits; + typedef AABB_traits AT; // AABBTraits concept types typedef typename GeomTraits::FT FT; diff --git a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h index f54c0e9c460..a8c18388636 100644 --- a/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h +++ b/AABB_tree/include/CGAL/internal/AABB_tree/AABB_ray_intersection.h @@ -127,6 +127,7 @@ public: private: const AABBTree& tree_; typedef typename AABBTree::AABB_traits AABB_traits; + typedef typename AABBTree::Point Point; typedef typename AABBTree::FT FT; typedef typename AABBTree::Node Node; typedef typename AABBTree::size_type size_type; @@ -143,8 +144,16 @@ private: template FT as_ray_parameter(const Ray& ray, - const typename AABBTree::template Intersection_and_primitive_id::Type& intersection) { - return 0; + const typename AABBTree::template Intersection_and_primitive_id::Type& intersection) + const { + // TODO replace with non-hacky solution + if(const Point* point = boost::get(&(intersection.first))) { + typename AABB_traits::Geom_traits::Vector_3 distance_ray(*point, ray.source()); + return distance_ray.squared_length(); + } else { + std::cout << "not handled" << std::endl; + return 0; + } } };