diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h index 642c9a27211..aaa9f323f1c 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h @@ -41,6 +41,6 @@ bool do_intersect(const Circle_2& a, const CGAL::Bbox_2& b) { return K().do_intersect_2_object()(a, b); } - + } #endif // CGAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h index 69176f42f1a..5df79996e48 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h @@ -29,20 +29,22 @@ #include namespace CGAL { - + template bool do_intersect(const CGAL::Bbox_2& a, - const Point_2& b) { + const Point_2& b) +{ Point_2 bl(a.xmin(), a.ymin()), tr(a.xmax(), a.ymax()); - + Iso_rectangle_2 ic(bl,tr); return K().do_intersect_2_object()(ic, b); } - + template bool do_intersect(const Point_2& a, - const CGAL::Bbox_2& b) { + const CGAL::Bbox_2& b) +{ return do_intersect(b,a); } @@ -53,24 +55,23 @@ namespace internal { template typename CGAL::Intersection_traits::result_type intersection(const Point_2& a, - const CGAL::Bbox_2& b - ) { - if (do_intersect(a,b)) { - return Intersections::internal::intersection_return(a); - } - return Intersections::internal::intersection_return(); + const CGAL::Bbox_2& b) +{ + if (do_intersect(a,b)) + return Intersections::internal::intersection_return(a); + return Intersections::internal::intersection_return(); } - + template typename CGAL::Intersection_traits::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(a); - } - return Intersections::internal::intersection_return(); + const K& /*k*/ ) +{ + if (do_intersect(a,b)) + return Intersections::internal::intersection_return(a); + return Intersections::internal::intersection_return(); } } // namespace internal @@ -78,12 +79,13 @@ intersection(const CGAL::Bbox_2& b, template typename CGAL::Intersection_traits >::result_type -intersection(const Bbox_2& b, +intersection(const Bbox_2& b, const Point_2 & a) { return Intersections::internal::intersection(b,a,K()); } - template + +template typename CGAL::Intersection_traits >::result_type intersection(const Point_2 & a, const Bbox_2& b) diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h index 38a870f2d07..8aae18ec2d2 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h @@ -28,11 +28,8 @@ #include - namespace CGAL { CGAL_DO_INTERSECT_FUNCTION(Iso_rectangle_2, Circle_2, 2) } - - #endif // CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_CIRCLE_2_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h index ab0f20d7d15..17483d4ec86 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h @@ -27,7 +27,7 @@ #include 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(pt); - } return intersection_return(); } @@ -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) diff --git a/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h b/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h index 1f78e9ea892..071dbd012a0 100644 --- a/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h @@ -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 - 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 +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 - 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 - 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 - 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 - 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 +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 +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 +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 +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 diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h index 59a02a3ed4f..d742cb8ff43 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h @@ -27,14 +27,14 @@ #include 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 diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h index b14111c620c..16afa74a743 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h @@ -42,7 +42,7 @@ bool do_intersect(const Line_3& a, const CGAL::Bbox_3& b) { return K().do_intersect_3_object()(a, b); } - + template typename Intersection_traits::result_type intersection(const CGAL::Bbox_3& a, diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h index a9750eee8cd..639a7986aee 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h @@ -42,7 +42,7 @@ bool do_intersect(const Plane_3& a, const CGAL::Bbox_3& b) { return K().do_intersect_3_object()(a, b); } - + } #endif // CGAL_INTERSECTIONS_3_BBOX_3_PLANE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h index 156a008a46c..e923357c38c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h @@ -30,17 +30,17 @@ #include namespace CGAL { - + template bool do_intersect(const CGAL::Bbox_3& a, const Point_3& b) { Point_3 bl(a.xmin(), a.ymin(),a.zmin()), tr(a.xmax(), a.ymax(),a.zmax()); - + Iso_cuboid_3 ic(bl,tr); return K().do_intersect_3_object()(ic, b); } - + template bool do_intersect(const Point_3& a, const CGAL::Bbox_3& b) { @@ -51,23 +51,22 @@ bool do_intersect(const Point_3& a, template typename Intersection_traits::result_type intersection(const Point_3& a, - const CGAL::Bbox_3& b - ) { - if (do_intersect(a,b)) { - return Intersections::internal::intersection_return(a); - } - return Intersections::internal::intersection_return(); + const CGAL::Bbox_3& b) +{ + if (do_intersect(a,b)) + return Intersections::internal::intersection_return(a); + return Intersections::internal::intersection_return(); } - + template typename Intersection_traits::result_type intersection(const CGAL::Bbox_3& b, - const Point_3& a) { - if (do_intersect(a,b)) { - return Intersections::internal::intersection_return(a); - } - return Intersections::internal::intersection_return(); + const Point_3& a) +{ + if (do_intersect(a,b)) + return Intersections::internal::intersection_return(a); + return Intersections::internal::intersection_return(); } } // namespace CGAL diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h index da4d99448ad..72441388ff0 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h @@ -42,7 +42,7 @@ bool do_intersect(const Ray_3& a, const CGAL::Bbox_3& b) { return K().do_intersect_3_object()(a, b); } - + template typename Intersection_traits::result_type intersection(const CGAL::Bbox_3& a, diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h index 597e6d60469..243e37d5374 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h @@ -29,7 +29,7 @@ #include namespace CGAL { - + template bool do_intersect(const CGAL::Bbox_3& a, const Segment_3& b) { @@ -41,7 +41,7 @@ bool do_intersect(const Segment_3& a, const CGAL::Bbox_3& b) { return K().do_intersect_3_object()(a, b); } - + template typename Intersection_traits::result_type intersection(const CGAL::Bbox_3& a, diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h index 5d83281ad2f..62445c404e5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h @@ -41,7 +41,7 @@ bool do_intersect(const Sphere_3& a, const CGAL::Bbox_3& b) { return K().do_intersect_3_object()(a, b); } - + } #endif // CGAL_INTERSECTIONS_3_BBOX_3_SPHERE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Point_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Point_3.h index 2d1ace333dd..c03335611ea 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Point_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Point_3.h @@ -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 @@ -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 @@ -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(pt); - } return intersection_return(); } @@ -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) diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Sphere_3.h index 5562ba55e02..b63ea70bc62 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Sphere_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Sphere_3.h @@ -28,11 +28,8 @@ #include - namespace CGAL { CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Sphere_3, 3) } - - #endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Tetrahedron_3.h index 866a93fc5ea..e211d8f19a5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Tetrahedron_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Tetrahedron_3.h @@ -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 diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Point_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Point_3.h index 6f033fb37de..e05e8ac2ed2 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Line_3_Point_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Point_3.h @@ -27,7 +27,7 @@ #include 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 @@ -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 @@ -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(pt); - } - return intersection_return(); + if (do_intersect(pt,line,k)) + return intersection_return(pt); + return intersection_return(); } template @@ -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) diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Point_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Point_3.h index 96421de67fe..090ba9c0ae5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Point_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Point_3.h @@ -27,7 +27,7 @@ #include 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 @@ -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 @@ -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(pt); - } - return intersection_return(); + if (do_intersect(pt,plane,k)) + return intersection_return(pt); + return intersection_return(); } template diff --git a/Intersections_3/include/CGAL/Intersections_3/Point_3_Point_3.h b/Intersections_3/include/CGAL/Intersections_3/Point_3_Point_3.h index 68eac1cdcc5..f7e815fd1c0 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Point_3_Point_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Point_3.h @@ -26,7 +26,7 @@ #include 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(pt1); - } return intersection_return(); } diff --git a/Intersections_3/include/CGAL/Intersections_3/Point_3_Ray_3.h b/Intersections_3/include/CGAL/Intersections_3/Point_3_Ray_3.h index dbf1e0dfda6..9951c634c72 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Point_3_Ray_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Ray_3.h @@ -27,7 +27,7 @@ #include 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) diff --git a/Intersections_3/include/CGAL/Intersections_3/Point_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Point_3_Segment_3.h index 4d0425db3c3..93d441674a5 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Point_3_Segment_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Segment_3.h @@ -27,7 +27,7 @@ #include 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(pt); - } return intersection_return(); } @@ -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) diff --git a/Intersections_3/include/CGAL/Intersections_3/Point_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Point_3_Sphere_3.h index fdb5af0f8bc..0470340ef77 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Point_3_Sphere_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Sphere_3.h @@ -27,7 +27,7 @@ #include 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(pt); - } return intersection_return(); } @@ -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) diff --git a/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h index 886bd9dbaff..0e5cc9f9053 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h @@ -27,7 +27,7 @@ #include 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(pt); - } return intersection_return(); } @@ -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) diff --git a/Intersections_3/include/CGAL/Intersections_3/Segment_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Tetrahedron_3.h index c89e2b7fa21..3f5dc525a4c 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Segment_3_Tetrahedron_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Tetrahedron_3.h @@ -30,7 +30,6 @@ namespace CGAL { CGAL_DO_INTERSECT_FUNCTION(Segment_3, Tetrahedron_3, 3) - } #endif // CGAL_INTERSECTIONS_3_SEGMENT_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Tetrahedron_3.h index 410bd6f2dcf..2ccdfe0b4f4 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Tetrahedron_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Tetrahedron_3.h @@ -30,7 +30,6 @@ namespace CGAL { CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Tetrahedron_3, 3) - } #endif // CGAL_INTERSECTIONS_3_SPHERE_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Triangle_3.h index a65a5f48e31..fbb765f7b57 100644 --- a/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Triangle_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Triangle_3.h @@ -30,7 +30,6 @@ namespace CGAL { CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Triangle_3, 3) - } #endif // CGAL_INTERSECTIONS_3_SPHERE_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h index fe0710a84d4..8aff1c21721 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h @@ -27,24 +27,24 @@ #include namespace CGAL { - + namespace Intersections { namespace internal { - template - 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 +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 diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h index 4c4e81707a6..16baac9bf82 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h @@ -32,41 +32,41 @@ // inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf namespace CGAL { - + namespace Intersections { namespace internal { - template - 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 +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 - // 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 + // 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 - 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 +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 diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h index 0581686a99e..87d1ef922d3 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h @@ -32,42 +32,42 @@ // inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf namespace CGAL { - + namespace Intersections { namespace internal { - template - 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 +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 - // 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 + // 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 +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 - 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 diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h index 15f500a9cef..1e70cfef505 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h @@ -28,30 +28,30 @@ #include namespace CGAL { - + namespace Intersections { namespace internal { - template - 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 +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 +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 - 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 bool do_intersect(const Iso_cuboid_3& a, const Sphere_3& b) { @@ -64,7 +64,6 @@ bool do_intersect(const Sphere_3& a, return K().do_intersect_3_object()(a, b); } - } //namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h index 2f3e216d802..5af2050b235 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h @@ -34,26 +34,26 @@ #include namespace CGAL { - + namespace Intersections { namespace internal { - template - 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 +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 - 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 +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 diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h index 770c0bf9c91..c5057cda77d 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h @@ -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 Tetrahedron_3; +template +class Tetrahedron_3; namespace Intersections { - + namespace internal { template @@ -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 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 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 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 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 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 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 diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Unbounded_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Unbounded_3_do_intersect.h index b883187d24f..65c9d38c3be 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Unbounded_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Unbounded_3_do_intersect.h @@ -27,7 +27,7 @@ #include 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 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 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 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 diff --git a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Sphere_3_do_intersect.h index 84e05f0ef66..4cfb6c4b737 100644 --- a/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Sphere_3_do_intersect.h @@ -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 Triangle_3; - - template - class Sphere_3; +template +class Triangle_3; + +template +class Sphere_3; + +template +class Line_3; - template - class Line_3; - namespace Intersections { - + namespace internal { - + template 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 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 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 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 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 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 - diff --git a/Intersections_3/test/Intersections_3/tetrahedron.cpp b/Intersections_3/test/Intersections_3/tetrahedron.cpp index 6c05a321df6..c094c2a434b 100644 --- a/Intersections_3/test/Intersections_3/tetrahedron.cpp +++ b/Intersections_3/test/Intersections_3/tetrahedron.cpp @@ -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; - }