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) {
return K().do_intersect_2_object()(a, b);
}
}
#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>
namespace CGAL {
template<typename K>
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());
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) {
const CGAL::Bbox_2& b)
{
return do_intersect(b,a);
}
@ -53,24 +55,23 @@ namespace internal {
template<typename K>
typename CGAL::Intersection_traits<K, typename K::Point_2, CGAL::Bbox_2>::result_type
intersection(const Point_2<K>& a,
const CGAL::Bbox_2& 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>();
const CGAL::Bbox_2& 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>();
}
template<typename K>
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 K& k ) {
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>();
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);
return Intersections::internal::intersection_return<typename K::Intersect_2, CGAL::Bbox_2, typename K::Point_2>();
}
} // namespace internal
@ -78,12 +79,13 @@ intersection(const CGAL::Bbox_2& b,
template<typename K>
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)
{
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
intersection(const Point_2<K> & a,
const Bbox_2& b)

View File

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

View File

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

View File

@ -15,7 +15,7 @@
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
//
//
// Author(s) : Andreas Fabri
@ -30,80 +30,80 @@
namespace CGAL {
namespace Intersections {
namespace internal {
template <class K, class Box3>
bool do_intersect_circle_box_2(const typename K::Circle_2& circle,
const Box3& bbox,
const K&)
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point;
FT d = FT(0);
FT distance = FT(0);
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;
}
template <class K, class Box3>
bool do_intersect_circle_box_2(const typename K::Circle_2& circle,
const Box3& bbox,
const K&)
{
typedef typename K::FT FT;
typedef typename K::Point_2 Point;
FT d = FT(0);
FT distance = FT(0);
Point center = circle.center();
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>
bool do_intersect(const CGAL::Bbox_2& bbox,
const typename K::Circle_2& circle,
const K&)
{
return do_intersect_circle_box_2(circle, bbox, K());
}
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;
}
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());
}
return distance <= circle.squared_radius();
}
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());
}
template <class K>
bool do_intersect(const CGAL::Bbox_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 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 Intersections

View File

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

View File

@ -42,7 +42,7 @@ bool do_intersect(const Line_3<K>& a,
const CGAL::Bbox_3& b) {
return K().do_intersect_3_object()(a, b);
}
template<typename K>
typename Intersection_traits<K, typename K::Line_3, Bbox_3>::result_type
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) {
return K().do_intersect_3_object()(a, b);
}
}
#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>
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& a,
const Point_3<K>& b) {
Point_3<K> bl(a.xmin(), a.ymin(),a.zmin()), tr(a.xmax(), a.ymax(),a.zmax());
Iso_cuboid_3<K> ic(bl,tr);
return K().do_intersect_3_object()(ic, b);
}
template<typename K>
bool do_intersect(const Point_3<K>& a,
const CGAL::Bbox_3& b) {
@ -51,23 +51,22 @@ bool do_intersect(const Point_3<K>& a,
template<typename K>
typename Intersection_traits<K, typename K::Point_3, CGAL::Bbox_3>::result_type
intersection(const Point_3<K>& a,
const CGAL::Bbox_3& 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>();
const CGAL::Bbox_3& 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>();
}
template<typename K>
typename Intersection_traits<K, CGAL::Bbox_3, typename K::Point_3>::result_type
intersection(const CGAL::Bbox_3& b,
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);
}
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>();
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);
return Intersections::internal::intersection_return<typename K::Intersect_3, CGAL::Bbox_3, typename K::Point_3>();
}
} // namespace CGAL

View File

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

View File

@ -29,7 +29,7 @@
#include <CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h>
namespace CGAL {
template<typename K>
bool do_intersect(const CGAL::Bbox_3& a,
const Segment_3<K>& b) {
@ -41,7 +41,7 @@ bool do_intersect(const Segment_3<K>& a,
const CGAL::Bbox_3& b) {
return K().do_intersect_3_object()(a, b);
}
template<typename K>
typename Intersection_traits<K, typename K::Segment_3, Bbox_3>::result_type
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) {
return K().do_intersect_3_object()(a, b);
}
}
#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 K&)
{
return !iso.has_on_unbounded_side(pt);
return !iso.has_on_unbounded_side(pt);
}
template <class K>
@ -47,7 +47,7 @@ do_intersect(const typename K::Iso_cuboid_3 &iso,
const typename K::Point_3 &pt,
const K&)
{
return !iso.has_on_unbounded_side(pt);
return !iso.has_on_unbounded_side(pt);
}
template <class K>
@ -57,9 +57,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Iso_cuboid_3 &iso,
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>();
}
@ -75,7 +74,7 @@ intersection(const typename K::Iso_cuboid_3 &iso,
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_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>
namespace CGAL {
CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Sphere_3, 3)
}
#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_H

View File

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

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h>
namespace CGAL {
namespace Intersections {
namespace internal {
@ -38,7 +38,7 @@ do_intersect(const typename K::Point_3 &pt,
const typename K::Line_3 &line,
const K&)
{
return line.has_on(pt);
return line.has_on(pt);
}
template <class K>
@ -47,7 +47,7 @@ do_intersect(const typename K::Line_3 &line,
const typename K::Point_3 &pt,
const K&)
{
return line.has_on(pt);
return line.has_on(pt);
}
template <class K>
@ -57,10 +57,9 @@ intersection(const typename K::Point_3 &pt,
const typename K::Line_3 &line,
const K& 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>();
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>();
}
template <class K>
@ -75,7 +74,7 @@ intersection(const typename K::Line_3 &line,
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_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>
namespace CGAL {
namespace Intersections {
namespace internal {
@ -38,7 +38,7 @@ do_intersect(const typename K::Point_3 &pt,
const typename K::Plane_3 &plane,
const K&)
{
return plane.has_on(pt);
return plane.has_on(pt);
}
template <class K>
@ -47,7 +47,7 @@ do_intersect(const typename K::Plane_3 &plane,
const typename K::Point_3 &pt,
const K&)
{
return plane.has_on(pt);
return plane.has_on(pt);
}
template <class K>
@ -57,10 +57,9 @@ intersection(const typename K::Point_3 &pt,
const typename K::Plane_3 &plane,
const K& 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>();
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>();
}
template <class K>

View File

@ -26,7 +26,7 @@
#include <CGAL/Intersection_traits_3.h>
namespace CGAL {
namespace Intersections {
namespace internal {
@ -47,9 +47,8 @@ intersection(const typename K::Point_3 &pt1,
const typename K::Point_3 &pt2,
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>();
}

View File

@ -27,7 +27,7 @@
#include <CGAL/Intersection_traits_3.h>
namespace CGAL {
namespace Intersections {
namespace internal {
@ -79,7 +79,7 @@ intersection(const typename K::Ray_3 &ray,
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_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>
namespace CGAL {
namespace Intersections {
namespace internal {
@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Segment_3 &seg,
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>();
}
@ -80,7 +79,7 @@ intersection( const typename K::Segment_3 &seg,
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_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>
namespace CGAL {
namespace Intersections {
namespace internal {
@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Sphere_3 &sphere,
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>();
}
@ -79,7 +78,7 @@ intersection(const typename K::Sphere_3 &sphere,
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_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>
namespace CGAL {
namespace Intersections {
namespace internal {
@ -61,9 +61,8 @@ intersection(const typename K::Point_3 &pt,
const typename K::Tetrahedron_3 &tetrahedron,
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>();
}
@ -79,7 +78,7 @@ intersection(const typename K::Tetrahedron_3 &tetrahedron,
} // namespace internal
} // namespace Intersections
CGAL_INTERSECTION_FUNCTION(Point_3, Tetrahedron_3, 3)
CGAL_DO_INTERSECT_FUNCTION(Point_3, Tetrahedron_3, 3)

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,30 +28,30 @@
#include <CGALL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h>
namespace CGAL {
namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Sphere_3& sphere,
const K&)
{
return do_intersect_sphere_box_3(sphere, ic, K());
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& ic,
const typename K::Sphere_3& sphere,
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());
}
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 Intersections
template<typename K>
bool do_intersect(const Iso_cuboid_3<K>& a,
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);
}
} //namespace CGAL
#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>
namespace CGAL {
namespace Intersections {
namespace internal {
template <class K>
bool do_intersect(const typename K::Triangle_3& triangle,
const typename K::Iso_cuboid_3& bbox,
const K& k)
{
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
}
template <class K>
bool do_intersect(const typename K::Triangle_3& triangle,
const typename K::Iso_cuboid_3& bbox,
const K& k)
{
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& bbox,
const typename K::Triangle_3& triangle,
const K& k)
{
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
}
template <class K>
bool do_intersect(const typename K::Iso_cuboid_3& bbox,
const typename K::Triangle_3& triangle,
const K& k)
{
return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k);
}
} // namespace internal
} // namespace Intersections

View File

@ -1,9 +1,9 @@
// Copyright (c) 2005
// Copyright (c) 2005
// Utrecht University (The Netherlands),
// ETH Zurich (Switzerland),
// INRIA Sophia-Antipolis (France),
// 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
// modify it under the terms of the GNU Lesser General Public License as
@ -19,7 +19,7 @@
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
//
//
// Author(s) : Nico Kruithof
@ -33,11 +33,11 @@
namespace CGAL {
template <class K>
class Tetrahedron_3;
template <class K>
class Tetrahedron_3;
namespace Intersections {
namespace internal {
template <class K>
@ -45,7 +45,7 @@ typename K::Boolean
do_intersect(const typename K::Tetrahedron_3 &tet,
const typename K::Triangle_3 &tr,
const K & k);
// This code is not optimized:
template <class K, class Bounded>
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);
}
template <class K>
inline
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);
}
template <class K>
inline
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);
}
template <class K>
inline
@ -131,7 +130,6 @@ do_intersect(const typename K::Iso_cuboid_3 &ic,
return do_intersect_tetrahedron_bounded(ic, tet, ic[0], k);
}
template <class K>
inline
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);
}
template <class K>
inline
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);
}
} // namespace internal
} // namespace Intersections
} //namespace CGAL

View File

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

View File

@ -1,5 +1,5 @@
// Copyright (c) 2018 GeometryFactory Sarl
// All rights reserved.
// Copyright (c) 2018 GeometryFactory Sarl
// All rights reserved.
//
// 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
@ -15,7 +15,7 @@
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
//
//
// Author(s) : Andreas Fabri
@ -27,55 +27,55 @@
namespace CGAL {
template <class K>
class Triangle_3;
template <class K>
class Sphere_3;
template <class K>
class Triangle_3;
template <class K>
class Sphere_3;
template <class K>
class Line_3;
template <class K>
class Line_3;
namespace Intersections {
namespace internal {
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Triangle_3 &tr,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), tr) <= sp.squared_radius();
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Triangle_3 &tr,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), tr) <= sp.squared_radius();
}
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Line_3 &lin,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Line_3 &lin,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -87,18 +87,18 @@ inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Ray_3 &lin,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Ray_3 &lin,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
@ -108,25 +108,24 @@ inline
typename K::Boolean
do_intersect(const typename K::Sphere_3 &sp,
const typename K::Segment_3 &lin,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
template <class K>
inline
typename K::Boolean
do_intersect(const typename K::Segment_3 &lin,
const typename K::Sphere_3 &sp,
const K & k)
const K & /* k */)
{
return squared_distance(sp.center(), lin) <= sp.squared_radius();
}
} // namespace internal
} // namespace Intersections
} // namespace CGAL
#endif // CGAL_TRIANGLE_3_SPHERE_3_DO_INTERSECT_H

View File

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