1 // Copyright (c) 2018 INRIA Sophia-Antipolis (France).
2 // All rights reserved.
3 //
4 // This file is part of CGAL (www.cgal.org)
5 //
6 // $URL: https://github.com/CGAL/cgal/blob/v5.3/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h $
7 // $Id: Point_3_Tetrahedron_3.h 52164b1 2019-10-19T15:34:59+02:00 Sébastien Loriot
8 // SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
9 //
10 //
11 // Author(s) : Maxime Gimeno
12
13 #ifndef CGAL_INTERSECTIONS_3_POINT_3_TETRAHEDRON_3_H
14 #define CGAL_INTERSECTIONS_3_POINT_3_TETRAHEDRON_3_H
15
16 #include <CGAL/Tetrahedron_3.h>
17 #include <CGAL/Point_3.h>
18 #include <CGAL/Intersection_traits_3.h>
19
20 namespace CGAL {
21
22 namespace Intersections {
23
24 namespace internal {
25
26 template <class K>
27 inline
28 bool
do_intersect(const typename K::Point_3 & pt,const typename K::Tetrahedron_3 & tetrahedron,const K &)29 do_intersect(const typename K::Point_3 &pt,
30 const typename K::Tetrahedron_3 &tetrahedron,
31 const K&)
32 {
33 return ! tetrahedron.has_on_unbounded_side(pt);
34 }
35
36
37 template <class K>
38 inline
39 bool
do_intersect(const typename K::Tetrahedron_3 & tetrahedron,const typename K::Point_3 & pt,const K &)40 do_intersect(const typename K::Tetrahedron_3 &tetrahedron,
41 const typename K::Point_3 &pt,
42 const K&)
43 {
44 return ! tetrahedron.has_on_unbounded_side(pt);
45 }
46
47
48 template <class K>
49 typename CGAL::Intersection_traits
50 <K, typename K::Point_3, typename K::Tetrahedron_3>::result_type
intersection(const typename K::Point_3 & pt,const typename K::Tetrahedron_3 & tetrahedron,const K & k)51 intersection(const typename K::Point_3 &pt,
52 const typename K::Tetrahedron_3 &tetrahedron,
53 const K& k)
54 {
55 if (do_intersect(pt,tetrahedron, k))
56 return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>(pt);
57 return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>();
58 }
59
60 template <class K>
61 typename CGAL::Intersection_traits
62 <K, typename K::Tetrahedron_3, typename K::Point_3>::result_type
intersection(const typename K::Tetrahedron_3 & tetrahedron,const typename K::Point_3 & pt,const K & k)63 intersection(const typename K::Tetrahedron_3 &tetrahedron,
64 const typename K::Point_3 &pt,
65 const K& k)
66 {
67 return internal::intersection(pt, tetrahedron, k);
68 }
69
70 } // namespace internal
71 } // namespace Intersections
72
73 CGAL_INTERSECTION_FUNCTION(Point_3, Tetrahedron_3, 3)
74 CGAL_DO_INTERSECT_FUNCTION(Point_3, Tetrahedron_3, 3)
75
76
77 } //namespace CGAL
78 #endif // CGAL_INTERSECTIONS_3_POINT_3_TETRAHEDRON_3_H
79