Add missing free function for Bbox_2 Point_2 intersection

This commit is contained in:
Mael Rouxel-Labbé 2019-05-17 12:15:22 +02:00
parent 80d1f3f18a
commit 58c894ed5e
1 changed files with 35 additions and 20 deletions

View File

@ -29,29 +29,29 @@
#include <CGAL/Intersections_2/Iso_rectangle_2_Point_2.h>
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_2& a,
const Point_2<K>& b)
{
Point_2<K> bl(a.xmin(), a.ymin()), tr(a.xmax(), a.ymax());
Iso_rectangle_2<K> ic(bl,tr);
return K().do_intersect_2_object()(ic, b);
}
template<typename K>
bool do_intersect(const Point_2<K>& a,
const CGAL::Bbox_2& b)
{
return do_intersect(b,a);
}
namespace Intersections {
namespace internal {
template <class K>
inline bool do_intersect(const Bbox_2 &bbox,
const Point_2<K> &pt,
const K& k)
{
Point_2<K> bl(bbox.xmin(), bbox.ymin()),
tr(bbox.xmax(), bbox.ymax());
Iso_rectangle_2<K> ic(bl,tr);
return k.do_intersect_2_object()(ic, pt);
}
template <class K>
inline bool do_intersect(const Point_2<K> &pt,
const Bbox_2& bbox,
const K& k)
{
return do_intersect(bbox, pt, k);
}
template<typename K>
typename CGAL::Intersection_traits<K, typename K::Point_2, CGAL::Bbox_2>::result_type
intersection(const Point_2<K>& a,
@ -77,6 +77,20 @@ intersection(const CGAL::Bbox_2& b,
} // namespace internal
} // namespace Intersections
template<typename K>
bool do_intersect(const CGAL::Bbox_2& a,
const Point_2<K>& b)
{
return Intersections::internal::do_intersect(a,b,K());
}
template<typename K>
bool do_intersect(const Point_2<K>& a,
const CGAL::Bbox_2& b)
{
return Intersections::internal::do_intersect(b,a,K());
}
template<typename K>
typename CGAL::Intersection_traits<K, Bbox_2, Point_2<K> >::result_type
intersection(const Bbox_2& b,
@ -92,6 +106,7 @@ typename CGAL::Intersection_traits<K, Bbox_2, Point_2<K> >::result_type
{
return Intersections::internal::intersection(b,a,K());
}
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_2_BBOX_2_POINT_2_H