fix warning + cosmetic changes

This commit is contained in:
Sébastien Loriot 2018-11-02 14:17:16 +01:00
parent aee51d4b42
commit 057f4eafe7
34 changed files with 300 additions and 324 deletions

View File

@ -41,6 +41,6 @@ bool do_intersect(const Circle_2<K>& a,
const CGAL::Bbox_2& b) { const CGAL::Bbox_2& b) {
return K().do_intersect_2_object()(a, b); return K().do_intersect_2_object()(a, b);
} }
} }
#endif // CGAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_H #endif // CGAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_H

View File

@ -29,20 +29,22 @@
#include <CGAL/Intersections_2/Iso_rectangle_2_Point_2.h> #include <CGAL/Intersections_2/Iso_rectangle_2_Point_2.h>
namespace CGAL { namespace CGAL {
template<typename K> template<typename K>
bool do_intersect(const CGAL::Bbox_2& a, bool do_intersect(const CGAL::Bbox_2& a,
const Point_2<K>& b) { const Point_2<K>& b)
{
Point_2<K> bl(a.xmin(), a.ymin()), tr(a.xmax(), a.ymax()); Point_2<K> bl(a.xmin(), a.ymin()), tr(a.xmax(), a.ymax());
Iso_rectangle_2<K> ic(bl,tr); Iso_rectangle_2<K> ic(bl,tr);
return K().do_intersect_2_object()(ic, b); return K().do_intersect_2_object()(ic, b);
} }
template<typename K> template<typename K>
bool do_intersect(const Point_2<K>& a, bool do_intersect(const Point_2<K>& a,
const CGAL::Bbox_2& b) { const CGAL::Bbox_2& b)
{
return do_intersect(b,a); return do_intersect(b,a);
} }
@ -53,24 +55,23 @@ namespace internal {
template<typename K> template<typename K>
typename CGAL::Intersection_traits<K, typename K::Point_2, CGAL::Bbox_2>::result_type typename CGAL::Intersection_traits<K, typename K::Point_2, CGAL::Bbox_2>::result_type
intersection(const Point_2<K>& a, intersection(const Point_2<K>& a,
const CGAL::Bbox_2& b const CGAL::Bbox_2& b)
) { {
if (do_intersect(a,b)) { if (do_intersect(a,b))
return Intersections::internal::intersection_return<typename K::Intersect_2, typename K::Point_2, CGAL::Bbox_2>(a); return Intersections::internal::intersection_return<typename K::Intersect_2, typename K::Point_2, CGAL::Bbox_2>(a);
} return Intersections::internal::intersection_return<typename K::Intersect_2, typename K::Point_2, CGAL::Bbox_2>();
return Intersections::internal::intersection_return<typename K::Intersect_2, typename K::Point_2, CGAL::Bbox_2>();
} }
template<typename K> template<typename K>
typename CGAL::Intersection_traits<K, CGAL::Bbox_2, typename K::Point_2>::result_type typename CGAL::Intersection_traits<K, CGAL::Bbox_2, typename K::Point_2>::result_type
intersection(const CGAL::Bbox_2& b, intersection(const CGAL::Bbox_2& b,
const typename K::Point_2 & a, const typename K::Point_2 & a,
const K& k ) { const K& /*k*/ )
if (do_intersect(a,b)) { {
return Intersections::internal::intersection_return<typename K::Intersect_2, CGAL::Bbox_2, typename K::Point_2>(a); if (do_intersect(a,b))
} return Intersections::internal::intersection_return<typename K::Intersect_2, CGAL::Bbox_2, typename K::Point_2>(a);
return Intersections::internal::intersection_return<typename K::Intersect_2, CGAL::Bbox_2, typename K::Point_2>(); return Intersections::internal::intersection_return<typename K::Intersect_2, CGAL::Bbox_2, typename K::Point_2>();
} }
} // namespace internal } // namespace internal
@ -78,12 +79,13 @@ intersection(const CGAL::Bbox_2& b,
template<typename K> template<typename K>
typename CGAL::Intersection_traits<K, Bbox_2, Point_2<K> >::result_type typename CGAL::Intersection_traits<K, Bbox_2, Point_2<K> >::result_type
intersection(const Bbox_2& b, intersection(const Bbox_2& b,
const Point_2<K> & a) const Point_2<K> & a)
{ {
return Intersections::internal::intersection(b,a,K()); return Intersections::internal::intersection(b,a,K());
} }
template<typename K>
template<typename K>
typename CGAL::Intersection_traits<K, Bbox_2, Point_2<K> >::result_type typename CGAL::Intersection_traits<K, Bbox_2, Point_2<K> >::result_type
intersection(const Point_2<K> & a, intersection(const Point_2<K> & a,
const Bbox_2& b) const Bbox_2& b)

View File

@ -28,11 +28,8 @@
#include <CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h> #include <CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h>
namespace CGAL { namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Iso_rectangle_2, Circle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Iso_rectangle_2, Circle_2, 2)
} }
#endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_CIRCLE_2_H #endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_CIRCLE_2_H

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_2.h> #include <CGAL/Intersection_traits_2.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -61,9 +61,8 @@ intersection(const typename K::Point_2 &pt,
const typename K::Circle_2 &circle, const typename K::Circle_2 &circle,
const K& k) const K& k)
{ {
if (do_intersect(pt,circle, k)) { if (do_intersect(pt,circle, k))
return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>(pt); return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>(pt);
}
return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>(); return intersection_return<typename K::Intersect_2, typename K::Point_2, typename K::Circle_2>();
} }
@ -79,7 +78,7 @@ intersection(const typename K::Circle_2 &circle,
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_2, Circle_2, 2) CGAL_INTERSECTION_FUNCTION(Point_2, Circle_2, 2)
CGAL_DO_INTERSECT_FUNCTION(Circle_2, Point_2, 2) CGAL_DO_INTERSECT_FUNCTION(Circle_2, Point_2, 2)

View File

@ -15,7 +15,7 @@
// $URL$ // $URL$
// $Id$ // $Id$
// SPDX-License-Identifier: LGPL-3.0+ // SPDX-License-Identifier: LGPL-3.0+
// //
// //
// Author(s) : Andreas Fabri // Author(s) : Andreas Fabri
@ -30,80 +30,80 @@
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K, class Box3> template <class K, class Box3>
bool do_intersect_circle_box_2(const typename K::Circle_2& circle, bool do_intersect_circle_box_2(const typename K::Circle_2& circle,
const Box3& bbox, const Box3& bbox,
const K&) const K&)
{ {
typedef typename K::FT FT; typedef typename K::FT FT;
typedef typename K::Point_2 Point; typedef typename K::Point_2 Point;
FT d = FT(0); FT d = FT(0);
FT distance = FT(0); FT distance = FT(0);
Point center = circle.center(); Point center = circle.center();
if(center.x() < (FT)bbox.xmin())
{
d = (FT)bbox.xmin() - center.x();
distance += d * d;
}
else if(center.x() > (FT)bbox.xmax())
{
d = center.x() - (FT)bbox.xmax();
distance += d * d;
}
if(center.y() < (FT)bbox.ymin())
{
d = (FT)bbox.ymin() - center.y();
distance += d * d;
}
else if(center.y() > (FT)bbox.ymax())
{
d = center.y() - (FT)bbox.ymax();
distance += d * d;
}
return distance <= circle.squared_radius(); if(center.x() < (FT)bbox.xmin())
{
d = (FT)bbox.xmin() - center.x();
distance += d * d;
}
else if(center.x() > (FT)bbox.xmax())
{
d = center.x() - (FT)bbox.xmax();
distance += d * d;
} }
template <class K> if(center.y() < (FT)bbox.ymin())
bool do_intersect(const CGAL::Bbox_2& bbox, {
const typename K::Circle_2& circle, d = (FT)bbox.ymin() - center.y();
const K&) distance += d * d;
{ }
return do_intersect_circle_box_2(circle, bbox, K()); else if(center.y() > (FT)bbox.ymax())
} {
d = center.y() - (FT)bbox.ymax();
distance += d * d;
}
return distance <= circle.squared_radius();
template <class K> }
bool do_intersect(const typename K::Circle_2& circle,
const CGAL::Bbox_2& bbox,
const K&)
{
return do_intersect_circle_box_2(circle, bbox, K());
}
template <class K>
bool do_intersect(const typename K::Iso_rectangle_2& bbox,
const typename K::Circle_2& circle,
const K&)
{
return do_intersect_circle_box_2(circle, bbox, K());
}
template <class K>
template <class K> bool do_intersect(const CGAL::Bbox_2& bbox,
bool do_intersect(const typename K::Circle_2& circle, const typename K::Circle_2& circle,
const typename K::Iso_rectangle_2& bbox, const K&)
const K&) {
{ return do_intersect_circle_box_2(circle, bbox, K());
return do_intersect_circle_box_2(circle, bbox, K()); }
}
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
const CGAL::Bbox_2& bbox,
const K&)
{
return do_intersect_circle_box_2(circle, bbox, K());
}
template <class K>
bool do_intersect(const typename K::Iso_rectangle_2& bbox,
const typename K::Circle_2& circle,
const K&)
{
return do_intersect_circle_box_2(circle, bbox, K());
}
template <class K>
bool do_intersect(const typename K::Circle_2& circle,
const typename K::Iso_rectangle_2& bbox,
const K&)
{
return do_intersect_circle_box_2(circle, bbox, K());
}
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections

View File

@ -27,14 +27,14 @@
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
namespace CGAL { namespace CGAL {
bool bool
inline inline
do_intersect(const CGAL::Bbox_3& c, do_intersect(const CGAL::Bbox_3& c,
const CGAL::Bbox_3& bbox) const CGAL::Bbox_3& bbox)
{ {
return CGAL::do_overlap(c, bbox); return CGAL::do_overlap(c, bbox);
} }
} //namespace CGAL } //namespace CGAL

View File

@ -42,7 +42,7 @@ bool do_intersect(const Line_3<K>& a,
const CGAL::Bbox_3& b) { const CGAL::Bbox_3& b) {
return K().do_intersect_3_object()(a, b); return K().do_intersect_3_object()(a, b);
} }
template<typename K> template<typename K>
typename Intersection_traits<K, typename K::Line_3, Bbox_3>::result_type typename Intersection_traits<K, typename K::Line_3, Bbox_3>::result_type
intersection(const CGAL::Bbox_3& a, intersection(const CGAL::Bbox_3& a,

View File

@ -42,7 +42,7 @@ bool do_intersect(const Plane_3<K>& a,
const CGAL::Bbox_3& b) { const CGAL::Bbox_3& b) {
return K().do_intersect_3_object()(a, b); return K().do_intersect_3_object()(a, b);
} }
} }
#endif // CGAL_INTERSECTIONS_3_BBOX_3_PLANE_3_H #endif // CGAL_INTERSECTIONS_3_BBOX_3_PLANE_3_H

View File

@ -30,17 +30,17 @@
#include <CGAL/Intersections_3/Iso_cuboid_3_Point_3.h> #include <CGAL/Intersections_3/Iso_cuboid_3_Point_3.h>
namespace CGAL { namespace CGAL {
template<typename K> template<typename K>
bool do_intersect(const CGAL::Bbox_3& a, bool do_intersect(const CGAL::Bbox_3& a,
const Point_3<K>& b) { const Point_3<K>& b) {
Point_3<K> bl(a.xmin(), a.ymin(),a.zmin()), tr(a.xmax(), a.ymax(),a.zmax()); Point_3<K> bl(a.xmin(), a.ymin(),a.zmin()), tr(a.xmax(), a.ymax(),a.zmax());
Iso_cuboid_3<K> ic(bl,tr); Iso_cuboid_3<K> ic(bl,tr);
return K().do_intersect_3_object()(ic, b); return K().do_intersect_3_object()(ic, b);
} }
template<typename K> template<typename K>
bool do_intersect(const Point_3<K>& a, bool do_intersect(const Point_3<K>& a,
const CGAL::Bbox_3& b) { const CGAL::Bbox_3& b) {
@ -51,23 +51,22 @@ bool do_intersect(const Point_3<K>& a,
template<typename K> template<typename K>
typename Intersection_traits<K, typename K::Point_3, CGAL::Bbox_3>::result_type typename Intersection_traits<K, typename K::Point_3, CGAL::Bbox_3>::result_type
intersection(const Point_3<K>& a, intersection(const Point_3<K>& a,
const CGAL::Bbox_3& b const CGAL::Bbox_3& b)
) { {
if (do_intersect(a,b)) { if (do_intersect(a,b))
return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>(a); return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>(a);
} return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>();
return Intersections::internal::intersection_return<typename K::Intersect_3, typename K::Point_3, CGAL::Bbox_3>();
} }
template<typename K> template<typename K>
typename Intersection_traits<K, CGAL::Bbox_3, typename K::Point_3>::result_type typename Intersection_traits<K, CGAL::Bbox_3, typename K::Point_3>::result_type
intersection(const CGAL::Bbox_3& b, intersection(const CGAL::Bbox_3& b,
const Point_3<K>& a) { const Point_3<K>& a)
if (do_intersect(a,b)) { {
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>(a); if (do_intersect(a,b))
} return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>(a);
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>(); return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>();
} }
} // namespace CGAL } // namespace CGAL

View File

@ -42,7 +42,7 @@ bool do_intersect(const Ray_3<K>& a,
const CGAL::Bbox_3& b) { const CGAL::Bbox_3& b) {
return K().do_intersect_3_object()(a, b); return K().do_intersect_3_object()(a, b);
} }
template<typename K> template<typename K>
typename Intersection_traits<K, typename K::Ray_3, Bbox_3>::result_type typename Intersection_traits<K, typename K::Ray_3, Bbox_3>::result_type
intersection(const CGAL::Bbox_3& a, intersection(const CGAL::Bbox_3& a,

View File

@ -29,7 +29,7 @@
#include <CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h> #include <CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h>
namespace CGAL { namespace CGAL {
template<typename K> template<typename K>
bool do_intersect(const CGAL::Bbox_3& a, bool do_intersect(const CGAL::Bbox_3& a,
const Segment_3<K>& b) { const Segment_3<K>& b) {
@ -41,7 +41,7 @@ bool do_intersect(const Segment_3<K>& a,
const CGAL::Bbox_3& b) { const CGAL::Bbox_3& b) {
return K().do_intersect_3_object()(a, b); return K().do_intersect_3_object()(a, b);
} }
template<typename K> template<typename K>
typename Intersection_traits<K, typename K::Segment_3, Bbox_3>::result_type typename Intersection_traits<K, typename K::Segment_3, Bbox_3>::result_type
intersection(const CGAL::Bbox_3& a, intersection(const CGAL::Bbox_3& a,

View File

@ -41,7 +41,7 @@ bool do_intersect(const Sphere_3<K>& a,
const CGAL::Bbox_3& b) { const CGAL::Bbox_3& b) {
return K().do_intersect_3_object()(a, b); return K().do_intersect_3_object()(a, b);
} }
} }
#endif // CGAL_INTERSECTIONS_3_BBOX_3_SPHERE_3_H #endif // CGAL_INTERSECTIONS_3_BBOX_3_SPHERE_3_H

View File

@ -37,7 +37,7 @@ do_intersect(const typename K::Point_3 &pt,
const typename K::Iso_cuboid_3 &iso, const typename K::Iso_cuboid_3 &iso,
const K&) const K&)
{ {
return !iso.has_on_unbounded_side(pt); return !iso.has_on_unbounded_side(pt);
} }
template <class K> template <class K>
@ -47,7 +47,7 @@ do_intersect(const typename K::Iso_cuboid_3 &iso,
const typename K::Point_3 &pt, const typename K::Point_3 &pt,
const K&) const K&)
{ {
return !iso.has_on_unbounded_side(pt); return !iso.has_on_unbounded_side(pt);
} }
template <class K> template <class K>
@ -57,9 +57,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Iso_cuboid_3 &iso, const typename K::Iso_cuboid_3 &iso,
const K& k) const K& k)
{ {
if (internal::do_intersect(pt,iso,k)) { if (internal::do_intersect(pt,iso,k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Iso_cuboid_3>(pt); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Iso_cuboid_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Iso_cuboid_3>(); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Iso_cuboid_3>();
} }
@ -75,7 +74,7 @@ intersection(const typename K::Iso_cuboid_3 &iso,
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_3, Iso_cuboid_3, 3) CGAL_INTERSECTION_FUNCTION(Point_3, Iso_cuboid_3, 3)
CGAL_DO_INTERSECT_FUNCTION(Point_3, Iso_cuboid_3, 3) CGAL_DO_INTERSECT_FUNCTION(Point_3, Iso_cuboid_3, 3)

View File

@ -28,11 +28,8 @@
#include <CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h> #include <CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h>
namespace CGAL { namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Sphere_3, 3) CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Sphere_3, 3)
} }
#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_H #endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_H

View File

@ -30,7 +30,6 @@
namespace CGAL { namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Tetrahedron_3, 3) CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Tetrahedron_3, 3)
} }
#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TETRAHEDRON_3_H #endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TETRAHEDRON_3_H

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h> #include <CGAL/Intersection_traits_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -38,7 +38,7 @@ do_intersect(const typename K::Point_3 &pt,
const typename K::Line_3 &line, const typename K::Line_3 &line,
const K&) const K&)
{ {
return line.has_on(pt); return line.has_on(pt);
} }
template <class K> template <class K>
@ -47,7 +47,7 @@ do_intersect(const typename K::Line_3 &line,
const typename K::Point_3 &pt, const typename K::Point_3 &pt,
const K&) const K&)
{ {
return line.has_on(pt); return line.has_on(pt);
} }
template <class K> template <class K>
@ -57,10 +57,9 @@ intersection(const typename K::Point_3 &pt,
const typename K::Line_3 &line, const typename K::Line_3 &line,
const K& k) const K& k)
{ {
if (do_intersect(pt,line,k)) { if (do_intersect(pt,line,k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Line_3>(pt); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Line_3>(pt);
} return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Line_3>();
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Line_3>();
} }
template <class K> template <class K>
@ -75,7 +74,7 @@ intersection(const typename K::Line_3 &line,
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_3, Line_3, 3) CGAL_INTERSECTION_FUNCTION(Point_3, Line_3, 3)
CGAL_DO_INTERSECT_FUNCTION(Point_3, Line_3, 3) CGAL_DO_INTERSECT_FUNCTION(Point_3, Line_3, 3)

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h> #include <CGAL/Intersection_traits_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -38,7 +38,7 @@ do_intersect(const typename K::Point_3 &pt,
const typename K::Plane_3 &plane, const typename K::Plane_3 &plane,
const K&) const K&)
{ {
return plane.has_on(pt); return plane.has_on(pt);
} }
template <class K> template <class K>
@ -47,7 +47,7 @@ do_intersect(const typename K::Plane_3 &plane,
const typename K::Point_3 &pt, const typename K::Point_3 &pt,
const K&) const K&)
{ {
return plane.has_on(pt); return plane.has_on(pt);
} }
template <class K> template <class K>
@ -57,10 +57,9 @@ intersection(const typename K::Point_3 &pt,
const typename K::Plane_3 &plane, const typename K::Plane_3 &plane,
const K& k) const K& k)
{ {
if (do_intersect(pt,plane,k)) { if (do_intersect(pt,plane,k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Plane_3>(pt); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Plane_3>(pt);
} return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Plane_3>();
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Plane_3>();
} }
template <class K> template <class K>

View File

@ -26,7 +26,7 @@
#include <CGAL/Intersection_traits_3.h> #include <CGAL/Intersection_traits_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -47,9 +47,8 @@ intersection(const typename K::Point_3 &pt1,
const typename K::Point_3 &pt2, const typename K::Point_3 &pt2,
const K&) const K&)
{ {
if (pt1 == pt2) { if (pt1 == pt2)
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Point_3>(pt1); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Point_3>(pt1);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Point_3>(); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Point_3>();
} }

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h> #include <CGAL/Intersection_traits_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -79,7 +79,7 @@ intersection(const typename K::Ray_3 &ray,
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_3, Ray_3, 3) CGAL_INTERSECTION_FUNCTION(Point_3, Ray_3, 3)
CGAL_DO_INTERSECT_FUNCTION(Point_3, Ray_3, 3) CGAL_DO_INTERSECT_FUNCTION(Point_3, Ray_3, 3)

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h> #include <CGAL/Intersection_traits_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Segment_3 &seg, const typename K::Segment_3 &seg,
const K& k) const K& k)
{ {
if (do_intersect(pt,seg, k)) { if (do_intersect(pt,seg, k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Segment_3>(pt); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Segment_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Segment_3>(); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Segment_3>();
} }
@ -80,7 +79,7 @@ intersection( const typename K::Segment_3 &seg,
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_3, Segment_3, 3) CGAL_INTERSECTION_FUNCTION(Point_3, Segment_3, 3)
CGAL_DO_INTERSECT_FUNCTION(Point_3, Segment_3, 3) CGAL_DO_INTERSECT_FUNCTION(Point_3, Segment_3, 3)

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h> #include <CGAL/Intersection_traits_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Sphere_3 &sphere, const typename K::Sphere_3 &sphere,
const K& k) const K& k)
{ {
if (do_intersect(pt,sphere, k)) { if (do_intersect(pt,sphere, k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Sphere_3>(pt); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Sphere_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Sphere_3>(); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Sphere_3>();
} }
@ -79,7 +78,7 @@ intersection(const typename K::Sphere_3 &sphere,
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_3, Sphere_3, 3) CGAL_INTERSECTION_FUNCTION(Point_3, Sphere_3, 3)
CGAL_DO_INTERSECT_FUNCTION(Point_3, Sphere_3, 3) CGAL_DO_INTERSECT_FUNCTION(Point_3, Sphere_3, 3)

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h> #include <CGAL/Intersection_traits_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Tetrahedron_3 &tetrahedron, const typename K::Tetrahedron_3 &tetrahedron,
const K& k) const K& k)
{ {
if (do_intersect(pt,tetrahedron, k)) { if (do_intersect(pt,tetrahedron, k))
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>(pt); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>(pt);
}
return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>(); return intersection_return<typename K::Intersect_3, typename K::Point_3, typename K::Tetrahedron_3>();
} }
@ -79,7 +78,7 @@ intersection(const typename K::Tetrahedron_3 &tetrahedron,
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_3, Tetrahedron_3, 3) CGAL_INTERSECTION_FUNCTION(Point_3, Tetrahedron_3, 3)
CGAL_DO_INTERSECT_FUNCTION(Point_3, Tetrahedron_3, 3) CGAL_DO_INTERSECT_FUNCTION(Point_3, Tetrahedron_3, 3)

View File

@ -30,7 +30,6 @@
namespace CGAL { namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Segment_3, Tetrahedron_3, 3) CGAL_DO_INTERSECT_FUNCTION(Segment_3, Tetrahedron_3, 3)
} }
#endif // CGAL_INTERSECTIONS_3_SEGMENT_3_TETRAHEDRON_3_H #endif // CGAL_INTERSECTIONS_3_SEGMENT_3_TETRAHEDRON_3_H

View File

@ -30,7 +30,6 @@
namespace CGAL { namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Tetrahedron_3, 3) CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Tetrahedron_3, 3)
} }
#endif // CGAL_INTERSECTIONS_3_SPHERE_3_TETRAHEDRON_3_H #endif // CGAL_INTERSECTIONS_3_SPHERE_3_TETRAHEDRON_3_H

View File

@ -30,7 +30,6 @@
namespace CGAL { namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Triangle_3, 3) CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Triangle_3, 3)
} }
#endif // CGAL_INTERSECTIONS_3_SPHERE_3_TRIANGLE_3_H #endif // CGAL_INTERSECTIONS_3_SPHERE_3_TRIANGLE_3_H

View File

@ -27,24 +27,24 @@
#include <CGAL/Bbox_3.h> #include <CGAL/Bbox_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K> template <class K>
bool do_intersect(const CGAL::Bbox_3& bb, bool do_intersect(const CGAL::Bbox_3& bb,
const typename K::Iso_cuboid_3& ic, const typename K::Iso_cuboid_3& ic,
const K& k) const K& /* k */)
{ {
if (bb.xmax() < ic.xmin() || ic.xmax() < bb.xmin()) if (bb.xmax() < ic.xmin() || ic.xmax() < bb.xmin())
return false; return false;
if (bb.ymax() < ic.ymin() || ic.ymax() < bb.ymin()) if (bb.ymax() < ic.ymin() || ic.ymax() < bb.ymin())
return false; return false;
if (bb.zmax() < ic.zmin() || ic.zmax() < bb.zmin()) if (bb.zmax() < ic.zmin() || ic.zmax() < bb.zmin())
return false; return false;
return true; return true;
} }
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections

View File

@ -32,41 +32,41 @@
// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf // inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K> template <class K>
bool do_intersect(const typename K::Ray_3& ray, bool do_intersect(const typename K::Ray_3& ray,
const typename K::Iso_cuboid_3& ic, const typename K::Iso_cuboid_3& ic,
const K&) const K&)
{ {
typedef typename K::FT FT; typedef typename K::FT FT;
typedef typename K::Point_3 Point_3; typedef typename K::Point_3 Point_3;
const Point_3& source = ray.source(); const Point_3& source = ray.source();
const Point_3& point_on_ray = ray.second_point(); const Point_3& point_on_ray = ray.second_point();
return do_intersect_bbox_segment_aux return do_intersect_bbox_segment_aux
<FT,FT, <FT,FT,
true, // bounded at t=0 true, // bounded at t=0
false, // bounded at t=1 false, // bounded at t=1
false> // do not use static filters false> // do not use static filters
( (
source.x(), source.y(), source.z(), source.x(), source.y(), source.z(),
point_on_ray.x(), point_on_ray.y(), point_on_ray.z(), point_on_ray.x(), point_on_ray.y(), point_on_ray.z(),
(ic.min)().x(), (ic.min)().y(), (ic.min)().z(), (ic.min)().x(), (ic.min)().y(), (ic.min)().z(),
(ic.max)().x(), (ic.max)().y(), (ic.max)().z() (ic.max)().x(), (ic.max)().y(), (ic.max)().z()
); );
} }
template <class K> template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic, bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Ray_3& ray, const typename K::Ray_3& ray,
const K&) { const K&) {
return do_intersect(ray, ic, K()); return do_intersect(ray, ic, K());
} }
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections

View File

@ -32,42 +32,42 @@
// inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf // inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K> template <class K>
bool do_intersect(const typename K::Segment_3& seg, bool do_intersect(const typename K::Segment_3& seg,
const typename K::Iso_cuboid_3& ic, const typename K::Iso_cuboid_3& ic,
const K&) const K&)
{ {
typedef typename K::FT FT; typedef typename K::FT FT;
typedef typename K::Point_3 Point_3; typedef typename K::Point_3 Point_3;
const Point_3& source = seg.source(); const Point_3& source = seg.source();
const Point_3& target = seg.target(); const Point_3& target = seg.target();
return do_intersect_bbox_segment_aux return do_intersect_bbox_segment_aux
<FT,FT, <FT,FT,
true, // bounded at t=0 true, // bounded at t=0
true, // bounded at t=1 true, // bounded at t=1
false> // do not use static filters false> // do not use static filters
( (
source.x(), source.y(), source.z(), source.x(), source.y(), source.z(),
target.x(), target.y(), target.z(), target.x(), target.y(), target.z(),
(ic.min)().x(), (ic.min)().y(), (ic.min)().z(), (ic.min)().x(), (ic.min)().y(), (ic.min)().z(),
(ic.max)().x(), (ic.max)().y(), (ic.max)().z() (ic.max)().x(), (ic.max)().y(), (ic.max)().z()
); );
} }
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Segment_3& seg,
const K&) {
return do_intersect(seg, ic, K());
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Segment_3& seg,
const K&) {
return do_intersect(seg, ic, K());
}
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
} //namespace CGAL } //namespace CGAL

View File

@ -28,30 +28,30 @@
#include <CGALL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h> #include <CGALL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K> template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic, bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Sphere_3& sphere, const typename K::Sphere_3& sphere,
const K&) const K&)
{ {
return do_intersect_sphere_box_3(sphere, ic, K()); return do_intersect_sphere_box_3(sphere, ic, K());
} }
template <class K>
bool do_intersect(const typename K::Sphere_3& sphere,
const typename K::Iso_cuboid_3& ic,
const K&)
{
return do_intersect_sphere_box_3(sphere, ic, K());
}
template <class K>
bool do_intersect(const typename K::Sphere_3& sphere,
const typename K::Iso_cuboid_3& ic,
const K&)
{
return do_intersect_sphere_box_3(sphere, ic, K());
}
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
template<typename K> template<typename K>
bool do_intersect(const Iso_cuboid_3<K>& a, bool do_intersect(const Iso_cuboid_3<K>& a,
const Sphere_3<K>& b) { const Sphere_3<K>& b) {
@ -64,7 +64,6 @@ bool do_intersect(const Sphere_3<K>& a,
return K().do_intersect_3_object()(a, b); return K().do_intersect_3_object()(a, b);
} }
} //namespace CGAL } //namespace CGAL
#endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_DO_INTERSECT_H #endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_DO_INTERSECT_H

View File

@ -34,26 +34,26 @@
#include <CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h> #include <CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K> template <class K>
bool do_intersect(const typename K::Triangle_3& triangle, bool do_intersect(const typename K::Triangle_3& triangle,
const typename K::Iso_cuboid_3& bbox, const typename K::Iso_cuboid_3& bbox,
const K& k) const K& k)
{ {
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
} }
template <class K> template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& bbox, bool do_intersect(const typename K::Iso_cuboid_3& bbox,
const typename K::Triangle_3& triangle, const typename K::Triangle_3& triangle,
const K& k) const K& k)
{ {
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
} }
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections

View File

@ -1,9 +1,9 @@
// Copyright (c) 2005 // Copyright (c) 2005
// Utrecht University (The Netherlands), // Utrecht University (The Netherlands),
// ETH Zurich (Switzerland), // ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France), // INRIA Sophia-Antipolis (France),
// Max-Planck-Institute Saarbruecken (Germany), // Max-Planck-Institute Saarbruecken (Germany),
// and Tel-Aviv University (Israel). All rights reserved. // and Tel-Aviv University (Israel). All rights reserved.
// //
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or // This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as // modify it under the terms of the GNU Lesser General Public License as
@ -19,7 +19,7 @@
// $URL$ // $URL$
// $Id$ // $Id$
// SPDX-License-Identifier: LGPL-3.0+ // SPDX-License-Identifier: LGPL-3.0+
// //
// //
// Author(s) : Nico Kruithof // Author(s) : Nico Kruithof
@ -33,11 +33,11 @@
namespace CGAL { namespace CGAL {
template <class K> template <class K>
class Tetrahedron_3; class Tetrahedron_3;
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K> template <class K>
@ -45,7 +45,7 @@ typename K::Boolean
do_intersect(const typename K::Tetrahedron_3 &tet, do_intersect(const typename K::Tetrahedron_3 &tet,
const typename K::Triangle_3 &tr, const typename K::Triangle_3 &tr,
const K & k); const K & k);
// This code is not optimized: // This code is not optimized:
template <class K, class Bounded> template <class K, class Bounded>
typename K::Boolean typename K::Boolean
@ -89,7 +89,7 @@ do_intersect(const typename K::Triangle_3 &tr,
return do_intersect_tetrahedron_bounded(tr, tet, tr[0], k); return do_intersect_tetrahedron_bounded(tr, tet, tr[0], k);
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
@ -99,7 +99,7 @@ do_intersect(const typename K::Tetrahedron_3 &tet,
{ {
return do_intersect_tetrahedron_bounded(seg, tet, seg.source(), k); return do_intersect_tetrahedron_bounded(seg, tet, seg.source(), k);
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
@ -109,7 +109,6 @@ do_intersect(const typename K::Segment_3 &seg,
{ {
return do_intersect_tetrahedron_bounded(seg, tet, seg.source(), k); return do_intersect_tetrahedron_bounded(seg, tet, seg.source(), k);
} }
template <class K> template <class K>
inline inline
@ -131,7 +130,6 @@ do_intersect(const typename K::Iso_cuboid_3 &ic,
return do_intersect_tetrahedron_bounded(ic, tet, ic[0], k); return do_intersect_tetrahedron_bounded(ic, tet, ic[0], k);
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
@ -152,7 +150,6 @@ do_intersect(const typename K::Sphere_3 &sp,
return do_intersect_tetrahedron_bounded(sp, tet, sp.center(), k); return do_intersect_tetrahedron_bounded(sp, tet, sp.center(), k);
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
@ -182,7 +179,7 @@ do_intersect(const CGAL::Bbox_3 &bb,
{ {
return do_intersect_tetrahedron_bounded(bb, tet, typename K::Point_3(bb.xmin(), bb.ymin(), bb.zmin()), k); return do_intersect_tetrahedron_bounded(bb, tet, typename K::Point_3(bb.xmin(), bb.ymin(), bb.zmin()), k);
} }
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
} //namespace CGAL } //namespace CGAL

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersections_3/Plane_3_Triangle_3.h> #include <CGAL/Intersections_3/Plane_3_Triangle_3.h>
namespace CGAL { namespace CGAL {
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
@ -52,7 +52,7 @@ bool do_intersect(const typename K::Plane_3& unb,
const K& k) { const K& k) {
return do_intersect_tetrahedron_unbounded(tet, unb, k); return do_intersect_tetrahedron_unbounded(tet, unb, k);
} }
template<typename K> template<typename K>
bool do_intersect(const typename K::Tetrahedron_3& tet, bool do_intersect(const typename K::Tetrahedron_3& tet,
const typename K::Plane_3& unb, const typename K::Plane_3& unb,
@ -67,7 +67,7 @@ bool do_intersect(const typename K::Line_3& unb,
const K& k) { const K& k) {
return do_intersect_tetrahedron_unbounded(tet, unb, k); return do_intersect_tetrahedron_unbounded(tet, unb, k);
} }
template<typename K> template<typename K>
bool do_intersect(const typename K::Tetrahedron_3& tet, bool do_intersect(const typename K::Tetrahedron_3& tet,
const typename K::Line_3& unb, const typename K::Line_3& unb,
@ -82,14 +82,14 @@ bool do_intersect(const typename K::Ray_3& unb,
const K& k) { const K& k) {
return do_intersect_tetrahedron_unbounded(tet, unb, k); return do_intersect_tetrahedron_unbounded(tet, unb, k);
} }
template<typename K> template<typename K>
bool do_intersect(const typename K::Tetrahedron_3& tet, bool do_intersect(const typename K::Tetrahedron_3& tet,
const typename K::Ray_3& unb, const typename K::Ray_3& unb,
const K& k) { const K& k) {
return do_intersect_tetrahedron_unbounded(tet, unb, k); return do_intersect_tetrahedron_unbounded(tet, unb, k);
} }
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
} // namespace CGAL } // namespace CGAL

View File

@ -1,5 +1,5 @@
// Copyright (c) 2018 GeometryFactory Sarl // Copyright (c) 2018 GeometryFactory Sarl
// All rights reserved. // All rights reserved.
// //
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or // This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as // modify it under the terms of the GNU Lesser General Public License as
@ -15,7 +15,7 @@
// $URL$ // $URL$
// $Id$ // $Id$
// SPDX-License-Identifier: LGPL-3.0+ // SPDX-License-Identifier: LGPL-3.0+
// //
// //
// Author(s) : Andreas Fabri // Author(s) : Andreas Fabri
@ -27,55 +27,55 @@
namespace CGAL { namespace CGAL {
template <class K> template <class K>
class Triangle_3; class Triangle_3;
template <class K> template <class K>
class Sphere_3; class Sphere_3;
template <class K>
class Line_3;
template <class K>
class Line_3;
namespace Intersections { namespace Intersections {
namespace internal { namespace internal {
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp, do_intersect(const typename K::Sphere_3 &sp,
const typename K::Triangle_3 &tr, const typename K::Triangle_3 &tr,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), tr) <= sp.squared_radius(); return squared_distance(sp.center(), tr) <= sp.squared_radius();
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Triangle_3 &tr, do_intersect(const typename K::Triangle_3 &tr,
const typename K::Sphere_3 &sp, const typename K::Sphere_3 &sp,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), tr) <= sp.squared_radius(); return squared_distance(sp.center(), tr) <= sp.squared_radius();
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp, do_intersect(const typename K::Sphere_3 &sp,
const typename K::Line_3 &lin, const typename K::Line_3 &lin,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), lin) <= sp.squared_radius(); return squared_distance(sp.center(), lin) <= sp.squared_radius();
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Line_3 &lin, do_intersect(const typename K::Line_3 &lin,
const typename K::Sphere_3 &sp, const typename K::Sphere_3 &sp,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), lin) <= sp.squared_radius(); return squared_distance(sp.center(), lin) <= sp.squared_radius();
} }
@ -87,18 +87,18 @@ inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp, do_intersect(const typename K::Sphere_3 &sp,
const typename K::Ray_3 &lin, const typename K::Ray_3 &lin,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), lin) <= sp.squared_radius(); return squared_distance(sp.center(), lin) <= sp.squared_radius();
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Ray_3 &lin, do_intersect(const typename K::Ray_3 &lin,
const typename K::Sphere_3 &sp, const typename K::Sphere_3 &sp,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), lin) <= sp.squared_radius(); return squared_distance(sp.center(), lin) <= sp.squared_radius();
} }
@ -108,25 +108,24 @@ inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp, do_intersect(const typename K::Sphere_3 &sp,
const typename K::Segment_3 &lin, const typename K::Segment_3 &lin,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), lin) <= sp.squared_radius(); return squared_distance(sp.center(), lin) <= sp.squared_radius();
} }
template <class K> template <class K>
inline inline
typename K::Boolean typename K::Boolean
do_intersect(const typename K::Segment_3 &lin, do_intersect(const typename K::Segment_3 &lin,
const typename K::Sphere_3 &sp, const typename K::Sphere_3 &sp,
const K & k) const K & /* k */)
{ {
return squared_distance(sp.center(), lin) <= sp.squared_radius(); return squared_distance(sp.center(), lin) <= sp.squared_radius();
} }
} // namespace internal } // namespace internal
} // namespace Intersections } // namespace Intersections
} // namespace CGAL } // namespace CGAL
#endif // CGAL_TRIANGLE_3_SPHERE_3_DO_INTERSECT_H #endif // CGAL_TRIANGLE_3_SPHERE_3_DO_INTERSECT_H

View File

@ -22,35 +22,33 @@ int main()
{ {
Tetrahedron tet; Tetrahedron tet;
Sphere sp; Sphere sp;
CGAL::do_intersect(tet,Triangle()); CGAL::do_intersect(tet,Triangle());
CGAL::do_intersect(tet,Segment()); CGAL::do_intersect(tet,Segment());
CGAL::do_intersect(tet,Iso_cuboid()); CGAL::do_intersect(tet,Iso_cuboid());
CGAL::do_intersect(tet,Sphere()); CGAL::do_intersect(tet,Sphere());
CGAL::do_intersect(tet,Plane()); CGAL::do_intersect(tet,Plane());
CGAL::do_intersect(tet,Line()); CGAL::do_intersect(tet,Line());
CGAL::do_intersect(tet,Ray()); CGAL::do_intersect(tet,Ray());
CGAL::do_intersect(tet,tet); CGAL::do_intersect(tet,tet);
CGAL::do_intersect(tet,Bbox()); CGAL::do_intersect(tet,Bbox());
CGAL::do_intersect(sp, Line()); CGAL::do_intersect(sp, Line());
CGAL::do_intersect(sp, Ray()); CGAL::do_intersect(sp, Ray());
CGAL::do_intersect(sp, Segment()); CGAL::do_intersect(sp, Segment());
CGAL::do_intersect(Triangle(), tet); CGAL::do_intersect(Triangle(), tet);
CGAL::do_intersect(Segment(), tet); CGAL::do_intersect(Segment(), tet);
CGAL::do_intersect(Iso_cuboid(), tet); CGAL::do_intersect(Iso_cuboid(), tet);
CGAL::do_intersect(Sphere(), tet); CGAL::do_intersect(Sphere(), tet);
CGAL::do_intersect(Plane(), tet); CGAL::do_intersect(Plane(), tet);
CGAL::do_intersect(Line(), tet); CGAL::do_intersect(Line(), tet);
CGAL::do_intersect(Ray(), tet); CGAL::do_intersect(Ray(), tet);
CGAL::do_intersect(Bbox(), tet); CGAL::do_intersect(Bbox(), tet);
CGAL::do_intersect(Line(), sp); CGAL::do_intersect(Line(), sp);
CGAL::do_intersect(Ray(), sp); CGAL::do_intersect(Ray(), sp);
CGAL::do_intersect(Segment(), sp); CGAL::do_intersect(Segment(), sp);
return 0; return 0;
} }