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_2/include/CGAL/Intersections_2/Circle_2_Point_2.h $
7 // $Id: Circle_2_Point_2.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_2_POINT_2_CIRCLE_2_H
14 #define CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H
15
16 #include <CGAL/Circle_2.h>
17 #include <CGAL/Point_2.h>
18 #include <CGAL/Intersection_traits_2.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_2 & pt,const typename K::Circle_2 & circle,const K &)29 do_intersect(const typename K::Point_2 &pt,
30 const typename K::Circle_2 &circle,
31 const K&)
32 {
33 return circle.has_on_boundary(pt);
34 }
35
36
37 template <class K>
38 inline
39 bool
do_intersect(const typename K::Circle_2 & circle,const typename K::Point_2 & pt,const K &)40 do_intersect(const typename K::Circle_2 &circle,
41 const typename K::Point_2 &pt,
42 const K&)
43 {
44 return circle.has_on_boundary(pt);
45 }
46
47
48 template <class K>
49 typename CGAL::Intersection_traits
50 <K, typename K::Point_2, typename K::Circle_2>::result_type
intersection(const typename K::Point_2 & pt,const typename K::Circle_2 & circle,const K & k)51 intersection(const typename K::Point_2 &pt,
52 const typename K::Circle_2 &circle,
53 const K& k)
54 {
55 if (do_intersect(pt,circle, k))
56 return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>(pt);
57 return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>();
58 }
59
60 template <class K>
61 typename CGAL::Intersection_traits
62 <K, typename K::Circle_2, typename K::Point_2>::result_type
intersection(const typename K::Circle_2 & circle,const typename K::Point_2 & pt,const K & k)63 intersection(const typename K::Circle_2 &circle,
64 const typename K::Point_2 &pt,
65 const K& k)
66 {
67 return internal::intersection(pt, circle, k);
68 }
69
70 } // namespace internal
71 } // namespace Intersections
72
73 CGAL_INTERSECTION_FUNCTION(Point_2, Circle_2, 2)
74 CGAL_DO_INTERSECT_FUNCTION(Circle_2, Point_2, 2)
75
76 } //namespace CGAL
77 #endif // CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H
78