Drop-in for as_ray_parameter

This needs to be replaced with a non-hacky solution.
This commit is contained in:
Philipp Möller 2015-10-27 11:58:28 +01:00 committed by Sébastien Loriot
parent 5e6ae0f29d
commit 2540612e97
2 changed files with 13 additions and 2 deletions

View File

@ -167,6 +167,8 @@ class AABB_traits:
{
typedef typename CGAL::Object Object;
public:
typedef GeomTraits Geom_traits;
typedef AABB_traits<GeomTraits, AABBPrimitive> AT;
// AABBTraits concept types
typedef typename GeomTraits::FT FT;

View File

@ -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<typename Ray>
FT as_ray_parameter(const Ray& ray,
const typename AABBTree::template Intersection_and_primitive_id<Ray>::Type& intersection) {
return 0;
const typename AABBTree::template Intersection_and_primitive_id<Ray>::Type& intersection)
const {
// TODO replace with non-hacky solution
if(const Point* point = boost::get<const Point>(&(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;
}
}
};