1 // Copyright (c) 2008 ETH Zurich (Switzerland) 2 // Copyright (c) 2008-2009 INRIA Sophia-Antipolis (France) 3 // All rights reserved. 4 // 5 // This file is part of CGAL (www.cgal.org) 6 // 7 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h $ 8 // $Id: Bbox_3_Ray_3_do_intersect.h 0779373 2020-03-26T13:31:46+01:00 Sébastien Loriot 9 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial 10 // 11 // 12 // Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez, Stephane Tayeb 13 14 #ifndef CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H 15 #define CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H 16 17 #include <CGAL/Ray_3.h> 18 #include <CGAL/Bbox_3.h> 19 20 #include <CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h> 21 // for CGAL::internal::do_intersect_bbox_segment_aux 22 23 // inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf 24 25 namespace CGAL { 26 27 namespace Intersections { 28 29 namespace internal { 30 31 template <class K> do_intersect(const typename K::Ray_3 & ray,const CGAL::Bbox_3 & bbox,const K &)32 bool do_intersect(const typename K::Ray_3& ray, 33 const CGAL::Bbox_3& bbox, 34 const K&) 35 { 36 typedef typename K::FT FT; 37 typedef typename K::Point_3 Point_3; 38 39 const Point_3& source = ray.source(); 40 const Point_3& point_on_ray = ray.second_point(); 41 42 return do_intersect_bbox_segment_aux 43 <FT, 44 true, // bounded at t=0 45 false, // not bounded at t=1 46 false> // do not use static filters 47 ( 48 source.x(), source.y(), source.z(), 49 point_on_ray.x(), point_on_ray.y(), point_on_ray.z(), 50 bbox 51 ); 52 } 53 54 template <class K> do_intersect(const CGAL::Bbox_3 & bbox,const typename K::Ray_3 & ray,const K &)55 bool do_intersect(const CGAL::Bbox_3& bbox, 56 const typename K::Ray_3& ray, 57 const K&) { 58 return do_intersect(ray, bbox, K()); 59 } 60 61 } // namespace internal 62 } // namespace Intersections 63 } //namespace CGAL 64 65 #endif // CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H 66