1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75
|
// Copyright (c) 1997-2021
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel).
// GeometryFactory (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org)
//
// $URL: https://github.com/CGAL/cgal/blob/v6.1.1/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h $
// $Id: include/CGAL/Intersections_3/Bbox_3_Point_3.h 08b27d3db14 $
// SPDX-License-Identifier: LGPL-3.0-or-later OR LicenseRef-Commercial
//
//
// Author(s) : Sebastien Loriot
//
#ifndef CGAL_INTERSECTIONS_3_BBOX_3_POINT_3_H
#define CGAL_INTERSECTIONS_3_BBOX_3_POINT_3_H
#include <CGAL/Intersection_traits_3.h>
#include <CGAL/Intersections_3/Iso_cuboid_3_Point_3.h>
#include <CGAL/Bbox_3.h>
#include <CGAL/Iso_cuboid_3.h>
#include <CGAL/Point_3.h>
namespace CGAL {
template<typename K>
typename K::Boolean
do_intersect(const CGAL::Bbox_3& box,
const Point_3<K>& p)
{
Point_3<K> bl(box.xmin(), box.ymin(), box.zmin()),
tr(box.xmax(), box.ymax(), box.zmax());
Iso_cuboid_3<K> ic(bl, tr);
return K().do_intersect_3_object()(ic, p);
}
template<typename K>
typename K::Boolean
do_intersect(const Point_3<K>& a,
const CGAL::Bbox_3& b)
{
return do_intersect(b,a);
}
template<typename K>
typename Intersection_traits<K, typename K::Point_3, CGAL::Bbox_3>::result_type
intersection(const Point_3<K>& p,
const CGAL::Bbox_3& box)
{
if(do_intersect(p, box))
return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>(p);
return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>();
}
template<typename K>
typename Intersection_traits<K, CGAL::Bbox_3, typename K::Point_3>::result_type
intersection(const CGAL::Bbox_3& box,
const Point_3<K>& p)
{
if(do_intersect(box, p))
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>(p);
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>();
}
} // namespace CGAL
#endif // CGAL_INTERSECTIONS_3_BBOX_3_POINT_3_H
|