diff --git a/AABB_tree/package_info/AABB_tree/dependencies b/AABB_tree/package_info/AABB_tree/dependencies index 68b30352078..c72f4088b6a 100644 --- a/AABB_tree/package_info/AABB_tree/dependencies +++ b/AABB_tree/package_info/AABB_tree/dependencies @@ -16,3 +16,4 @@ Property_map STL_Extension Spatial_searching Stream_support +Distance_3 diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h index 514cadaeb17..a1ee4abbb5c 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Circular_arc_2.h @@ -191,7 +191,7 @@ namespace internal { // the circles intersect const std::pair* - result = CGAL::internal::intersect_get< std::pair >(*it); + result = CGAL::Intersections::internal::intersect_get< std::pair >(*it); if ( result->second == 2 ){ // double solution _begin = result->first; _end = result->first; @@ -202,7 +202,7 @@ namespace internal { _end = result->first; if (!(b_1 && b_2)) { ++it; - result = CGAL::internal::intersect_get< std::pair >(*it); + result = CGAL::Intersections::internal::intersect_get< std::pair >(*it); if (!b_1) _begin = result->first; if (!b_2) diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h index 4013c139755..1ee97d42289 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/Line_arc_2.h @@ -92,13 +92,13 @@ public: // the circles intersect const std::pair* - result = CGAL::internal::intersect_get >(*it); + result = CGAL::Intersections::internal::intersect_get >(*it); // get must have succeeded if ( result->second == 2 ) // double solution return result->first; if (b) return result->first; ++it; - result = CGAL::internal::intersect_get >(*it); + result = CGAL::Intersections::internal::intersect_get >(*it); return result->first; } @@ -136,14 +136,14 @@ public: CGAL_kernel_precondition(do_intersect(support, l2)); //typedef typename Root_of_2::RT RT_2; typename Intersection_traits::result_type - v = CGAL::internal::intersection(support, l1, CK()); + v = CGAL::Intersections::internal::intersection(support, l1, CK()); CGAL_assertion(bool(v)); - const Point_2 *pt = CGAL::internal::intersect_get(v); + const Point_2 *pt = CGAL::Intersections::internal::intersect_get(v); CGAL_assertion(pt != NULL); _begin = Circular_arc_point_2(*pt); - v = CGAL::internal::intersection(support, l2, CK()); - const Point_2 *pt2 = CGAL::internal::intersect_get(v); + v = CGAL::Intersections::internal::intersection(support, l2, CK()); + const Point_2 *pt2 = CGAL::Intersections::internal::intersect_get(v); CGAL_assertion(pt2 != NULL); _end = Circular_arc_point_2(*pt2); reset_flags(); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h index 40758b51b4a..551fb6fd963 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/function_objects_polynomial_circular.h @@ -508,7 +508,7 @@ namespace CircularFunctors { template result_type operator()(const T1& t1, const T2& t2) const - { return internal::do_intersect(t1, t2, CK()); } + { return Intersections::internal::do_intersect(t1, t2, CK()); } }; template < class CK > diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h index bd39cf5b175..f2293257eb6 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circle_2.h @@ -54,7 +54,7 @@ circle_intersect( const typename CK::Circle_2 & c1, // the circles intersect const std::pair* - result = internal::intersect_get > (*it); + result = Intersections::internal::intersect_get > (*it); if ( result->second == 2 ) // double solution return result->first; @@ -63,7 +63,7 @@ circle_intersect( const typename CK::Circle_2 & c1, return result->first; ++it; - result = internal::intersect_get > (*it); + result = Intersections::internal::intersect_get > (*it); return result->first; } diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h index d0ca21dba38..ad82a932929 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_line_arc_2.h @@ -488,10 +488,10 @@ namespace CircularFunctors { } typename Intersection_traits::result_type - v = CGAL::internal::intersection(a1.supporting_line(), a2.supporting_line(), CK()); + v = CGAL::Intersections::internal::intersection(a1.supporting_line(), a2.supporting_line(), CK()); if(!v) return res; - const Point_2 *pt = CGAL::internal::intersect_get(v); + const Point_2 *pt = CGAL::Intersections::internal::intersect_get(v); if(pt == NULL) return res; Circular_arc_point_2 intersect_point = Circular_arc_point_2(*pt); // (Root_for_circles_2_2(Root_of_2(pt->x()),Root_of_2(pt->y()))); diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h index 37ba0d3e874..fcc0a32b932 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_intersections.h @@ -48,7 +48,8 @@ intersection(const A &c1, const B &c2, OutputIterator res) \ { \ return typename K::Intersect_2()(c1, c2, res); \ } \ -namespace internal { \ +namespace Intersections { \ + namespace internal { \ template \ inline \ bool \ @@ -59,6 +60,7 @@ namespace internal { \ return !res.empty(); \ } \ } \ + } \ template \ inline \ bool \ diff --git a/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp b/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp index 07e3ae302bd..7264fb8f89b 100644 --- a/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp +++ b/Circular_kernel_2/test/Circular_kernel_2/test_Line_arc.cpp @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h index 9e5fec4b652..295877da4e6 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circle_3.h @@ -130,8 +130,8 @@ namespace CGAL { intersect_3(circle,plane,std::back_inserter(inters)); CGAL_kernel_precondition(inters.size()==2); const std::pair* pt[2]={NULL,NULL}; - pt[0]=CGAL::internal::intersect_get >(inters[0]); - pt[1]=CGAL::internal::intersect_get >(inters[1]); + pt[0]=CGAL::Intersections::internal::intersect_get >(inters[0]); + pt[1]=CGAL::Intersections::internal::intersect_get >(inters[1]); CGAL_kernel_precondition(pt[0]!=NULL); CGAL_kernel_precondition(pt[1]!=NULL); diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h index 717f9116c83..5ec837de728 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_circular_arc_3.h @@ -103,12 +103,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); - const Solution& sol2=*CGAL::internal::intersect_get(solutions[1]); + const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(ca,sol1.first,true)) *res++ = solutions[0]; if(SK().has_on_3_object()(ca,sol2.first,true)) @@ -140,12 +140,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); - const Solution& sol2=*CGAL::internal::intersect_get(solutions[1]); + const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(ca,sol1.first,true)) *res++ = solutions[0]; if(SK().has_on_3_object()(ca,sol2.first,true)) @@ -178,12 +178,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(c,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); - const Solution& sol2=*CGAL::internal::intersect_get(solutions[1]); + const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(c,sol1.first,true)) *res++ = solutions[0]; if(SK().has_on_3_object()(c,sol2.first,true)) @@ -215,12 +215,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true)) *res++ = CGAL::internal::sk3_intersection_return(sol); } else { - const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); - const Solution& sol2=*CGAL::internal::intersect_get(solutions[1]); + const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(ca,sol1.first,true)) *res++ = CGAL::internal::sk3_intersection_return(sol1); if(SK().has_on_3_object()(ca,sol2.first,true)) @@ -247,13 +247,13 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true) && SK().has_on_3_object()(la,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); - const Solution& sol2=*CGAL::internal::intersect_get(solutions[1]); + const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(ca,sol1.first,true) && SK().has_on_3_object()(la,sol1.first,true)) *res++ = solutions[0]; @@ -359,13 +359,13 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol=*CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(a1,sol.first,true) && SK().has_on_3_object()(a2,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); - const Solution& sol2=*CGAL::internal::intersect_get(solutions[1]); + const Solution& sol1=*CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(a1,sol1.first,true) && SK().has_on_3_object()(a2,sol1.first,true)) *res++ = solutions[0]; @@ -481,8 +481,8 @@ namespace CGAL { //one endpoint is extremal: just split the arc if (nb_extrem==1){ const std::pair* pt[2]={NULL,NULL}; - pt[0]=CGAL::internal::intersect_get >(inters[0]); - pt[1]=CGAL::internal::intersect_get >(inters[1]); + pt[0]=CGAL::Intersections::internal::intersect_get >(inters[0]); + pt[1]=CGAL::Intersections::internal::intersect_get >(inters[1]); CGAL_kernel_precondition(pt[0]!=NULL); CGAL_kernel_precondition(pt[1]!=NULL); const typename SK::Circular_arc_point_3& midpt=(arc.source()==pt[0]->first || arc.target()==pt[0]->first)?pt[1]->first:pt[0]->first; @@ -496,7 +496,7 @@ namespace CGAL { //only one intersection points if (inters.size()==1){ const std::pair* midpt=NULL; - midpt=CGAL::internal::intersect_get >(inters[0]); + midpt=CGAL::Intersections::internal::intersect_get >(inters[0]); CGAL_kernel_precondition(midpt!=NULL); *out_it++=typename SK::Circular_arc_3(arc.supporting_circle(),arc.source(),midpt->first); *out_it++=typename SK::Circular_arc_3(arc.supporting_circle(),midpt->first,arc.target()); @@ -505,8 +505,8 @@ namespace CGAL { //three arcs are defined by two intersection points const std::pair* pt[2]={NULL,NULL}; - pt[0]=CGAL::internal::intersect_get >(inters[0]); - pt[1]=CGAL::internal::intersect_get >(inters[1]); + pt[0]=CGAL::Intersections::internal::intersect_get >(inters[0]); + pt[1]=CGAL::Intersections::internal::intersect_get >(inters[1]); CGAL_kernel_precondition(pt[0]!=NULL); CGAL_kernel_precondition(pt[1]!=NULL); @@ -590,16 +590,16 @@ namespace CGAL { CGAL_kernel_precondition(!inters.empty()); if (inters.size()==1){ const typename SK::Circular_arc_point_3& pt= - CGAL::internal::intersect_get >(inters[0])->first; + CGAL::Intersections::internal::intersect_get >(inters[0])->first; return pt; } CGAL_kernel_precondition(classify_circle_3(arc.supporting_circle(),sphere)!=NORMAL); const typename SK::Circular_arc_point_3& pts1 = - CGAL::internal::intersect_get >(inters[0])->first; + CGAL::Intersections::internal::intersect_get >(inters[0])->first; const typename SK::Circular_arc_point_3& pts2 = - CGAL::internal::intersect_get >(inters[1])->first; + CGAL::Intersections::internal::intersect_get >(inters[1])->first; //either a polar (1 pole + 1 pt) or a threaded circle (2 pts with theta-coord = +/- pi) diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h index 9a8858dc0fa..2c2e7b8c803 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_line_arc_3.h @@ -101,12 +101,12 @@ namespace CGAL { if(!o) return res; - if(const Point_3* inters_p = CGAL::internal::intersect_get(o)) { + if(const Point_3* inters_p = CGAL::Intersections::internal::intersect_get(o)) { Circular_arc_point_3 p = *inters_p; if(!SK().has_on_3_object()(l1,p,true)) return res; if(!SK().has_on_3_object()(l2,p,true)) return res; *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(p,1u)); - } else if( CGAL::internal::intersect_get(o) ) { + } else if( CGAL::Intersections::internal::intersect_get(o) ) { if(SK().compare_xyz_3_object()(l1.lower_xyz_extremity(), l2.lower_xyz_extremity()) < 0) { int comparison = @@ -167,9 +167,9 @@ namespace CGAL { if(!o) return res; - if(const Line_3* inters_l = CGAL::internal::intersect_get(o)) { + if(const Line_3* inters_l = CGAL::Intersections::internal::intersect_get(o)) { *res++ = CGAL::internal::sk3_intersection_return(la); - } else if(const Point_3* inters_p = CGAL::internal::intersect_get(o)) { + } else if(const Point_3* inters_p = CGAL::Intersections::internal::intersect_get(o)) { Circular_arc_point_3 p = *inters_p; if(!SK().has_on_3_object()(la,p,true)) return res; *res++ = CGAL::internal::sk3_intersection_return(std::make_pair(p,1u)); @@ -195,12 +195,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution* sol = CGAL::internal::intersect_get(solutions[0]); + const Solution* sol = CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(l,(*sol).first,true)) *res++ = solutions[0]; } else { - const Solution* sol1 = CGAL::internal::intersect_get(solutions[0]); - const Solution* sol2 = CGAL::internal::intersect_get(solutions[1]); + const Solution* sol1 = CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution* sol2 = CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(l,(*sol1).first,true)) *res++ = solutions[0]; @@ -226,12 +226,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution* sol = CGAL::internal::intersect_get(solutions[0]); + const Solution* sol = CGAL::Intersections::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(l,(*sol).first,true)) *res++ = solutions[0]; } else { - const Solution* sol1 = CGAL::internal::intersect_get(solutions[0]); - const Solution* sol2 = CGAL::internal::intersect_get(solutions[1]); + const Solution* sol1 = CGAL::Intersections::internal::intersect_get(solutions[0]); + const Solution* sol2 = CGAL::Intersections::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(l,(*sol1).first,true)) *res++ = solutions[0]; if(SK().has_on_3_object()(l,(*sol2).first,true)) @@ -257,7 +257,7 @@ namespace CGAL { if(!o) return res; - if((sol = CGAL::internal::intersect_get(o))) { + if((sol = CGAL::Intersections::internal::intersect_get(o))) { if(!SK().has_on_3_object()(l,*sol)) return res; Circular_arc_point_3 point = sol; *res++ = result_type(std::make_pair(point,1u)); diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h index 4c0936086ee..81c43824786 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/internal_functions_on_sphere_3.h @@ -336,7 +336,7 @@ namespace CGAL { typename Intersection_traits::result_type v = SK().intersect_3_object()(s1, s2); if(!v) return res; - if(const Point_3* p = CGAL::internal::intersect_get(v)) { + if(const Point_3* p = CGAL::Intersections::internal::intersect_get(v)) { if(SK().has_on_3_object()(s3, *p)) { #if CGAL_INTERSECTION_VERSION < 2 *res++ = make_object(std::make_pair(Circular_arc_point_3(*p),2u)); @@ -346,7 +346,7 @@ namespace CGAL { } return res; } - if(const Circle_3* c = CGAL::internal::intersect_get(v)) { + if(const Circle_3* c = CGAL::Intersections::internal::intersect_get(v)) { if(SK().has_on_3_object()(s3, *c)) { #if CGAL_INTERSECTION_VERSION < 2 *res++ = make_object(*c); diff --git a/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h b/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h index 2adfd88f51e..1f2af032485 100644 --- a/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h +++ b/Circular_kernel_3/include/CGAL/Spherical_kernel_intersections.h @@ -38,6 +38,14 @@ namespace CGAL { +#define CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_JUST_INTERSECTION_2_(A,B) \ +template < class OutputIterator, class K > \ +OutputIterator \ +intersection(const A &c1, const B &c2, OutputIterator res) \ +{ \ + return typename K::Intersect_3()(c1, c2, res); \ +} + #define CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_2_(A,B) \ template < class OutputIterator, class K > \ OutputIterator \ @@ -68,8 +76,8 @@ do_intersect(const A &c1, const B &c2, const C &c3) \ return typename K::Do_intersect_3()(c1, c2, c3); \ } -CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_2_(Sphere_3, Line_3) -CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_2_(Line_3, Sphere_3) +CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_JUST_INTERSECTION_2_(Sphere_3, Line_3) +CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_JUST_INTERSECTION_2_(Line_3, Sphere_3) CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_3_(Sphere_3, Sphere_3, Sphere_3) CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_3_(Sphere_3, Sphere_3, Plane_3) CGAL_SPHERICAL_KERNEL_MACRO_GLOBAL_FUNCTION_INTERSECTION_3_(Plane_3, Sphere_3, Sphere_3) diff --git a/Convex_hull_2/include/CGAL/segment_intersection_points_2.h b/Convex_hull_2/include/CGAL/segment_intersection_points_2.h index b40dc0c2cbe..5346059e350 100644 --- a/Convex_hull_2/include/CGAL/segment_intersection_points_2.h +++ b/Convex_hull_2/include/CGAL/segment_intersection_points_2.h @@ -32,7 +32,7 @@ namespace CGAL { /* -#include +#include template OutputIterator si_brute_force(ForwardIterator first, ForwardIterator last, diff --git a/Convex_hull_d/package_info/Convex_hull_d/dependencies b/Convex_hull_d/package_info/Convex_hull_d/dependencies index acd33093f76..81659211144 100644 --- a/Convex_hull_d/package_info/Convex_hull_d/dependencies +++ b/Convex_hull_d/package_info/Convex_hull_d/dependencies @@ -14,3 +14,4 @@ Number_types Profiling_tools STL_Extension Stream_support +Distance_3 diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_2.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_2.h index 2deb02212e4..86345327149 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_2.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_2.h @@ -69,19 +69,19 @@ public: result_type operator()(const Segment_2 &s, const Segment_2& t) const { - return internal::do_intersect(s,t, SFK()); + return Intersections::internal::do_intersect(s,t, SFK()); } result_type operator()(const Point_2 &p, const Segment_2& t) const { - return internal::do_intersect(p,t, SFK()); + return Intersections::internal::do_intersect(p,t, SFK()); } result_type operator()(const Segment_2& t, const Point_2 &p) const { - return internal::do_intersect(p,t, SFK()); + return Intersections::internal::do_intersect(p,t, SFK()); } }; diff --git a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h index 5f51183e530..43eaca91403 100644 --- a/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h +++ b/Filtered_kernel/include/CGAL/internal/Static_filters/Do_intersect_3.h @@ -30,7 +30,7 @@ #include #include -#include +#include // for CGAL::internal::do_intersect_bbox_segment_aux #include @@ -89,13 +89,13 @@ public: result_type operator()(const Segment_3 &s, const Triangle_3& t) const { - return internal::do_intersect(t,s, SFK()); + return Intersections::internal::do_intersect(t,s, SFK()); } result_type operator()(const Triangle_3& t, const Segment_3 &s) const { - return internal::do_intersect(t,s, SFK()); + return Intersections::internal::do_intersect(t,s, SFK()); } result_type @@ -124,7 +124,7 @@ public: CGAL_BRANCH_PROFILER_BRANCH_1(tmp); const Uncertain ub = - do_intersect_bbox_segment_aux + Intersections::internal::do_intersect_bbox_segment_aux ub = - do_intersect_bbox_segment_aux + Intersections::internal::do_intersect_bbox_segment_aux \ inline \ @@ -143,6 +145,8 @@ template class IT : public Intersection_traits< typename Kernel_traits::Kernel, CGAL::Bbox_3, B > { }; + +namespace Intersections { namespace internal { // this function is used to call either make_object or a @@ -246,8 +250,9 @@ do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { return Kernel().do_intersect_d_object()(a, b); } -} // internal - +} // namespace internal +} // namespace Intersections + // See overloads in the respective header files // template 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 new file mode 100644 index 00000000000..aaa9f323f1c --- /dev/null +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Circle_2.h @@ -0,0 +1,46 @@ +// Copyright (c) 2018 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Andreas Fabri +// + +#ifndef CGAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_H +#define CGAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_H + +#include +#include + +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_2& a, + const Circle_2& b) { + return K().do_intersect_2_object()(a, b); +} + +template +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/Bbox_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h similarity index 93% rename from Intersections_2/include/CGAL/Bbox_2_Line_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h index 515bd311f05..c5804de228c 100644 --- a/Intersections_2/include/CGAL/Bbox_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Line_2.h @@ -24,13 +24,11 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_BBOX_2_LINE_2_INTERSECTION_H -#define CGAL_BBOX_2_LINE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_BBOX_2_LINE_2_H +#define CGAL_INTERSECTIONS_2_BBOX_2_LINE_2_H #include #include -//#include -//#include #include #include @@ -98,7 +96,7 @@ inline bool do_intersect( } //namespace CGAL #ifdef CGAL_HEADER_ONLY -#include +#include #endif // CGAL_HEADER_ONLY #endif 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 new file mode 100644 index 00000000000..5df79996e48 --- /dev/null +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Point_2.h @@ -0,0 +1,97 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_2_BBOX_2_POINT_2_H +#define CGAL_INTERSECTIONS_2_BBOX_2_POINT_2_H + +#include +#include + +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_2& a, + 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) +{ + return do_intersect(b,a); +} + +namespace Intersections { + +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(); +} + + +template +typename CGAL::Intersection_traits::result_type +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(); +} + +} // namespace internal +} // namespace Intersections + +template +typename CGAL::Intersection_traits >::result_type +intersection(const Bbox_2& b, + const Point_2 & a) +{ + return Intersections::internal::intersection(b,a,K()); +} + +template +typename CGAL::Intersection_traits >::result_type + intersection(const Point_2 & a, + const Bbox_2& b) +{ + return Intersections::internal::intersection(b,a,K()); +} +} // namespace CGAL + +#endif // CGAL_INTERSECTIONS_2_BBOX_2_POINT_2_H diff --git a/Intersections_2/include/CGAL/Ray_2_Bbox_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h similarity index 93% rename from Intersections_2/include/CGAL/Ray_2_Bbox_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h index cf902aae04a..512f4779b2f 100644 --- a/Intersections_2/include/CGAL/Ray_2_Bbox_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Bbox_2_Ray_2.h @@ -24,8 +24,8 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_RAY_2_BBOX_2_INTERSECTION_H -#define CGAL_RAY_2_BBOX_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_BBOX_2_RAY_2_H +#define CGAL_INTERSECTIONS_BBOX_2_RAY_2_H #include #include @@ -77,7 +77,7 @@ inline bool do_intersect_ray_2( } //namespace CGAL #ifdef CGAL_HEADER_ONLY -#include +#include #endif // CGAL_HEADER_ONLY #endif diff --git a/Intersections_2/include/CGAL/Circle_2_Circle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h similarity index 91% rename from Intersections_2/include/CGAL/Circle_2_Circle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h index 05b3ca66e32..230d2e6791a 100644 --- a/Intersections_2/include/CGAL/Circle_2_Circle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Circle_2.h @@ -24,13 +24,15 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_CIRCLE_2_CIRCLE_2_INTERSECTION_H -#define CGAL_CIRCLE_2_CIRCLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_CIRCLE_2_CIRCLE_2_H +#define CGAL_INTERSECTIONS_2_CIRCLE_2_CIRCLE_2_H #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -49,6 +51,7 @@ do_intersect(const typename K::Circle_2 & circ1, } } // namespace internal +} // namespace Intersections template inline 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 new file mode 100644 index 00000000000..8aae18ec2d2 --- /dev/null +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Iso_rectangle_2.h @@ -0,0 +1,35 @@ +// Copyright (c) 2018 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Andreas Fabri +// + +#ifndef CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_CIRCLE_2_H +#define CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_CIRCLE_2_H + +#include +#include + +#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/Circle_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h similarity index 92% rename from Intersections_2/include/CGAL/Circle_2_Line_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h index a7fbe843c1e..c678fa3b426 100644 --- a/Intersections_2/include/CGAL/Circle_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Line_2.h @@ -24,15 +24,15 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_CIRCLE_2_LINE_2_INTERSECTION_H -#define CGAL_CIRCLE_2_LINE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_CIRCLE_2_LINE_2_H +#define CGAL_INTERSECTIONS_2_CIRCLE_2_LINE_2_H #include #include #include namespace CGAL { - +namespace Intersections { namespace internal { template @@ -54,7 +54,8 @@ do_intersect(const typename K::Line_2& l, } } // namespace internal - +} // namespace Intersections + template inline bool 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 new file mode 100644 index 00000000000..17483d4ec86 --- /dev/null +++ b/Intersections_2/include/CGAL/Intersections_2/Circle_2_Point_2.h @@ -0,0 +1,86 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H +#define CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline +bool +do_intersect(const typename K::Point_2 &pt, + const typename K::Circle_2 &circle, + const K&) +{ + return circle.has_on_boundary(pt); +} + + +template +inline +bool +do_intersect(const typename K::Circle_2 &circle, + const typename K::Point_2 &pt, + const K&) +{ + return circle.has_on_boundary(pt); +} + + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_2 &pt, + const typename K::Circle_2 &circle, + const K& k) +{ + if (do_intersect(pt,circle, k)) + return intersection_return(pt); + return intersection_return(); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Circle_2 &circle, + const typename K::Point_2 &pt, + const K& k) +{ + return internal::intersection(pt, circle, k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_2, Circle_2, 2) +CGAL_DO_INTERSECT_FUNCTION(Circle_2, Point_2, 2) + +} //namespace CGAL +#endif // CGAL_INTERSECTIONS_2_POINT_2_CIRCLE_2_H diff --git a/Intersections_2/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h similarity index 95% rename from Intersections_2/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h index 6677e951f39..2f50e2e6e28 100644 --- a/Intersections_2/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Iso_rectangle_2.h @@ -24,13 +24,15 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_ISO_RECTANGLE_2_ISO_RECTANGLE_2_INTERSECTION_H -#define CGAL_ISO_RECTANGLE_2_ISO_RECTANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_ISO_RECTANGLE_2_H +#define CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_ISO_RECTANGLE_2_H #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -89,6 +91,7 @@ do_intersect(const typename K::Iso_rectangle_2 &irect1, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION_SELF(Iso_rectangle_2, 2) diff --git a/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h similarity index 97% rename from Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h index 70cc67ce43d..9d085b4a2aa 100644 --- a/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Line_2.h @@ -24,20 +24,21 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_LINE_2_ISO_RECTANGLE_2_INTERSECTION_H -#define CGAL_LINE_2_ISO_RECTANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_LINE_2_H +#define CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_LINE_2_H #include #include #include -#include #include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -219,6 +220,7 @@ intersection(const typename K::Iso_rectangle_2 &iso, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Line_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Line_2, Iso_rectangle_2, 2) diff --git a/Intersections_2/include/CGAL/Point_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h similarity index 93% rename from Intersections_2/include/CGAL/Point_2_Iso_rectangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h index bbe234b9eed..5a52d5dd142 100644 --- a/Intersections_2/include/CGAL/Point_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Point_2.h @@ -24,14 +24,16 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_POINT_2_ISO_RECTANGLE_2_INTERSECTION_H -#define CGAL_POINT_2_ISO_RECTANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_POINT_2_ISO_RECTANGLE_2_H +#define CGAL_INTERSECTIONS_2_POINT_2_ISO_RECTANGLE_2_H #include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -79,6 +81,7 @@ intersection(const typename K::Iso_rectangle_2 &iso, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Point_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Iso_rectangle_2, 2) diff --git a/Intersections_2/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h similarity index 97% rename from Intersections_2/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h index 8a862b153dd..1b925bf7003 100644 --- a/Intersections_2/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Ray_2.h @@ -24,20 +24,20 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_RAY_2_ISO_RECTANGLE_2_INTERSECTION_H -#define CGAL_RAY_2_ISO_RECTANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_RAY_2_H +#define CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_RAY_2_H #include #include #include -#include -#include #include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -206,6 +206,7 @@ Ray_2_Iso_rectangle_2_pair::intersection_point() const } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Ray_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Iso_rectangle_2, 2) diff --git a/Intersections_2/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h similarity index 97% rename from Intersections_2/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h index 7b85db690b2..423b7d40a61 100644 --- a/Intersections_2/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Segment_2.h @@ -24,20 +24,22 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_SEGMENT_2_ISO_RECTANGLE_2_INTERSECTION_H -#define CGAL_SEGMENT_2_ISO_RECTANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_SEGMENT_2_H +#define CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_SEGMENT_2_H #include #include #include -#include #include #include #include namespace CGAL { + +namespace Intersections { + namespace internal { template @@ -232,6 +234,7 @@ inline bool do_intersect( } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Segment_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Iso_rectangle_2, 2) diff --git a/Intersections_2/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h similarity index 97% rename from Intersections_2/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h index 1e6a4c4e269..58991d7dfde 100644 --- a/Intersections_2/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Iso_rectangle_2_Triangle_2.h @@ -19,22 +19,24 @@ // // Author(s) : Radu Ursu -#ifndef CGAL_TRIANGLE_2_ISO_RECTANGLE_2_INTERSECTION_H -#define CGAL_TRIANGLE_2_ISO_RECTANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_TRIANGLE_2_H +#define CGAL_INTERSECTIONS_2_ISO_RECTANGLE_2_TRIANGLE_2_H -#include -#include #include #include -#include +#include #include -#include +#include #include #include -namespace CGAL{ namespace internal { +namespace CGAL{ + +namespace Intersections { + +namespace internal { template typename Intersection_traits::result_type @@ -331,6 +333,7 @@ namespace CGAL{ namespace internal { } } //namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Triangle_2, Iso_rectangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Triangle_2, Iso_rectangle_2, 2) diff --git a/Intersections_2/include/CGAL/Line_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h similarity index 96% rename from Intersections_2/include/CGAL/Line_2_Line_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h index 8748f689415..b1dca54be02 100644 --- a/Intersections_2/include/CGAL/Line_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Line_2.h @@ -24,18 +24,22 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_LINE_2_LINE_2_INTERSECTION_H -#define CGAL_LINE_2_LINE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_LINE_2_LINE_2_H +#define CGAL_INTERSECTIONS_2_LINE_2_LINE_2_H #include #include -#include #include #include #include namespace CGAL { +class Cartesian_tag; +class Homogeneous_tag; + +namespace Intersections { + namespace internal { template @@ -202,6 +206,7 @@ Line_2_Line_2_pair::intersection_line() const } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION_SELF(Line_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Line_2, 2) diff --git a/Intersections_2/include/CGAL/Point_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h similarity index 93% rename from Intersections_2/include/CGAL/Point_2_Line_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h index b57a8bfcb78..9838ea93468 100644 --- a/Intersections_2/include/CGAL/Point_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Point_2.h @@ -24,14 +24,16 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_POINT_2_LINE_2_INTERSECTION_H -#define CGAL_POINT_2_LINE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_POINT_2_LINE_2_H +#define CGAL_INTERSECTIONS_2_POINT_2_LINE_2_H #include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -77,6 +79,8 @@ intersection(const typename K::Line_2 &line, } } // namespace internal +} // namespace Intersections + CGAL_INTERSECTION_FUNCTION(Point_2, Line_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Line_2, 2) diff --git a/Intersections_2/include/CGAL/Ray_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h similarity index 96% rename from Intersections_2/include/CGAL/Ray_2_Line_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h index ca9ca2308fb..bc8bb35cdd9 100644 --- a/Intersections_2/include/CGAL/Ray_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Ray_2.h @@ -24,18 +24,20 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_RAY_2_LINE_2_INTERSECTION_H -#define CGAL_RAY_2_LINE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_LINE_2_RAY_2_H +#define CGAL_INTERSECTIONS_2_LINE_2_RAY_2_H #include #include #include #include #include -#include +#include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -166,6 +168,7 @@ Ray_2_Line_2_pair::intersection_ray() const } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Ray_2, Line_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Line_2, 2) diff --git a/Intersections_2/include/CGAL/Segment_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h similarity index 95% rename from Intersections_2/include/CGAL/Segment_2_Line_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h index 6eb9459dd65..e26ebae6b47 100644 --- a/Intersections_2/include/CGAL/Segment_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Segment_2.h @@ -24,18 +24,19 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_SEGMENT_2_LINE_2_INTERSECTION_H -#define CGAL_SEGMENT_2_LINE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_SEGMENT_2_LINE_2_H +#define CGAL_INTERSECTIONS_2_SEGMENT_2_LINE_2_H #include #include -#include #include #include -#include +#include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -159,6 +160,7 @@ Segment_2_Line_2_pair::intersection_segment() const } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Segment_2, Line_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Line_2, 2) diff --git a/Intersections_2/include/CGAL/Line_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h similarity index 96% rename from Intersections_2/include/CGAL/Line_2_Triangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h index 1818e1e7c91..5f1c817b792 100644 --- a/Intersections_2/include/CGAL/Line_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Line_2_Triangle_2.h @@ -24,19 +24,21 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_LINE_2_TRIANGLE_2_INTERSECTION_H -#define CGAL_LINE_2_TRIANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_LINE_2_TRIANGLE_2_H +#define CGAL_INTERSECTIONS_2_LINE_2_TRIANGLE_2_H #include #include #include #include -#include +#include #include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -194,6 +196,7 @@ intersection(const typename K::Triangle_2 &tr, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Line_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Line_2, Triangle_2, 2) diff --git a/Intersections_2/include/CGAL/Point_2_Point_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h similarity index 92% rename from Intersections_2/include/CGAL/Point_2_Point_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h index 70d8e9e4d13..0baa0f0a6a8 100644 --- a/Intersections_2/include/CGAL/Point_2_Point_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Point_2.h @@ -24,13 +24,15 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_POINT_2_POINT_2_INTERSECTION_H -#define CGAL_POINT_2_POINT_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_POINT_2_POINT_2_H +#define CGAL_INTERSECTIONS_2_POINT_2_POINT_2_H #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -55,6 +57,7 @@ intersection(const typename K::Point_2 &pt1, } }// namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION_SELF(Point_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Point_2, 2) diff --git a/Intersections_2/include/CGAL/Point_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h similarity index 93% rename from Intersections_2/include/CGAL/Point_2_Ray_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h index 3a6e6ec1b1d..c7efa2cc868 100644 --- a/Intersections_2/include/CGAL/Point_2_Ray_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Ray_2.h @@ -24,14 +24,16 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_POINT_2_RAY_2_INTERSECTION_H -#define CGAL_POINT_2_RAY_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_POINT_2_RAY_2_H +#define CGAL_INTERSECTIONS_2_POINT_2_RAY_2_H #include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -81,6 +83,7 @@ intersection(const typename K::Ray_2 &ray, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Point_2, Ray_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Ray_2, 2) diff --git a/Intersections_2/include/CGAL/Point_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h similarity index 93% rename from Intersections_2/include/CGAL/Point_2_Segment_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h index 47563eb2003..94edc1ad098 100644 --- a/Intersections_2/include/CGAL/Point_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Segment_2.h @@ -24,14 +24,16 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_POINT_2_SEGMENT_2_INTERSECTION_H -#define CGAL_POINT_2_SEGMENT_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_POINT_2_SEGMENT_2_H +#define CGAL_INTERSECTIONS_2_POINT_2_SEGMENT_2_H #include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -82,6 +84,8 @@ intersection( const typename K::Segment_2 &seg, } } // namespace internal +} // namespace Intersections + CGAL_INTERSECTION_FUNCTION(Point_2, Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Segment_2, 2) diff --git a/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h similarity index 82% rename from Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h index 6e4b25e9d32..c758d55a66b 100644 --- a/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Point_2_Triangle_2.h @@ -24,18 +24,19 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_POINT_2_TRIANGLE_2_INTERSECTION_H -#define CGAL_POINT_2_TRIANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_POINT_2_TRIANGLE_2_H +#define CGAL_INTERSECTIONS_2_POINT_2_TRIANGLE_2_H #include #include -#include #include #include -#include +#include namespace CGAL { +namespace Intersections { + namespace internal { template @@ -91,26 +92,6 @@ Point_2_Triangle_2_pair::intersection_type() const _result = POINT; } return _result; -/* - typedef typename K::Line_2 line_t; - line_t l(_trian->vertex(0), _trian->vertex(1)); - if (l.has_on_positive_side(_trian->vertex(2))) { - for (int i=0; i<3; i++) { - if (line_t(_trian->vertex(i), _trian->vertex(i+1)). - has_on_negative_side(*_pt)) { - _result = NO_INTERSECTION; - return _result; - } - } - } else { - for (int i=0; i<3; i++) - if(line_t(_trian->vertex(i), _trian->vertex(i-1)). - has_on_negative_side(*_pt)){ - _result = NO_INTERSECTION; - return _result; - } - } -*/ } @@ -158,6 +139,7 @@ intersection(const typename K::Triangle_2 &tr, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Point_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Point_2, Triangle_2, 2) diff --git a/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h similarity index 97% rename from Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h index 2ef90d97dc9..5413d498b2e 100644 --- a/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Ray_2.h @@ -24,20 +24,21 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_RAY_2_RAY_2_INTERSECTION_H -#define CGAL_RAY_2_RAY_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_RAY_2_RAY_2_H +#define CGAL_INTERSECTIONS_2_RAY_2_RAY_2_H #include #include #include #include #include -#include -#include +#include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -257,6 +258,7 @@ intersection(const typename K::Ray_2 &ray1, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION_SELF(Ray_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Ray_2, 2) diff --git a/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h similarity index 97% rename from Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h index 07630d0ae79..323f285aef2 100644 --- a/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Segment_2.h @@ -24,20 +24,22 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_RAY_2_SEGMENT_2_INTERSECTION_H -#define CGAL_RAY_2_SEGMENT_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_RAY_2_SEGMENT_2_H +#define CGAL_INTERSECTIONS_2_RAY_2_SEGMENT_2_H #include #include #include +#include #include #include -#include -#include +#include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -269,6 +271,7 @@ intersection(const typename K::Segment_2 &seg, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Ray_2, Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Segment_2, 2) diff --git a/Intersections_2/include/CGAL/Ray_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h similarity index 96% rename from Intersections_2/include/CGAL/Ray_2_Triangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h index 740f9c42d77..650eb3ad0ab 100644 --- a/Intersections_2/include/CGAL/Ray_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Ray_2_Triangle_2.h @@ -24,20 +24,19 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_RAY_2_TRIANGLE_2_INTERSECTION_H -#define CGAL_RAY_2_TRIANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_RAY_2_TRIANGLE_2_H +#define CGAL_INTERSECTIONS_2_RAY_2_TRIANGLE_2_H -#include #include #include -#include -#include #include #include -#include +#include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -200,6 +199,7 @@ inline bool do_intersect( } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Ray_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Ray_2, Triangle_2, 2) diff --git a/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h similarity index 98% rename from Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h index 216ebdaff4c..da7cebe3db8 100644 --- a/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Segment_2.h @@ -24,8 +24,8 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_SEGMENT_2_SEGMENT_2_INTERSECTION_H -#define CGAL_SEGMENT_2_SEGMENT_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_SEGMENT_2_SEGMENT_2_H +#define CGAL_INTERSECTIONS_2_SEGMENT_2_SEGMENT_2_H #include #include @@ -33,11 +33,13 @@ #include #include #include -#include +#include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -453,6 +455,7 @@ intersection(const typename K::Segment_2 &seg1, } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION_SELF(Segment_2, 2) CGAL_DO_INTERSECT_FUNCTION_SELF(Segment_2, 2) diff --git a/Intersections_2/include/CGAL/Segment_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h similarity index 96% rename from Intersections_2/include/CGAL/Segment_2_Triangle_2_intersection.h rename to Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h index 1de8852547d..4f8cc825748 100644 --- a/Intersections_2/include/CGAL/Segment_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Intersections_2/Segment_2_Triangle_2.h @@ -24,19 +24,19 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_SEGMENT_2_TRIANGLE_2_INTERSECTION_H -#define CGAL_SEGMENT_2_TRIANGLE_2_INTERSECTION_H +#ifndef CGAL_INTERSECTIONS_2_SEGMENT_2_TRIANGLE_2_H +#define CGAL_INTERSECTIONS_2_SEGMENT_2_TRIANGLE_2_H #include #include -#include -#include #include #include -#include +#include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -198,6 +198,7 @@ inline bool do_intersect( } } // namespace internal +} // namespace Intersections CGAL_INTERSECTION_FUNCTION(Segment_2, Triangle_2, 2) CGAL_DO_INTERSECT_FUNCTION(Segment_2, Triangle_2, 2) diff --git a/Intersections_2/include/CGAL/intersection_2_3.h b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h similarity index 69% rename from Intersections_2/include/CGAL/intersection_2_3.h rename to Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h index 55f8d7b0c3c..09bdea7198d 100644 --- a/Intersections_2/include/CGAL/intersection_2_3.h +++ b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2.h @@ -24,11 +24,15 @@ // Author(s) : Geert-Jan Giezeman +#ifndef CGAL_INTERSECTIONS_2_TRIANGLE_2_TRIANGLE_2_H +#define CGAL_INTERSECTIONS_2_TRIANGLE_2_TRIANGLE_2_H -#ifndef CGAL_INTERSECTION_2_3_H -#define CGAL_INTERSECTION_2_3_H +#include +#include -#include -#include +namespace CGAL { +CGAL_DO_INTERSECT_FUNCTION_SELF(Triangle_2, 2) +CGAL_INTERSECTION_FUNCTION_SELF(Triangle_2, 2) +} // namespace CGAL #endif 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 new file mode 100644 index 00000000000..6306d383ef3 --- /dev/null +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Circle_2_do_intersect.h @@ -0,0 +1,112 @@ +// Copyright (c) 2018 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Andreas Fabri + + +#ifndef CGAL_INTERNAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_DO_INTERSECT_H +#define CGAL_INTERNAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_DO_INTERSECT_H + +#include +#include + +#include + + +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; + } + + return distance <= circle.squared_radius(); +} + +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 +} //namespace CGAL + +#endif // CGAL_INTERNAL_INTERSECTIONS_2_BBOX_2_CIRCLE_2_DO_INTERSECT_H diff --git a/Intersections_2/include/CGAL/Bbox_2_Line_2_intersection_impl.h b/Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Line_2_intersection_impl.h similarity index 100% rename from Intersections_2/include/CGAL/Bbox_2_Line_2_intersection_impl.h rename to Intersections_2/include/CGAL/Intersections_2/internal/Bbox_2_Line_2_intersection_impl.h diff --git a/Intersections_2/include/CGAL/Ray_2_Bbox_2_intersection_impl.h b/Intersections_2/include/CGAL/Intersections_2/internal/Ray_2_Bbox_2_intersection_impl.h similarity index 100% rename from Intersections_2/include/CGAL/Ray_2_Bbox_2_intersection_impl.h rename to Intersections_2/include/CGAL/Intersections_2/internal/Ray_2_Bbox_2_intersection_impl.h diff --git a/Intersections_2/include/CGAL/Straight_2.h b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h similarity index 96% rename from Intersections_2/include/CGAL/Straight_2.h rename to Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h index 5c9553ddf5d..490fddf2698 100644 --- a/Intersections_2/include/CGAL/Straight_2.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Straight_2.h @@ -24,14 +24,16 @@ // Author(s) : Geert-Jan Giezeman -#ifndef CGAL_STRAIGHT_2_H -#define CGAL_STRAIGHT_2_H +#ifndef CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H +#define CGAL_INTERSECTIONS_2_INTERNAL_STRAIGHT_2_H -#include +#include #include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -267,8 +269,8 @@ sign_of_cross(typename K::Direction_2 const &dir1, typename K::Direction_2 const &dir2, const K&) { - return static_cast(internal::orientation(dir1.to_vector(), - dir2.to_vector(), K())); + return static_cast(CGAL::internal::orientation(dir1.to_vector(), + dir2.to_vector(), K())); } template @@ -351,12 +353,7 @@ collinear_order(typename K::Point_2 const &pt1, typename K::Point_2 const & pt2) } } // namespace internal - +} // namespace Intersections } //namespace CGAL - - - - - #endif diff --git a/Intersections_2/include/CGAL/Triangle_2_Triangle_2_do_intersect.h b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h similarity index 98% rename from Intersections_2/include/CGAL/Triangle_2_Triangle_2_do_intersect.h rename to Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h index 23c752a5897..7bdc6542428 100644 --- a/Intersections_2/include/CGAL/Triangle_2_Triangle_2_do_intersect.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_do_intersect_impl.h @@ -26,8 +26,8 @@ #include namespace CGAL { - - + +namespace Intersections { namespace internal { @@ -172,9 +172,7 @@ bool do_intersect(const typename K::Triangle_2 &t1, } } // namespace internal - -CGAL_DO_INTERSECT_FUNCTION_SELF(Triangle_2, 2) - +} // namespace Intersections } //namespace CGAL #endif //CGAL_TRIANGLE_2_TRIANGLE_2_DO_INTERSECT_H diff --git a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_intersection_impl.h similarity index 98% rename from Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h rename to Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_intersection_impl.h index 3592deca591..ab5d9386874 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h +++ b/Intersections_2/include/CGAL/Intersections_2/internal/Triangle_2_Triangle_2_intersection_impl.h @@ -23,17 +23,17 @@ // // Author(s) : Geert-Jan Giezeman -#include #include -#include #include #include #include -#include +#include #include namespace CGAL { + +namespace Intersections { namespace internal { @@ -349,7 +349,5 @@ intersection(const typename K::Triangle_2 &tr1, } } // namespace internal - -CGAL_INTERSECTION_FUNCTION_SELF(Triangle_2, 2) - +} // namespace Intersections } //namespace CGAL diff --git a/Intersections_2/include/CGAL/Iso_rectangle_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Iso_rectangle_2_Line_2_intersection.h deleted file mode 100644 index 1ea17f837e0..00000000000 --- a/Intersections_2/include/CGAL/Iso_rectangle_2_Line_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Iso_rectangle_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Iso_rectangle_2_Segment_2_intersection.h deleted file mode 100644 index cadfdfbbce7..00000000000 --- a/Intersections_2/include/CGAL/Iso_rectangle_2_Segment_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Line_2_Bbox_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Bbox_2_intersection.h deleted file mode 100644 index 59b6a2c982c..00000000000 --- a/Intersections_2/include/CGAL/Line_2_Bbox_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Line_2_Point_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Point_2_intersection.h deleted file mode 100644 index d957a00b1eb..00000000000 --- a/Intersections_2/include/CGAL/Line_2_Point_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Line_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Ray_2_intersection.h deleted file mode 100644 index ba965eae711..00000000000 --- a/Intersections_2/include/CGAL/Line_2_Ray_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Line_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Segment_2_intersection.h deleted file mode 100644 index 36e4429f9b3..00000000000 --- a/Intersections_2/include/CGAL/Line_2_Segment_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Ray_2_Point_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Point_2_intersection.h deleted file mode 100644 index 44bb85184cb..00000000000 --- a/Intersections_2/include/CGAL/Ray_2_Point_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Segment_2_Point_2_intersection.h b/Intersections_2/include/CGAL/Segment_2_Point_2_intersection.h deleted file mode 100644 index d8da2c4a887..00000000000 --- a/Intersections_2/include/CGAL/Segment_2_Point_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Segment_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Segment_2_Ray_2_intersection.h deleted file mode 100644 index e723553a143..00000000000 --- a/Intersections_2/include/CGAL/Segment_2_Ray_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Triangle_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Triangle_2_Line_2_intersection.h deleted file mode 100644 index bf7e131465a..00000000000 --- a/Intersections_2/include/CGAL/Triangle_2_Line_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Triangle_2_Point_2_intersection.h b/Intersections_2/include/CGAL/Triangle_2_Point_2_intersection.h deleted file mode 100644 index 2185ccd20c2..00000000000 --- a/Intersections_2/include/CGAL/Triangle_2_Point_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Triangle_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Triangle_2_Ray_2_intersection.h deleted file mode 100644 index 9ebf9300661..00000000000 --- a/Intersections_2/include/CGAL/Triangle_2_Ray_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/Triangle_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Triangle_2_Segment_2_intersection.h deleted file mode 100644 index 8025b5fc3ca..00000000000 --- a/Intersections_2/include/CGAL/Triangle_2_Segment_2_intersection.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - -#include diff --git a/Intersections_2/include/CGAL/intersection_2.h b/Intersections_2/include/CGAL/intersection_2.h index cce2e59e778..d1672662b5b 100644 --- a/Intersections_2/include/CGAL/intersection_2.h +++ b/Intersections_2/include/CGAL/intersection_2.h @@ -28,8 +28,40 @@ #ifndef CGAL_INTERSECTION_2_H #define CGAL_INTERSECTION_2_H -#include -#include -#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include + #endif // CGAL_INTERSECTION_2_H diff --git a/Intersections_2/include/CGAL/intersection_2_1.h b/Intersections_2/include/CGAL/intersection_2_1.h deleted file mode 100644 index 14046e5da92..00000000000 --- a/Intersections_2/include/CGAL/intersection_2_1.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - - - -#ifndef CGAL_INTERSECTION_2_1_H -#define CGAL_INTERSECTION_2_1_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/Intersections_2/include/CGAL/intersection_2_2.h b/Intersections_2/include/CGAL/intersection_2_2.h deleted file mode 100644 index 9059ecf1412..00000000000 --- a/Intersections_2/include/CGAL/intersection_2_2.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Geert-Jan Giezeman - - - -#ifndef CGAL_INTERSECTION_2_2_H -#define CGAL_INTERSECTION_2_2_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#endif diff --git a/Intersections_2/src/CGAL/Bbox_2_intersections.cpp b/Intersections_2/src/CGAL/Bbox_2_intersections.cpp index 63d0ddd12bb..3e0edcecc58 100644 --- a/Intersections_2/src/CGAL/Bbox_2_intersections.cpp +++ b/Intersections_2/src/CGAL/Bbox_2_intersections.cpp @@ -25,10 +25,10 @@ #ifndef CGAL_HEADER_ONLY -#include -#include +#include +#include -#include -#include +#include +#include #endif // CGAL_HEADER_ONLY diff --git a/Intersections_2/test/Intersections_2/test_intersections_2.cpp b/Intersections_2/test/Intersections_2/test_intersections_2.cpp index 512236d8933..b43d81c9643 100644 --- a/Intersections_2/test/Intersections_2/test_intersections_2.cpp +++ b/Intersections_2/test/Intersections_2/test_intersections_2.cpp @@ -8,12 +8,17 @@ #include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include #include #include @@ -65,6 +70,7 @@ struct Test { typedef CGAL::Ray_2< K > R; typedef CGAL::Triangle_2< K > T; typedef CGAL::Iso_rectangle_2< K > Rec; + typedef CGAL::Circle_2< K > C; typedef std::vector

Pol; @@ -152,6 +158,17 @@ struct Test { return P(to_nt(x*w), to_nt(y*w), to_nt(w)); } + void B_P() + { + CGAL::Bbox_2 bb(0,0,10,10); + P p(1,0), bl(0,0), tr(10,10); + C c(bl,1); + Rec r(bl,tr); + check_intersection(bb,p,p,true); + check_intersection(c,p,p,true); + assert(do_intersect(r,c)); + } + void L_L() { std::cout << "Line - Line\n"; @@ -330,6 +347,7 @@ check_no_intersection (L(p(0, 0), p(10,10)), L(p(8,7), p(1, 0))); void run() { std::cout << "2D Intersection tests\n"; + B_P(); L_L(); S_S(); R_R(); diff --git a/Intersections_3/include/CGAL/Intersection_traits_3.h b/Intersections_3/include/CGAL/Intersection_traits_3.h index 832790cdedc..c74186bc6cc 100644 --- a/Intersections_3/include/CGAL/Intersection_traits_3.h +++ b/Intersections_3/include/CGAL/Intersection_traits_3.h @@ -135,6 +135,153 @@ template struct Intersection_traits : public Intersection_traits {}; +// Point_3 Iso_cuboid_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Bbox_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + + template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Iso_cuboid_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Line_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Line_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Ray_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Ray_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Segment_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Segment_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Plane_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Plane_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Triangle_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; +// Triangle_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Tetrahedron_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; +// Tetrahedron_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; + +// Point_3 Sphere_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; +// Sphere_3 Point_3, variant of one +template +struct Intersection_traits { + typedef typename + boost::variant< typename K::Point_3 > variant_type; + typedef typename boost::optional< variant_type > result_type; +}; } // namespace #endif // !(CGAL_INTERSECTION_VERSION < 2) diff --git a/Intersections_2/include/CGAL/Iso_rectangle_2_Ray_2_intersection.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h similarity index 59% rename from Intersections_2/include/CGAL/Iso_rectangle_2_Ray_2_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h index 99501b578e0..d742cb8ff43 100644 --- a/Intersections_2/include/CGAL/Iso_rectangle_2_Ray_2_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Bbox_3.h @@ -1,9 +1,5 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2010 GeometryFactory (France). +// 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,8 +15,27 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0+ -// // -// Author(s) : Geert-Jan Giezeman +// +// Author(s) : Sebastien Loriot +// -#include +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_BBOX_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_BBOX_3_H + + +#include + +namespace CGAL { +bool +inline +do_intersect(const CGAL::Bbox_3& c, + const CGAL::Bbox_3& bbox) +{ + return CGAL::do_overlap(c, bbox); +} + +} //namespace CGAL + + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_BBOX_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h new file mode 100644 index 00000000000..37f439444b5 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Iso_cuboid_3.h @@ -0,0 +1,47 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_ISO_CUBOID_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_ISO_CUBOID_3_H + +#include +#include + +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Iso_cuboid_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +bool do_intersect(const Iso_cuboid_3& a, + const CGAL::Bbox_3& b) { + return K().do_intersect_3_object()(b, a); +} + +} // namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_ISO_CUBOID_3_H 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 new file mode 100644 index 00000000000..16afa74a743 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Line_3.h @@ -0,0 +1,61 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_LINE_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_LINE_3_H + +#include +#include + +#include +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Line_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +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, + const Line_3& b) { + return K().intersect_3_object()(a, b); +} + +template +typename Intersection_traits::result_type +intersection(const Line_3& a, + const CGAL::Bbox_3& b) { + return K().intersect_3_object()(a, b); +} +} + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_LINE_3_H 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 new file mode 100644 index 00000000000..639a7986aee --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Plane_3.h @@ -0,0 +1,48 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_PLANE_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_PLANE_3_H + +#include +#include + +#include + + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Plane_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +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 new file mode 100644 index 00000000000..e923357c38c --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Point_3.h @@ -0,0 +1,74 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_POINT_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_POINT_3_H + +#include +#include + +#include +#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) { + return do_intersect(b,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(); +} + + +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(); +} + +} // namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_POINT_3_H 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 new file mode 100644 index 00000000000..72441388ff0 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Ray_3.h @@ -0,0 +1,61 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_RAY_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_RAY_3_H + +#include +#include + +#include +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Ray_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +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, + const Ray_3& b) { + return K().intersect_3_object()(a, b); +} + +template +typename Intersection_traits::result_type +intersection(const Ray_3& a, + const CGAL::Bbox_3& b) { + return K().intersect_3_object()(a, b); +} + +} +#endif // CGAL_INTERSECTIONS_3_BBOX_3_RAY_3_H 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 new file mode 100644 index 00000000000..243e37d5374 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Segment_3.h @@ -0,0 +1,61 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_SEGMENT_3_H + +#include +#include +#include +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Segment_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +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, + const Segment_3& b) { + return K().intersect_3_object()(a, b); +} + +template +typename Intersection_traits::result_type +intersection(const Segment_3& a, + const CGAL::Bbox_3& b) { + return K().intersect_3_object()(a, b); +} + +} // namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_SEGMENT_3_H 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 new file mode 100644 index 00000000000..62445c404e5 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Sphere_3.h @@ -0,0 +1,47 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_SPHERE_3_H + +#include +#include + +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Sphere_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +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/Bbox_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h new file mode 100644 index 00000000000..b62050eefed --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Tetrahedron_3.h @@ -0,0 +1,47 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_TETRAHEDRON_3_H + +#include +#include + +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Tetrahedron_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +bool do_intersect(const Tetrahedron_3& a, + const CGAL::Bbox_3& b) { + return K().do_intersect_3_object()(a, b); +} + +} // namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h new file mode 100644 index 00000000000..c7d5a122a9e --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Bbox_3_Triangle_3.h @@ -0,0 +1,48 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H + +#include +#include + +#include + +namespace CGAL { + +template +bool do_intersect(const CGAL::Bbox_3& a, + const Triangle_3& b) { + return K().do_intersect_3_object()(a, b); +} + +template +bool do_intersect(const Triangle_3& a, + const CGAL::Bbox_3& b) { + return K().do_intersect_3_object()(a, b); +} + + +} // namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Iso_cuboid_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Iso_cuboid_3.h new file mode 100644 index 00000000000..db74ad6152b --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Iso_cuboid_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_ISO_CUBOID_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_ISO_CUBOID_3_H + +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION_SELF(Iso_cuboid_3, 3) +CGAL_DO_INTERSECT_FUNCTION_SELF(Iso_cuboid_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_ISO_CUBOID_3_H diff --git a/Intersections_2/include/CGAL/Triangle_2_Triangle_2_intersection.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Line_3.h similarity index 55% rename from Intersections_2/include/CGAL/Triangle_2_Triangle_2_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Line_3.h index f68dd0b61d6..59305d45aca 100644 --- a/Intersections_2/include/CGAL/Triangle_2_Triangle_2_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Line_3.h @@ -1,9 +1,5 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2010 GeometryFactory (France). +// 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,15 +15,21 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0+ -// // -// Author(s) : Geert-Jan Giezeman +// +// Author(s) : Sebastien Loriot +// +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_LINE_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_LINE_3_H -#ifndef CGAL_TRIANGLE_2_TRIANGLE_2_INTERSECTION_H -#define CGAL_TRIANGLE_2_TRIANGLE_2_INTERSECTION_H +#include +#include +#include -#include -#include +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3,Line_3, 3) + CGAL_INTERSECTION_FUNCTION(Line_3, Iso_cuboid_3, 3) +} -#endif +#endif // CGAL_INTERSECTIONS_3_BBOX_3_LINE_3_H diff --git a/Intersections_2/include/CGAL/Bbox_2_intersection.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Plane_3.h similarity index 57% rename from Intersections_2/include/CGAL/Bbox_2_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Plane_3.h index 1b345b4b981..11c5eff3120 100644 --- a/Intersections_2/include/CGAL/Bbox_2_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Plane_3.h @@ -1,9 +1,5 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2010 GeometryFactory (France). +// 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,15 +15,21 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0+ -// // -// Author(s) : Geert-Jan Giezeman +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_PLANE_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_PLANE_3_H + +#include +#include +#include +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Plane_3, 3) +} -#ifndef CGAL_BBOX_2_INTERSECTIONS_H -#define CGAL_BBOX_2_INTERSECTIONS_H - -#include -#include -#endif // CGAL_BBOX_2_INTERSECTIONS_H +#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_PLANE_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 new file mode 100644 index 00000000000..c03335611ea --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Point_3.h @@ -0,0 +1,83 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_POINT_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_POINT_3_H + +#include +#include +#include + +namespace CGAL { +namespace Intersections { +namespace internal { + +template +inline +bool +do_intersect(const typename K::Point_3 &pt, + const typename K::Iso_cuboid_3 &iso, + const K&) +{ + return !iso.has_on_unbounded_side(pt); +} + +template +inline +bool +do_intersect(const typename K::Iso_cuboid_3 &iso, + const typename K::Point_3 &pt, + const K&) +{ + return !iso.has_on_unbounded_side(pt); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_3 &pt, + const typename K::Iso_cuboid_3 &iso, + const K& k) +{ + if (internal::do_intersect(pt,iso,k)) + return intersection_return(pt); + return intersection_return(); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Iso_cuboid_3 &iso, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, iso, k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_3, Iso_cuboid_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Point_3, Iso_cuboid_3, 3) + +} //namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_ISO_CUBOID_3_POINT_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Ray_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Ray_3.h new file mode 100644 index 00000000000..8798b295b5a --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Ray_3.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_RAY_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_RAY_3_H + +#include +#include + +#include +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3,Ray_3, 3) + CGAL_INTERSECTION_FUNCTION(Ray_3, Iso_cuboid_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_ISSO_CUBOID_3_RAY_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Segment_3.h new file mode 100644 index 00000000000..8bd316d77f3 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Segment_3.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_H + +#include +#include + +#include +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3,Segment_3, 3) + CGAL_INTERSECTION_FUNCTION(Segment_3, Iso_cuboid_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_SEGMENT_3_H 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 new file mode 100644 index 00000000000..b63ea70bc62 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Sphere_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_H + +#include +#include + +#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 new file mode 100644 index 00000000000..e211d8f19a5 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Tetrahedron_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TETRAHEDRON_3_H + +#include +#include + +#include + +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/Iso_cuboid_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h new file mode 100644 index 00000000000..9c0e6ac71e2 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Iso_cuboid_3_Triangle_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3,Triangle_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_BBOX_3_TRIANGLE_3_H diff --git a/Intersections_2/include/CGAL/Iso_rectangle_2_Point_2_intersection.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Line_3.h similarity index 58% rename from Intersections_2/include/CGAL/Iso_rectangle_2_Point_2_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/Line_3_Line_3.h index 9d498dcb798..ec964297439 100644 --- a/Intersections_2/include/CGAL/Iso_rectangle_2_Point_2_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Line_3.h @@ -1,9 +1,5 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2010 GeometryFactory (France). +// 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,8 +15,21 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0+ -// // -// Author(s) : Geert-Jan Giezeman +// +// Author(s) : Sebastien Loriot +// -#include +#ifndef CGAL_INTERSECTIONS_3_LINE_3_LINE_3_H +#define CGAL_INTERSECTIONS_3_LINE_3_LINE_3_H + +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION_SELF(Line_3, 3) +CGAL_DO_INTERSECT_FUNCTION_SELF(Line_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_LINE_3_LINE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Plane_3.h new file mode 100644 index 00000000000..36f2b8f4eef --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Plane_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_LINE_PLANE_3_H +#define CGAL_INTERSECTIONS_3_LINE_PLANE_3_H + +#include +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Plane_3, Line_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Plane_3, Line_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_LINE_PLANE_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 new file mode 100644 index 00000000000..e05e8ac2ed2 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Point_3.h @@ -0,0 +1,83 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_LINE_3_POINT_3_H +#define CGAL_INTERSECTIONS_3_LINE_3_POINT_3_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline bool +do_intersect(const typename K::Point_3 &pt, + const typename K::Line_3 &line, + const K&) +{ + return line.has_on(pt); +} + +template +inline bool +do_intersect(const typename K::Line_3 &line, + const typename K::Point_3 &pt, + const K&) +{ + return line.has_on(pt); +} + +template +typename CGAL::Intersection_traits +::result_type +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(); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Line_3 &line, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, line, k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_3, Line_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Point_3, Line_3, 3) + +} //namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_LINE_3_POINT_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Ray_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Ray_3.h new file mode 100644 index 00000000000..3846288730d --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Ray_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_LINE_3_RAY_3_H +#define CGAL_INTERSECTIONS_3_LINE_3_RAY_3_H + +#include +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Ray_3, Line_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Ray_3, Line_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_LINE_3_RAY_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Segment_3.h new file mode 100644 index 00000000000..0421e7ce342 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Segment_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_LINE_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_LINE_3_SEGMENT_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_INTERSECTION_FUNCTION(Line_3, Segment_3, 3) + CGAL_DO_INTERSECT_FUNCTION(Line_3, Segment_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_LINE_3_SEGMENT_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Sphere_3.h new file mode 100644 index 00000000000..7419504d724 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Sphere_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_LINE_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_LINE_3_SPHERE_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Line_3, Sphere_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_LINE_3_SPHERE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Tetrahedron_3.h new file mode 100644 index 00000000000..0566ccb561b --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Tetrahedron_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_LINE_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_LINE_3_TETRAHEDRON_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Line_3, Tetrahedron_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_LINE_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Line_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Line_3_Triangle_3.h new file mode 100644 index 00000000000..9be4e73a8d2 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Line_3_Triangle_3.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_LINE_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_LINE_3_TRIANGLE_3_H + +#include +#include + +#include +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Triangle_3, Line_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Line_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_LINE_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3.h new file mode 100644 index 00000000000..501afd4bf20 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Plane_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_PLANE_3_PLANE_3_H +#define CGAL_INTERSECTIONS_3_PLANE_3_PLANE_3_H + +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION_SELF(Plane_3, 3) +CGAL_DO_INTERSECT_FUNCTION_SELF(Plane_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_PLANE_3_PLANE_3_H 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 new file mode 100644 index 00000000000..090ba9c0ae5 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Point_3.h @@ -0,0 +1,82 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_PLANE_3_POINT_3_PLANE_3_H +#define CGAL_INTERSECTIONS_3_PLANE_3_POINT_3_PLANE_3_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline bool +do_intersect(const typename K::Point_3 &pt, + const typename K::Plane_3 &plane, + const K&) +{ + return plane.has_on(pt); +} + +template +inline bool +do_intersect(const typename K::Plane_3 &plane, + const typename K::Point_3 &pt, + const K&) +{ + return plane.has_on(pt); +} + +template +typename CGAL::Intersection_traits +::result_type +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(); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Plane_3 &plane, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, plane,k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_3, Plane_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Point_3, Plane_3, 3) + +} //namespace CGAL +#endif // CGAL_INTERSECTIONS_3_PLANE_3_POINT_3_PLANE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Ray_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Ray_3.h new file mode 100644 index 00000000000..1572729b694 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Ray_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_PLANE_3_RAY_3_H +#define CGAL_INTERSECTIONS_3_PLANE_3_RAY_3_H + +#include +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Ray_3, Plane_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Ray_3, Plane_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_PLANE_3_RAY_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Segment_3.h new file mode 100644 index 00000000000..c2739743d2e --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Segment_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_PLANE_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_PLANE_3_SEGMENT_3_H + +#include +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Segment_3, Plane_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Segment_3, Plane_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_PLANE_3_SEGMENT_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Sphere_3.h new file mode 100644 index 00000000000..2669afd39af --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Sphere_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_PLANE_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_PLANE_3_SPHERE_3_H + +#include +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Sphere_3, Plane_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Sphere_3, Plane_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_PLANE_3_SPHERE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Tetrahedron_3.h new file mode 100644 index 00000000000..ef92801ef67 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Tetrahedron_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_PLANE_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_PLANE_3_TETRAHEDRON_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Tetrahedron_3, Plane_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_PLANE_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Plane_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Triangle_3.h new file mode 100644 index 00000000000..fe92f4873b4 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Plane_3_Triangle_3.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_PLANE_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_PLANE_3_TRIANGLE_3_H + +#include +#include + +#include +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Triangle_3, Plane_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Plane_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_PLANE_3_TRIANGLE_3_H 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 new file mode 100644 index 00000000000..f7e815fd1c0 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Point_3.h @@ -0,0 +1,62 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_POINT_3_POINT_3_H +#define CGAL_INTERSECTIONS_3_POINT_3_POINT_3_H + +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline bool +do_intersect(const typename K::Point_3 &pt1, + const typename K::Point_3 &pt2, + const K&) +{ + return pt1 == pt2; +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_3 &pt1, + const typename K::Point_3 &pt2, + const K&) +{ + if (pt1 == pt2) + return intersection_return(pt1); + return intersection_return(); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION_SELF(Point_3, 3) +CGAL_DO_INTERSECT_FUNCTION_SELF(Point_3, 3) +}//nmaespace cgal + +#endif // CGAL_INTERSECTIONS_3_POINT_3_POINT_3_H 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 new file mode 100644 index 00000000000..9951c634c72 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Ray_3.h @@ -0,0 +1,88 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_POINT_3_RAY_3_H +#define CGAL_INTERSECTIONS_3_POINT_3_RAY_3_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline +bool +do_intersect(const typename K::Point_3 &pt, + const typename K::Ray_3 &ray, + const K&) +{ + return ray.has_on(pt); +} + + +template +inline +bool +do_intersect(const typename K::Ray_3 &ray, + const typename K::Point_3 &pt, + const K&) +{ + return ray.has_on(pt); +} + + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_3 &pt, + const typename K::Ray_3 &ray, + const K& k) +{ + if (do_intersect(pt,ray, k)) { + return intersection_return(pt); + } + return intersection_return(); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Ray_3 &ray, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, ray, k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_3, Ray_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Point_3, Ray_3, 3) + + +} //namespace CGAL +#endif // CGAL_INTERSECTIONS_3_POINT_3_RAY_3_H 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 new file mode 100644 index 00000000000..93d441674a5 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Segment_3.h @@ -0,0 +1,88 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_POINT_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_POINT_3_SEGMENT_3_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline +bool +do_intersect(const typename K::Point_3 &pt, + const typename K::Segment_3 &seg, + const K&) +{ + return seg.has_on(pt); +} + +template +inline +bool +do_intersect(const typename K::Segment_3 &seg, + const typename K::Point_3 &pt, + const K&) +{ + return seg.has_on(pt); +} + + +template +inline +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_3 &pt, + const typename K::Segment_3 &seg, + const K& k) +{ + if (do_intersect(pt,seg, k)) + return intersection_return(pt); + return intersection_return(); +} + +template +inline +typename CGAL::Intersection_traits +::result_type +intersection( const typename K::Segment_3 &seg, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, seg, k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_3, Segment_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Point_3, Segment_3, 3) + +} //namespace CGAL + +#endif // CGAL_INTERSECTIONS_3_POINT_3_SEGMENT_3_H 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 new file mode 100644 index 00000000000..0470340ef77 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Sphere_3.h @@ -0,0 +1,86 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_POINT_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_POINT_3_SPHERE_3_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline +bool +do_intersect(const typename K::Point_3 &pt, + const typename K::Sphere_3 &sphere, + const K&) +{ + return sphere.has_on_boundary(pt); +} + + +template +inline +bool +do_intersect(const typename K::Sphere_3 &sphere, + const typename K::Point_3 &pt, + const K&) +{ + return sphere.has_on_boundary(pt); +} + + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_3 &pt, + const typename K::Sphere_3 &sphere, + const K& k) +{ + if (do_intersect(pt,sphere, k)) + return intersection_return(pt); + return intersection_return(); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Sphere_3 &sphere, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, sphere, k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_3, Sphere_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Point_3, Sphere_3, 3) + +} //namespace CGAL +#endif // CGAL_INTERSECTIONS_3_POINT_3_SPHERE_3_H 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 new file mode 100644 index 00000000000..bb057a3eb7a --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Tetrahedron_3.h @@ -0,0 +1,87 @@ +// Copyright (c) 2018 INRIA Sophia-Antipolis (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Maxime Gimeno + +#ifndef CGAL_INTERSECTIONS_3_POINT_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_POINT_3_TETRAHEDRON_3_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +inline +bool +do_intersect(const typename K::Point_3 &pt, + const typename K::Tetrahedron_3 &tetrahedron, + const K&) +{ + return ! tetrahedron.has_on_unbounded_side(pt); +} + + +template +inline +bool +do_intersect(const typename K::Tetrahedron_3 &tetrahedron, + const typename K::Point_3 &pt, + const K&) +{ + return ! tetrahedron.has_on_unbounded_side(pt); +} + + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_3 &pt, + const typename K::Tetrahedron_3 &tetrahedron, + const K& k) +{ + if (do_intersect(pt,tetrahedron, k)) + return intersection_return(pt); + return intersection_return(); +} + +template +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Tetrahedron_3 &tetrahedron, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, tetrahedron, k); +} + +} // namespace internal +} // namespace Intersections + +CGAL_INTERSECTION_FUNCTION(Point_3, Tetrahedron_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Point_3, Tetrahedron_3, 3) + + +} //namespace CGAL +#endif // CGAL_INTERSECTIONS_3_POINT_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Triangle_3_Point_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/Point_3_Triangle_3.h similarity index 70% rename from Intersections_3/include/CGAL/Triangle_3_Point_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/Point_3_Triangle_3.h index 4ec47ab0b7c..1a887b0a52e 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Point_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/Point_3_Triangle_3.h @@ -19,8 +19,11 @@ // // Author(s) : Philippe Guigue -#ifndef CGAL_TRIANGLE_3_POINT_3_DO_INTERSECT_H -#define CGAL_TRIANGLE_3_POINT_3_DO_INTERSECT_H +#ifndef CGAL_INTERSECTIONS_3_POINT_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_POINT_3_TRIANGLE_3_H + +#include +#include #include #include @@ -28,13 +31,8 @@ namespace CGAL { - - template - class Triangle_3; - - template - class Point_3; - +namespace Intersections { + namespace internal { template @@ -101,12 +99,36 @@ bool do_intersect(const typename K::Point_3 &p, return do_intersect(t, p, k); } +template +inline +typename CGAL::Intersection_traits +::result_type +intersection(const typename K::Point_3 &pt, + const typename K::Triangle_3 &tr, + const K& k) +{ + if (do_intersect(pt,tr, k)) { + return intersection_return(pt); + } + return intersection_return(); +} +template +inline +typename CGAL::Intersection_traits +::result_type +intersection( const typename K::Triangle_3 &tr, + const typename K::Point_3 &pt, + const K& k) +{ + return internal::intersection(pt, tr, k); +} } // namespace internal - +} // namespace Intersections CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Point_3, 3) +CGAL_INTERSECTION_FUNCTION(Triangle_3, Point_3, 3) } //namespace CGAL -#endif // CGAL_TRIANGLE_3_POINT_3_DO_INTERSECT_H +#endif // CGAL_INTERSECTIONS_3_POINT_3_TRIANGLE_3_H diff --git a/Intersections_2/include/CGAL/Bbox_2_Ray_2_intersection.h b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Ray_3.h similarity index 59% rename from Intersections_2/include/CGAL/Bbox_2_Ray_2_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/Ray_3_Ray_3.h index 155895580c1..c9eb6a95de7 100644 --- a/Intersections_2/include/CGAL/Bbox_2_Ray_2_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Ray_3.h @@ -1,9 +1,5 @@ -// Copyright (c) 2000 -// Utrecht University (The Netherlands), -// ETH Zurich (Switzerland), -// INRIA Sophia-Antipolis (France), -// Max-Planck-Institute Saarbruecken (Germany), -// and Tel-Aviv University (Israel). All rights reserved. +// Copyright (c) 2010 GeometryFactory (France). +// 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,9 +15,21 @@ // $URL$ // $Id$ // SPDX-License-Identifier: LGPL-3.0+ -// // -// Author(s) : Geert-Jan Giezeman +// +// Author(s) : Sebastien Loriot +// +#ifndef CGAL_INTERSECTIONS_3_RAY_3_RAY_3_H +#define CGAL_INTERSECTIONS_3_RAY_3_RAY_3_H -#include +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION_SELF(Ray_3, 3) +CGAL_DO_INTERSECT_FUNCTION_SELF(Ray_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_RAY_3_RAY_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Ray_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Segment_3.h new file mode 100644 index 00000000000..25702ff619a --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Segment_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_RAY_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_RAY_3_SEGMENT_3_H + +#include +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Ray_3, Segment_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Ray_3, Segment_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_RAY_3_SEGMENT_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Ray_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Sphere_3.h new file mode 100644 index 00000000000..d706e7b82be --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Sphere_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_RAY_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_RAY_3_SPHERE_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Ray_3, Sphere_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_RAY_3_SPHERE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Ray_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Tetrahedron_3.h new file mode 100644 index 00000000000..b9b4b10c93b --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Tetrahedron_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_RAY_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_RAY_3_TETRAHEDRON_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Ray_3, Tetrahedron_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_RAY_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Ray_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Triangle_3.h new file mode 100644 index 00000000000..2a4557988dc --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Ray_3_Triangle_3.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_RAY_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_RAY_3_TRIANGLE_3_H + +#include +#include + +#include +#include + +namespace CGAL { + CGAL_INTERSECTION_FUNCTION(Triangle_3, Ray_3, 3) + CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Ray_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_TRIANGLE_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Segment_3_Segment_3.h b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Segment_3.h new file mode 100644 index 00000000000..ba99ca0b5a1 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Segment_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_SEGMENT_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_SEGMENT_3_SEGMENT_3_H + +#include + +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION_SELF(Segment_3, 3) +CGAL_DO_INTERSECT_FUNCTION_SELF(Segment_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_SEGMENT_3_SEGMENT_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Segment_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Sphere_3.h new file mode 100644 index 00000000000..1ed0338d690 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Sphere_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_SEGMENT_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_SEGMENT_3_SPHERE_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Segment_3, Sphere_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_SEGMENT_3_SPHERE_3_H 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 new file mode 100644 index 00000000000..3f5dc525a4c --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Tetrahedron_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_SEGMENT_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_SEGMENT_3_TETRAHEDRON_3_H + +#include +#include + +#include + +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/Segment_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Triangle_3.h new file mode 100644 index 00000000000..ad40a07a663 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Segment_3_Triangle_3.h @@ -0,0 +1,37 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_TRIANGLE_3_SEGMENT_3_H +#define CGAL_INTERSECTIONS_3_TRIANGLE_3_SEGMENT_3_H + +#include +#include + +#include +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION(Triangle_3, Segment_3, 3) +CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Segment_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_TRIANGLE_3_SEGMENT_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Sphere_3.h b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Sphere_3.h new file mode 100644 index 00000000000..e9fd61803df --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Sphere_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_SPHERE_3_SPHERE_3_H +#define CGAL_INTERSECTIONS_3_SPHERE_3_SPHERE_3_H + +#include + +#include + +namespace CGAL { +CGAL_DO_INTERSECT_FUNCTION_SELF(Sphere_3, 3) +CGAL_INTERSECTION_FUNCTION_SELF(Sphere_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_SPHERE_3_SPHERE_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 new file mode 100644 index 00000000000..2ccdfe0b4f4 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Tetrahedron_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_SPHERE_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_SPHERE_3_TETRAHEDRON_3_H + +#include +#include + +#include + +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 new file mode 100644 index 00000000000..fbb765f7b57 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Sphere_3_Triangle_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_SPHERE_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_SPHERE_3_TRIANGLE_3_H + +#include +#include + +#include + +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/Tetrahedron_3_Tetrahedron_3.h b/Intersections_3/include/CGAL/Intersections_3/Tetrahedron_3_Tetrahedron_3.h new file mode 100644 index 00000000000..d98d450609b --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Tetrahedron_3_Tetrahedron_3.h @@ -0,0 +1,34 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_TETRAHEDRON_3_TETRAHEDRON_3_H +#define CGAL_INTERSECTIONS_3_TETRAHEDRON_3_TETRAHEDRON_3_H + +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION_SELF(Tetrahedron_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_TETRAHEDRON_3_TETRAHEDRON_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Tetrahedron_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Tetrahedron_3_Triangle_3.h new file mode 100644 index 00000000000..da0193e3291 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Tetrahedron_3_Triangle_3.h @@ -0,0 +1,35 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_TETRAHEDRON_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_TETRAHEDRON_3_TRIANGLE_3_H + +#include +#include + +#include + +namespace CGAL { + CGAL_DO_INTERSECT_FUNCTION(Tetrahedron_3, Triangle_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_TETRAHEDRON_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/Intersections_3/Triangle_3_Triangle_3.h b/Intersections_3/include/CGAL/Intersections_3/Triangle_3_Triangle_3.h new file mode 100644 index 00000000000..0654ef9d989 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/Triangle_3_Triangle_3.h @@ -0,0 +1,36 @@ +// Copyright (c) 2010 GeometryFactory (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_INTERSECTIONS_3_TRIANGLE_3_TRIANGLE_3_H +#define CGAL_INTERSECTIONS_3_TRIANGLE_3_TRIANGLE_3_H + +#include + +#include +#include + +namespace CGAL { +CGAL_INTERSECTION_FUNCTION_SELF(Triangle_3, 3) +CGAL_DO_INTERSECT_FUNCTION_SELF(Triangle_3, 3) +} + +#endif // CGAL_INTERSECTIONS_3_TRIANGLE_3_TRIANGLE_3_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Bbox_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Bbox_3_do_intersect.h similarity index 99% rename from Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Bbox_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Bbox_3_do_intersect.h index 6d21409ce12..94ba0853ffa 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Bbox_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Bbox_3_do_intersect.h @@ -39,6 +39,7 @@ namespace CGAL { { return CGAL::do_overlap(c, bbox); } + } //namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_BBOX_3_DO_INTERSECT_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 new file mode 100644 index 00000000000..8aff1c21721 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Iso_cuboid_3_do_intersect.h @@ -0,0 +1,53 @@ +// Copyright (c) 2008 INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland). +// Copyright (c) 2010, 2014 GeometryFactory Sarl (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez + +#ifndef CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_ISO_CUBOID_3_DO_INTERSECT_H +#define CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_ISO_CUBOID_3_DO_INTERSECT_H + +#include +#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; +} + +} // namespace internal +} // namespace Intersections +} //namespace CGAL + +#endif // CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_ISO_CUBOID_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h similarity index 93% rename from Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Line_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h index fc57c9d0ad6..95448fd3c6f 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Line_3_do_intersect.h @@ -30,6 +30,8 @@ // inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf namespace CGAL { + +namespace Intersections { namespace internal { @@ -155,20 +157,7 @@ namespace internal { } // namespace internal - -template -bool do_intersect(const CGAL::Bbox_3 a, - const Line_3& b) { - return K().do_intersect_3_object()(a, b); -} - -template -bool do_intersect(const Line_3& a, - const CGAL::Bbox_3& b) { - return K().do_intersect_3_object()(a, b); -} - - +} // namespace Intersections } //namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_LINE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h similarity index 82% rename from Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Plane_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h index 7c05ee63ad1..0dbb95e2e02 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Plane_3_do_intersect.h @@ -24,17 +24,20 @@ #define CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_PLANE_3_DO_INTERSECT_H #include +#include #include // Opcode like namespace CGAL { + +namespace Intersections { namespace internal { - template + template Uncertain get_min_max(const typename K::Vector_3& p, - const CGAL::Bbox_3& bbox, + Box3& bbox, typename K::Point_3& p_min, typename K::Point_3& p_max) { @@ -89,10 +92,10 @@ namespace internal { return Uncertain::indeterminate(); } - template - bool do_intersect(const typename K::Plane_3& plane, - const CGAL::Bbox_3& bbox, - const K&) + template + bool do_intersect_plane_box(const typename K::Plane_3& plane, + const Box3& bbox, + const K&) { typedef typename K::Point_3 Point_3; Point_3 p_max, p_min; @@ -121,27 +124,35 @@ namespace internal { } template - bool do_intersect(const CGAL::Bbox_3& bbox, const typename K::Plane_3& plane, + bool do_intersect(const typename K::Plane_3& plane, + const Bbox_3& bbox, const K&) { - return do_intersect(plane, bbox, K()); + return do_intersect_plane_box(plane, bbox, K()); } + template + bool do_intersect(const typename K::Plane_3& plane, + const typename K::Iso_cuboid_3& bbox, + const K&) { + return do_intersect_plane_box(plane, bbox, K()); + } + + template + bool do_intersect(const Bbox_3& bbox, + const typename K::Plane_3& plane, + const K&) { + return do_intersect_plane_box(plane, bbox, K()); + } + + template + bool do_intersect(const typename K::Iso_cuboid_3& bbox, + const typename K::Plane_3& plane, + const K&) { + return do_intersect_plane_box(plane, bbox, K()); + } } // namespace internal - -template -bool do_intersect(const CGAL::Bbox_3 a, - const Plane_3& b) { - return K().do_intersect_3_object()(a, b); -} - -template -bool do_intersect(const Plane_3& a, - const CGAL::Bbox_3& b) { - return K().do_intersect_3_object()(a, b); -} - - +} // namespace Intersections } //namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_PLANE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h similarity index 85% rename from Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Ray_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h index 55a9b05c45f..e0fcd062625 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Ray_3_do_intersect.h @@ -26,12 +26,14 @@ #include #include -#include +#include // for CGAL::internal::do_intersect_bbox_segment_aux // inspired from http://cag.csail.mit.edu/~amy/papers/box-jgt.pdf namespace CGAL { + +namespace Intersections { namespace internal { @@ -64,20 +66,9 @@ namespace internal { const K&) { return do_intersect(ray, bbox, K()); } + } // namespace internal - -template -bool do_intersect(const CGAL::Bbox_3 a, - const Ray_3& b) { - return K().do_intersect_3_object()(a, b); -} - -template -bool do_intersect(const Ray_3& a, - const CGAL::Bbox_3& b) { - return K().do_intersect_3_object()(a, b); -} - +} // namespace Intersections } //namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_RAY_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h similarity index 91% rename from Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h index 47b20df326c..2f2b27113f3 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Segment_3_do_intersect.h @@ -25,6 +25,8 @@ #include +#include +#include #include #include #include @@ -44,6 +46,8 @@ // [t1, t2] intersects [0, 1]. namespace CGAL { + +namespace Intersections { namespace internal { @@ -120,7 +124,10 @@ namespace internal { }; // end specialization Do_intersect_bbox_segment_aux_is_greater + + template @@ -134,16 +141,9 @@ namespace internal { do_intersect_bbox_segment_aux( const FT& px, const FT& py, const FT& pz, const FT& qx, const FT& qy, const FT& qz, - const Bbox_3& bbox) + const BFT& bxmin, const BFT& bymin, const BFT& bzmin, + const BFT& bxmax, const BFT& bymax, const BFT& bzmax) { - const double& bxmin = bbox.xmin(); - const double& bymin = bbox.ymin(); - const double& bzmin = bbox.zmin(); - const double& bxmax = bbox.xmax(); - const double& bymax = bbox.ymax(); - const double& bzmax = bbox.zmax(); - - if( ( (px >= bxmin) && (px <= bxmax) && (py >= bymin) && (py <= bymax) && (pz >= bzmin) && (pz <= bzmax) ) || @@ -409,6 +409,33 @@ namespace internal { return true; } + + template + inline + typename Do_intersect_bbox_segment_aux_is_greater + < + FT, + bounded_0, + use_static_filters + >::result_type + do_intersect_bbox_segment_aux( + const FT& px, const FT& py, const FT& pz, + const FT& qx, const FT& qy, const FT& qz, + const Bbox_3& bb) + + { + return do_intersect_bbox_segment_aux(px, py, pz, + qx, qy, qz, + bb.xmin(), bb.ymin(), bb.zmin(), + bb.xmax(), bb.ymax(), bb.zmax()); + } + + + + template bool do_intersect(const typename K::Segment_3& segment, const CGAL::Bbox_3& bbox, @@ -435,20 +462,7 @@ namespace internal { } } // namespace internal - -template -bool do_intersect(const CGAL::Bbox_3 a, - const Segment_3& b) { - return K().do_intersect_3_object()(a, b); -} - -template -bool do_intersect(const Segment_3& a, - const CGAL::Bbox_3& b) { - return K().do_intersect_3_object()(a, b); -} - - +} // namespace Intersections } //namespace CGAL #include diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Sphere_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h similarity index 73% rename from Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Sphere_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h index 1ee8e0dd3b0..29953fe3009 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Sphere_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Sphere_3_do_intersect.h @@ -30,13 +30,15 @@ namespace CGAL { + +namespace Intersections { namespace internal { - template - bool do_intersect(const typename K::Sphere_3& sphere, - const CGAL::Bbox_3& bbox, - const K&) + template + bool do_intersect_sphere_box_3(const typename K::Sphere_3& sphere, + const Box3& bbox, + const K&) { typedef typename K::FT FT; typedef typename K::Point_3 Point; @@ -101,24 +103,38 @@ namespace internal { bool do_intersect(const CGAL::Bbox_3& bbox, const typename K::Sphere_3& sphere, const K&) - { return do_intersect(sphere, bbox, K()); } + { + return do_intersect_sphere_box_3(sphere, bbox, K()); + } + + template + bool do_intersect(const typename K::Sphere_3& sphere, + const CGAL::Bbox_3& bbox, + const K&) + { + return do_intersect_sphere_box_3(sphere, bbox, K()); + } + + template + bool do_intersect(const typename K::Iso_cuboid_3& bbox, + const typename K::Sphere_3& sphere, + const K&) + { + return do_intersect_sphere_box_3(sphere, bbox, K()); + } + + + template + bool do_intersect(const typename K::Sphere_3& sphere, + const typename K::Iso_cuboid_3& bbox, + const K&) + { + return do_intersect_sphere_box_3(sphere, bbox, K()); + } } // namespace internal - -template -bool do_intersect(const CGAL::Bbox_3& a, - const Sphere_3& b) { - return K().do_intersect_3_object()(a, b); -} - -template -bool do_intersect(const Sphere_3& a, - const CGAL::Bbox_3& b) { - return K().do_intersect_3_object()(a, b); -} - - +} // namespace Intersections } //namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_BBOX_3_SPHERE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h similarity index 81% rename from Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Triangle_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h index 7584aac800b..58f030a5d5c 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Bbox_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Bbox_3_Triangle_3_do_intersect.h @@ -33,16 +33,18 @@ // a minimal cost (and we use C++ ;). #include -#include +#include namespace CGAL { + +namespace Intersections { namespace internal { - template + template inline bool do_bbox_intersect(const typename K::Triangle_3& triangle, - const CGAL::Bbox_3& bbox) + const Box3& bbox) { const typename K::Point_3& p = triangle.vertex(0); const typename K::Point_3& q = triangle.vertex(1); @@ -51,32 +53,32 @@ namespace internal { for(int i = 0; i < 3; ++i) { if(p[i] <= q[i]) { if(q[i] <= r[i]) { // pqr - if(((bbox.max)(i) < p[i]) || ((bbox.min)(i) > r[i])) + if((bbox.max_coord(i) < p[i]) || (bbox.min_coord(i) > r[i])) return false; } else { if(p[i] <= r[i]) { // prq - if((bbox.max)(i) < p[i] || (bbox.min)(i) > q[i]) + if(bbox.max_coord(i) < p[i] || bbox.min_coord(i) > q[i]) return false; } else { // rpq - if((bbox.max)(i) < r[i] || (bbox.min)(i) > q[i]) + if(bbox.max_coord(i) < r[i] || bbox.min_coord(i) > q[i]) return false; } } } else { if(p[i] <= r[i]) { // qpr - if((bbox.max)(i) < q[i] || (bbox.min)(i) > r[i]) + if(bbox.max_coord(i) < q[i] || bbox.min_coord(i) > r[i]) return false; } else { if(q[i] <= r[i]) { // qrp - if((bbox.max)(i) < q[i] || (bbox.min)(i) > p[i]) + if(bbox.max_coord(i) < q[i] || bbox.min_coord(i) > p[i]) return false; } else { // rqp - if((bbox.max)(i) < r[i] || (bbox.min)(i) > p[i]) + if(bbox.max_coord(i) < r[i] || bbox.min_coord(i) > p[i]) return false; } } @@ -89,12 +91,12 @@ namespace internal { // if you do not know it, or if it does not exist, // use get_min_max without the AXE template parameter // available in _plane_is_cuboid_do_intersect.h - template + template inline void get_min_max(const typename K::FT& px, const typename K::FT& py, const typename K::FT& pz, - const CGAL::Bbox_3& c, + const Box3& c, typename K::Point_3& p_min, typename K::Point_3& p_max) { @@ -186,20 +188,20 @@ namespace internal { return -1; } - template + template inline Uncertain do_axis_intersect(const typename K::Triangle_3& triangle, const typename K::Vector_3* sides, - const CGAL::Bbox_3& bbox) + const Box3& bbox) { const typename K::Point_3* j = & triangle.vertex(SIDE); const typename K::Point_3* k = & triangle.vertex((SIDE+2)%3); typename K::Point_3 p_min, p_max; - get_min_max(AXE==0? 0: AXE==1? sides[SIDE].z(): -sides[SIDE].y(), - AXE==0? -sides[SIDE].z(): AXE==1? 0: sides[SIDE].x(), - AXE==0? sides[SIDE].y(): AXE==1? -sides[SIDE].x(): - typename K::FT(0), bbox, p_min, p_max); + get_min_max(AXE==0? 0: AXE==1? sides[SIDE].z(): -sides[SIDE].y(), + AXE==0? -sides[SIDE].z(): AXE==1? 0: sides[SIDE].x(), + AXE==0? sides[SIDE].y(): AXE==1? -sides[SIDE].x(): + typename K::FT(0), bbox, p_min, p_max); switch ( AXE ) { @@ -238,10 +240,10 @@ namespace internal { } } - template - bool do_intersect(const typename K::Triangle_3& a_triangle, - const CGAL::Bbox_3& a_bbox, - const K& k) + template + bool do_intersect_bbox_or_iso_cuboid(const typename K::Triangle_3& a_triangle, + const Box3& a_bbox, + const K& k) { if(certainly_not( do_bbox_intersect(a_triangle, a_bbox) )) @@ -286,11 +288,11 @@ namespace internal { typename K::Triangle_3 triangle(a_triangle[0]-v, a_triangle[1]-v, a_triangle[2]-v); - Bbox_3 bbox( (p-v).bbox() + (q-v).bbox()); + Box3 bbox( (p-v).bbox() + (q-v).bbox()); #else const typename K::Triangle_3& triangle = a_triangle; - const Bbox_3& bbox = a_bbox; + const Box3& bbox = a_bbox; #endif // Create a "certainly true" @@ -298,7 +300,7 @@ namespace internal { if (forbidden_axis!=0){ if (forbidden_size!=0){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -306,7 +308,7 @@ namespace internal { } } if (forbidden_size!=1){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -314,7 +316,7 @@ namespace internal { } } if (forbidden_size!=2){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -325,7 +327,7 @@ namespace internal { if (forbidden_axis!=1){ if (forbidden_size!=0){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -333,7 +335,7 @@ namespace internal { } } if (forbidden_size!=1){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -341,7 +343,7 @@ namespace internal { } } if (forbidden_size!=2){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -352,7 +354,7 @@ namespace internal { if (forbidden_axis!=2){ if (forbidden_size!=0){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -360,7 +362,7 @@ namespace internal { } } if (forbidden_size!=1){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -368,7 +370,7 @@ namespace internal { } } if (forbidden_size!=2){ - Uncertain b = do_axis_intersect(triangle, sides, bbox); + Uncertain b = do_axis_intersect(triangle, sides, bbox); if(is_indeterminate(b)){ ind_or_true = b; } else if(! b){ @@ -379,29 +381,24 @@ namespace internal { return ind_or_true; // throws exception in case it is indeterminate } + template + bool do_intersect(const typename K::Triangle_3& triangle, + const CGAL::Bbox_3& bbox, + const K& k) + { + return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); + } + template bool do_intersect(const CGAL::Bbox_3& bbox, const typename K::Triangle_3& triangle, const K& k) { - return do_intersect(triangle, bbox, k); + return do_intersect_bbox_or_iso_cuboid(triangle, bbox, k); } } // namespace internal - -template -bool do_intersect(const CGAL::Bbox_3 a, - const Triangle_3& b) { - return K().do_intersect_3_object()(a, b); -} - -template -bool do_intersect(const Triangle_3& a, - const CGAL::Bbox_3& b) { - return K().do_intersect_3_object()(a, b); -} - - +} // namespace Intersections } //namespace CGAL #include 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 new file mode 100644 index 00000000000..16baac9bf82 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Ray_3_do_intersect.h @@ -0,0 +1,75 @@ +// Copyright (c) 2008 ETH Zurich (Switzerland) +// Copyright (c) 2008-2009 INRIA Sophia-Antipolis (France) +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez, Stephane Tayeb + +#ifndef CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_RAY_3_DO_INTERSECT_H +#define CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_RAY_3_DO_INTERSECT_H + +#include +#include + +#include +// for CGAL::internal::do_intersect_bbox_segment_aux + +// 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; + + 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() + ); +} + +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 +} //namespace CGAL + +#endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_RAY_3_DO_INTERSECT_H 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 new file mode 100644 index 00000000000..87d1ef922d3 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Segment_3_do_intersect.h @@ -0,0 +1,75 @@ +// Copyright (c) 2008 ETH Zurich (Switzerland) +// Copyright (c) 2008-2009 INRIA Sophia-Antipolis (France) +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez, Stephane Tayeb + +#ifndef CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_DO_INTERSECT_H +#define CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_DO_INTERSECT_H + +#include +#include + +#include +// for CGAL::internal::do_intersect_bbox_segment_aux + +// 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; + + 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() + ); +} + +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 + +#endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SEGMENT_3_DO_INTERSECT_H 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 new file mode 100644 index 00000000000..1e70cfef505 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Sphere_3_do_intersect.h @@ -0,0 +1,69 @@ +// Copyright (c) 2008 INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez + + +#ifndef CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_DO_INTERSECT_H +#define CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_SPHERE_3_DO_INTERSECT_H + +#include +#include +#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::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) { + return K().do_intersect_3_object()(a, b); +} + +template +bool do_intersect(const Sphere_3& a, + const Iso_cuboid_3& b) { + 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 new file mode 100644 index 00000000000..5af2050b235 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Iso_cuboid_3_Triangle_3_do_intersect.h @@ -0,0 +1,65 @@ +// Copyright (c) 2008 INRIA Sophia-Antipolis (France), ETH Zurich (Switzerland). +// Copyright (c) 2010, 2014 GeometryFactory Sarl (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Camille Wormser, Jane Tournois, Pierre Alliez + +#ifndef CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_DO_INTERSECT_H +#define CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_DO_INTERSECT_H + +#include +#include + +// Fast Triangle-Cuboid intersection test, following Tomas Akenine-Moeller description. +// The code looks slightly different from his code because we avoid the translation at +// a minimal cost (and we use C++ ;). + +#include +#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::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 + + + +} //namespace CGAL + +#endif // CGAL_INTERNAL_INTERSECTIONS_3_ISO_CUBOID_3_TRIANGLE_3_DO_INTERSECT_H 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 new file mode 100644 index 00000000000..8470ccd03c6 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Bounded_3_do_intersect.h @@ -0,0 +1,187 @@ +// 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. +// +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Nico Kruithof + +#ifndef CGAL_TETRAHEDRON_3_BOUNDED_3_DO_INTERSECT_H +#define CGAL_TETRAHEDRON_3_BOUNDED_3_DO_INTERSECT_H + +#include +#include +#include +#include + +namespace CGAL { + +template +class Tetrahedron_3; + +namespace Intersections { + +namespace internal { + +template +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 +do_intersect_tetrahedron_bounded(const Bounded &tr, + const typename K::Tetrahedron_3 &tet, + const typename K::Point_3 &p, + const K & k) +{ + typedef typename K::Triangle_3 Triangle; + + CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tr) ); + CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tet) ); + + typedef typename K::Triangle_3 Triangle; + if (do_intersect(tr, Triangle(tet[0], tet[1], tet[2]), k)) return true; + if (do_intersect(tr, Triangle(tet[0], tet[1], tet[3]), k)) return true; + if (do_intersect(tr, Triangle(tet[0], tet[2], tet[3]), k)) return true; + if (do_intersect(tr, Triangle(tet[1], tet[2], tet[3]), k)) return true; + + return k.has_on_bounded_side_3_object()(tet, p); +} + + +template +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3 &tet, + const typename K::Triangle_3 &tr, + const K & k) +{ + return do_intersect_tetrahedron_bounded(tr, tet, tr[0], k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Triangle_3 &tr, + const typename K::Tetrahedron_3 &tet, + const K & k) +{ + return do_intersect_tetrahedron_bounded(tr, tet, tr[0], k); +} + + +template +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3 &tet, + const typename K::Segment_3 &seg, + const K & k) +{ + return do_intersect_tetrahedron_bounded(seg, tet, seg.source(), k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Segment_3 &seg, + const typename K::Tetrahedron_3 &tet, + const K & k) +{ + return do_intersect_tetrahedron_bounded(seg, tet, seg.source(), k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3 &tet, + const typename K::Iso_cuboid_3 &ic, + const K & k) +{ + return do_intersect_tetrahedron_bounded(ic, tet, ic[0], k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Iso_cuboid_3 &ic, + const typename K::Tetrahedron_3 &tet, + const K & k) +{ + return do_intersect_tetrahedron_bounded(ic, tet, ic[0], k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3 &tet, + const typename K::Sphere_3 &sp, + const K & k) +{ + return do_intersect_tetrahedron_bounded(sp, tet, sp.center(), k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Sphere_3 &sp, + const typename K::Tetrahedron_3 &tet, + const K & k) +{ + return do_intersect_tetrahedron_bounded(sp, tet, sp.center(), k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3 &tet, + const typename K::Tetrahedron_3 &sp, + const K & k) +{ + return do_intersect_tetrahedron_bounded(sp, tet, tet[0], k); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Tetrahedron_3 &tet, + const CGAL::Bbox_3 &bb, + const K & k) +{ + return do_intersect_tetrahedron_bounded(bb, tet, typename K::Point_3(bb.xmin(), bb.ymin(), bb.zmin()), k); +} + + template +inline +typename K::Boolean +do_intersect(const CGAL::Bbox_3 &bb, + const typename K::Tetrahedron_3 &tet, + const K & k) +{ + return do_intersect_tetrahedron_bounded(bb, tet, typename K::Point_3(bb.xmin(), bb.ymin(), bb.zmin()), k); +} + +} // namespace internal +} // namespace Intersections +} //namespace CGAL + +#endif // CGAL_TETRAHEDRON_3_BOUNDED_3_DO_INTERSECT_H 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 new file mode 100644 index 00000000000..65c9d38c3be --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Tetrahedron_3_Unbounded_3_do_intersect.h @@ -0,0 +1,97 @@ +// Copyright (c) 2018 GeometryFactory Sarl (France). +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_INTERNAL_INTERSECTIONS_3_TETRAHEDRON_3_DO_INTERSECT_H +#define CGAL_INTERNAL_INTERSECTIONS_3_TETRAHEDRON_3_DO_INTERSECT_H + +#include +#include +#include + +namespace CGAL { + +namespace Intersections { + +namespace internal { + +template +bool do_intersect_tetrahedron_unbounded(const typename K::Tetrahedron_3& tet, + const Unbounded& unb, + const K& k) { + typedef typename K::Triangle_3 Triangle; + if (do_intersect(unb,Triangle(tet[0], tet[1], tet[2]), k)) return true; + if (do_intersect(unb, Triangle(tet[0], tet[1], tet[3]), k)) return true; + if (do_intersect(unb, Triangle(tet[0], tet[2], tet[3]), k)) return true; + if (do_intersect(unb, Triangle(tet[1], tet[2], tet[3]), k)) return true; + return false; +} + + + +template +bool do_intersect(const typename K::Plane_3& unb, + const typename K::Tetrahedron_3& tet, + 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, + const K& k) { + return do_intersect_tetrahedron_unbounded(tet, unb, k); +} + + +template +bool do_intersect(const typename K::Line_3& unb, + const typename K::Tetrahedron_3& tet, + 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, + const K& k) { + return do_intersect_tetrahedron_unbounded(tet, unb, k); +} + + +template +bool do_intersect(const typename K::Ray_3& unb, + const typename K::Tetrahedron_3& tet, + 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 + +#endif // CGAL_INTERNAL_INTERSECTIONS_3_TETRAHEDRON_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Triangle_3_Line_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Line_3_do_intersect.h similarity index 98% rename from Intersections_3/include/CGAL/Triangle_3_Line_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Line_3_do_intersect.h index c73b2d12486..d68297aebea 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Line_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Line_3_do_intersect.h @@ -34,6 +34,9 @@ namespace CGAL { template class Line_3; + +namespace Intersections { + namespace internal { template @@ -117,9 +120,7 @@ bool do_intersect(const typename K::Line_3 &l, } } // namespace internal - -CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Line_3, 3) - +} // namespace Intersections } //namespace CGAL #endif //CGAL_TRIANGLE_3_LINE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Line_3_intersection.h similarity index 99% rename from Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Line_3_intersection.h index a290b1b77d8..fa32149ab80 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Line_3_intersection.h @@ -28,6 +28,9 @@ #include namespace CGAL { + +namespace Intersections { + namespace internal { template @@ -420,10 +423,7 @@ intersection(const typename K::Line_3 &l, } // end namespace internal - -CGAL_INTERSECTION_FUNCTION(Triangle_3, Line_3, 3) - - +} // namespace Intersections } // end namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_TRIANGLE_3_LINE_3_INTERSECTION_H diff --git a/Intersections_3/include/CGAL/Triangle_3_Plane_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Plane_3_do_intersect.h similarity index 97% rename from Intersections_3/include/CGAL/Triangle_3_Plane_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Plane_3_do_intersect.h index ac785f0ce97..5d6c5a1e5e3 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Plane_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Plane_3_do_intersect.h @@ -34,6 +34,8 @@ namespace CGAL { template class Plane_3; +namespace Intersections { + namespace internal { template @@ -81,9 +83,7 @@ bool do_intersect(const typename K::Plane_3 &h, } // namespace internal - -CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Plane_3, 3) - +} // namespace Intersections } //namespace CGAL #endif //CGAL_TRIANGLE_3_PLANE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Triangle_3_Ray_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Ray_3_do_intersect.h similarity index 99% rename from Intersections_3/include/CGAL/Triangle_3_Ray_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Ray_3_do_intersect.h index 93864cfdf60..3a181a43466 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Ray_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Ray_3_do_intersect.h @@ -34,6 +34,8 @@ namespace CGAL { template class Ray_3; + +namespace Intersections { namespace internal { namespace R3T3_intersection{ @@ -380,9 +382,7 @@ do_intersect_coplanar(const typename K::Triangle_3 &t, } // namespace internal - -CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Ray_3, 3) - +} // namespace Intersections } //namespace CGAL #endif // CGAL_TRIANGLE_3_RAY_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Ray_3_intersection.h similarity index 99% rename from Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Ray_3_intersection.h index bdf8830f627..da50c997f0a 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Ray_3_intersection.h @@ -28,6 +28,9 @@ #include namespace CGAL { + +namespace Intersections { + namespace internal { template @@ -577,13 +580,11 @@ typename Intersection_traits::resu intersection(const typename K::Ray_3 &r, const typename K::Triangle_3 &t, const K& k) { - return CGAL::internal::intersection(t, r, k); + return Intersections::internal::intersection(t, r, k); } } // end namespace internal - -CGAL_INTERSECTION_FUNCTION(Triangle_3, Ray_3, 3) - +} // namespace Intersections } // end namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_TRIANGLE_3_RAY_3_INTERSECTION_H diff --git a/Intersections_3/include/CGAL/Triangle_3_Segment_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Segment_3_do_intersect.h similarity index 99% rename from Intersections_3/include/CGAL/Triangle_3_Segment_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Segment_3_do_intersect.h index 3cac5f89d7a..95431085bff 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Segment_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Segment_3_do_intersect.h @@ -34,6 +34,8 @@ namespace CGAL { template class Segment_3; +namespace Intersections { + namespace internal { template @@ -329,9 +331,7 @@ bool do_intersect(const typename K::Segment_3 &s, } } // namespace internal - -CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Segment_3, 3) - +} // namespace Intersections } //namespace CGAL #endif //CGAL_TRIANGLE_3_SEGMENT_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Segment_3_intersection.h similarity index 99% rename from Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Segment_3_intersection.h index 31f9fcf7dcf..f0bf64c31f3 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Segment_3_intersection.h @@ -28,6 +28,9 @@ #include namespace CGAL { + +namespace Intersections { + namespace internal { template @@ -560,11 +563,8 @@ intersection(const typename K::Segment_3 &s, return internal::intersection(t,s,k); } - } // end namespace internal - -CGAL_INTERSECTION_FUNCTION(Triangle_3, Segment_3, 3) - +} // namespace Intersections } // end namespace CGAL #endif // CGAL_INTERNAL_INTERSECTIONS_3_TRIANGLE_3_SEGMENT_3_INTERSECTION_H 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 new file mode 100644 index 00000000000..4cfb6c4b737 --- /dev/null +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Sphere_3_do_intersect.h @@ -0,0 +1,131 @@ +// 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 +// published by the Free Software Foundation; either version 3 of the License, +// or (at your option) any later version. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// SPDX-License-Identifier: LGPL-3.0+ +// +// +// Author(s) : Andreas Fabri + +#ifndef CGAL_TRIANGLE_3_SPHERE_3_DO_INTERSECT_H +#define CGAL_TRIANGLE_3_SPHERE_3_DO_INTERSECT_H + +#include +#include + +namespace CGAL { + +template +class Triangle_3; + +template +class Sphere_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 */) +{ + 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 */) +{ + 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 */) +{ + 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 */) +{ + return squared_distance(sp.center(), lin) <= sp.squared_radius(); +} + + + +template +inline +typename K::Boolean +do_intersect(const typename K::Sphere_3 &sp, + const typename K::Ray_3 &lin, + 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 */) +{ + return squared_distance(sp.center(), lin) <= sp.squared_radius(); +} + +template +inline +typename K::Boolean +do_intersect(const typename K::Sphere_3 &sp, + const typename K::Segment_3 &lin, + 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 */) +{ + 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/include/CGAL/Triangle_3_Triangle_3_do_intersect.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h similarity index 99% rename from Intersections_3/include/CGAL/Triangle_3_Triangle_3_do_intersect.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h index 12dbbe6b92a..72b6893d6ee 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Triangle_3_do_intersect.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_do_intersect.h @@ -31,6 +31,8 @@ namespace CGAL { template class Triangle_3; + +namespace Intersections { namespace internal { @@ -450,9 +452,7 @@ do_intersect(const typename K::Triangle_3 &t1, } } // namespace internal - -CGAL_DO_INTERSECT_FUNCTION_SELF(Triangle_3, 3) - +} // namespace Intersections } //namespace CGAL #endif // CGAL_TRIANGLE_3_TRIANGLE_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h similarity index 98% rename from Intersections_3/include/CGAL/Triangle_3_Triangle_3_intersection.h rename to Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h index 1035e367c2b..8bcf0c3963d 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/Triangle_3_Triangle_3_intersection.h @@ -24,6 +24,7 @@ #define CGAL_TRIANGLE_3_TRIANGLE_3_INTERSECTION_H #include +#include #include #include @@ -34,6 +35,8 @@ namespace CGAL { template class Triangle_3; + +namespace Intersections { namespace internal{ @@ -226,10 +229,8 @@ intersection( return intersection_return(); } -}//namespace internal - -CGAL_INTERSECTION_FUNCTION_SELF(Triangle_3, 3) - +} //namespace internal +} // namespace Intersections } // namespace CGAL diff --git a/Intersections_3/include/CGAL/bbox_intersection_3.h b/Intersections_3/include/CGAL/Intersections_3/internal/bbox_intersection_3.h similarity index 98% rename from Intersections_3/include/CGAL/bbox_intersection_3.h rename to Intersections_3/include/CGAL/Intersections_3/internal/bbox_intersection_3.h index 1351e9650f8..f5a197d144d 100644 --- a/Intersections_3/include/CGAL/bbox_intersection_3.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/bbox_intersection_3.h @@ -32,6 +32,9 @@ namespace CGAL { +namespace Intersections { + + namespace internal { // This function intersects a bbox with a ray, line or segment // Its essentially a copy of the function that was in Bbox_3_intersections.cpp // But it must be a template function since the original kernel must be @@ -187,6 +190,8 @@ intersection_bl(const Bbox_3 &box, #endif } +} // namespace internal +} // namespace Intersections } //namespace CGAL diff --git a/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h b/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h similarity index 94% rename from Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h rename to Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h index 9f65b83e86e..26e25aad2da 100644 --- a/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h +++ b/Intersections_3/include/CGAL/Intersections_3/internal/intersection_3_1_impl.h @@ -24,12 +24,17 @@ // Author(s) : Geert-Jan Giezeman // Sebastien Loriot +#ifndef CGAL_INTERSECTIONS_3_INTERNAL_INTERSECTION_3_1_IMPL_H +#define CGAL_INTERSECTIONS_3_INTERNAL_INTERSECTION_3_1_IMPL_H #include #include #include #include +#include +#include +#include namespace CGAL { template @@ -53,6 +58,9 @@ namespace CGAL { template class Iso_cuboid_3; + template + class Point_3; + // the special plane_3 function template inline @@ -67,100 +75,7 @@ intersection(const Plane_3 &plane1, const Plane_3 &plane2, return K().intersect_3_object()(plane1, plane2, plane3); } -CGAL_INTERSECTION_FUNCTION(Plane_3, Line_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Plane_3, Line_3, 3) -CGAL_INTERSECTION_FUNCTION_SELF(Plane_3, 3) - -CGAL_INTERSECTION_FUNCTION_SELF(Line_3, 3) -CGAL_DO_INTERSECT_FUNCTION_SELF(Line_3, 3) - -CGAL_INTERSECTION_FUNCTION_SELF(Segment_3, 3) -CGAL_DO_INTERSECT_FUNCTION_SELF(Segment_3, 3) - -CGAL_INTERSECTION_FUNCTION(Line_3, Segment_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Line_3, Segment_3, 3) - -CGAL_INTERSECTION_FUNCTION(Line_3, Ray_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Line_3, Ray_3, 3) - -CGAL_INTERSECTION_FUNCTION(Segment_3, Ray_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Segment_3, Ray_3, 3) - -CGAL_INTERSECTION_FUNCTION_SELF(Ray_3, 3) -CGAL_DO_INTERSECT_FUNCTION_SELF(Ray_3, 3) - -CGAL_INTERSECTION_FUNCTION(Plane_3, Sphere_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Plane_3, Sphere_3, 3) - -CGAL_INTERSECTION_FUNCTION_SELF(Sphere_3, 3) -CGAL_DO_INTERSECT_FUNCTION_SELF(Sphere_3, 3) - -CGAL_INTERSECTION_FUNCTION(Plane_3, Ray_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Plane_3, Ray_3, 3) - -CGAL_INTERSECTION_FUNCTION(Plane_3, Segment_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Plane_3, Segment_3, 3) - -CGAL_INTERSECTION_FUNCTION(Plane_3, Triangle_3, 3) - -template -inline typename -cpp11::result_of::type -intersection(const Line_3 &a, - const Bbox_3 &b) { - return K().intersect_3_object()(a, b); -} - -template -inline typename -cpp11::result_of::type -intersection(const Bbox_3 &a, - const Line_3 &b) { - return K().intersect_3_object()(a, b); -} - -template -inline typename -cpp11::result_of::type -intersection(const Ray_3 &a, - const Bbox_3 &b) { - return K().intersect_3_object()(a, b); -} - -template -inline typename -cpp11::result_of::type -intersection(const Bbox_3 &a, - const Ray_3 &b) { - return K().intersect_3_object()(a, b); -} - -template -inline typename -cpp11::result_of::type -intersection(const Segment_3 &a, - const Bbox_3 &b) { - return K().intersect_3_object()(a, b); -} - -template -inline typename -cpp11::result_of::type -intersection(const Bbox_3 &a, - const Segment_3 &b) { - return K().intersect_3_object()(a, b); -} - -CGAL_INTERSECTION_FUNCTION(Line_3, Iso_cuboid_3, 3) - -CGAL_INTERSECTION_FUNCTION(Ray_3, Iso_cuboid_3, 3) - -CGAL_INTERSECTION_FUNCTION(Segment_3, Iso_cuboid_3, 3) - -CGAL_INTERSECTION_FUNCTION_SELF(Iso_cuboid_3, 3) - -CGAL_DO_INTERSECT_FUNCTION_SELF(Plane_3, 3) template inline bool @@ -169,11 +84,10 @@ do_intersect(const Plane_3 &plane1, const Plane_3 &plane2, return R().do_intersect_3_object()(plane1, plane2, plane3); } -CGAL_DO_INTERSECT_FUNCTION_SELF(Iso_cuboid_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Line_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Ray_3, 3) -CGAL_DO_INTERSECT_FUNCTION(Iso_cuboid_3, Segment_3, 3) + + +namespace Intersections { namespace internal { template @@ -1699,34 +1613,8 @@ do_intersect(const Iso_cuboid_3 &j, const Line_3 &l, const R&) return bool(CGAL::intersection(l, j)); } -template -inline bool -do_intersect(const Ray_3 &r, const Iso_cuboid_3 &j, const R&) -{ - return bool(CGAL::intersection(r, j)); -} - -template -inline bool -do_intersect(const Iso_cuboid_3 &j, const Ray_3 &r, const R&) -{ - return bool(CGAL::intersection(r, j)); -} - -template -inline bool -do_intersect(const Segment_3 &s, const Iso_cuboid_3 &j, const R&) -{ - return bool(CGAL::intersection(s, j)); -} - -template -inline bool -do_intersect(const Iso_cuboid_3 &j, const Segment_3 &s, const R&) -{ - return bool(CGAL::intersection(s, j)); -} - } // namespace internal +} // namespace Intersections +} // namespace CGAL -} //namespace CGAL +#endif // CGAL_INTERSECTIONS_3_INTERNAL_INTERSECTION_3_1_IMPL_H diff --git a/Intersections_3/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h b/Intersections_3/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h deleted file mode 100644 index a0987b3529f..00000000000 --- a/Intersections_3/include/CGAL/Triangle_3_Tetrahedron_3_do_intersect.h +++ /dev/null @@ -1,80 +0,0 @@ -// 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. -// -// 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 -// published by the Free Software Foundation; either version 3 of the License, -// or (at your option) any later version. -// -// Licensees holding a valid commercial license may use this file in -// accordance with the commercial license agreement provided with the software. -// -// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE -// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: LGPL-3.0+ -// -// -// Author(s) : Nico Kruithof - -#ifndef CGAL_TRIANGLE_3_TETRAHEDRON_3_DO_INTERSECT_H -#define CGAL_TRIANGLE_3_TETRAHEDRON_3_DO_INTERSECT_H - -#include - -namespace CGAL { - - template - class Tetrahedron_3; - -namespace internal { - -// This code is not optimized: -template -typename K::Boolean -do_intersect(const typename K::Triangle_3 &tr, - const typename K::Tetrahedron_3 &tet, - const K & k) -{ - typedef typename K::Triangle_3 Triangle; - - CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tr) ); - CGAL_kernel_precondition( ! k.is_degenerate_3_object() (tet) ); - - if (do_intersect(tr, Triangle(tet[0], tet[1], tet[2]), k)) return true; - if (do_intersect(tr, Triangle(tet[0], tet[1], tet[3]), k)) return true; - if (do_intersect(tr, Triangle(tet[0], tet[2], tet[3]), k)) return true; - if (do_intersect(tr, Triangle(tet[1], tet[2], tet[3]), k)) return true; - - CGAL_kernel_assertion(k.bounded_side_3_object()(tet, tr[0]) == - k.bounded_side_3_object()(tet, tr[1])); - CGAL_kernel_assertion(k.bounded_side_3_object()(tet, tr[0]) == - k.bounded_side_3_object()(tet, tr[2])); - - return k.has_on_bounded_side_3_object()(tet, tr[0]); -} - - -template -inline -typename K::Boolean -do_intersect(const typename K::Tetrahedron_3 &tet, - const typename K::Triangle_3 &tr, - const K & k) -{ - return do_intersect(tr, tet, k); -} - -} // namespace internal - -CGAL_DO_INTERSECT_FUNCTION(Triangle_3, Tetrahedron_3, 3) - -} //namespace CGAL - -#endif // CGAL_TRIANGLE_3_TETRAHEDRON_3_DO_INTERSECT_H diff --git a/Intersections_3/include/CGAL/intersection_3.h b/Intersections_3/include/CGAL/intersection_3.h index 2aa69cf954c..cc50d65cf87 100644 --- a/Intersections_3/include/CGAL/intersection_3.h +++ b/Intersections_3/include/CGAL/intersection_3.h @@ -1,9 +1,9 @@ -// Copyright (c) 1997 +// Copyright (c) 1997 // 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) : Geert-Jan Giezeman @@ -29,28 +29,71 @@ #include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include #include diff --git a/Intersections_3/include/CGAL/intersection_3_1.h b/Intersections_3/include/CGAL/intersection_3_1.h index 3d6a6338ade..b8b607d3500 100644 --- a/Intersections_3/include/CGAL/intersection_3_1.h +++ b/Intersections_3/include/CGAL/intersection_3_1.h @@ -28,7 +28,7 @@ #ifndef CGAL_INTERSECTION_3_1_H #define CGAL_INTERSECTION_3_1_H -#include -#include +#include +#include #endif // CGAL_INTERSECTION_3_1_H diff --git a/Intersections_3/package_info/Intersections_3/dependencies b/Intersections_3/package_info/Intersections_3/dependencies index 9404dbf7f32..a53fa50a264 100644 --- a/Intersections_3/package_info/Intersections_3/dependencies +++ b/Intersections_3/package_info/Intersections_3/dependencies @@ -1,5 +1,6 @@ Algebraic_foundations Distance_2 +Distance_3 Installation Intersections_2 Intersections_3 diff --git a/Intersections_3/test/Intersections_3/CMakeLists.txt b/Intersections_3/test/Intersections_3/CMakeLists.txt index 97393c87e2d..f218d33bd42 100644 --- a/Intersections_3/test/Intersections_3/CMakeLists.txt +++ b/Intersections_3/test/Intersections_3/CMakeLists.txt @@ -15,7 +15,6 @@ if ( CGAL_FOUND ) foreach(cppfile ${cppfiles}) create_single_source_cgal_program( "${cppfile}" ) endforeach() - else() message(STATUS "This program requires the CGAL library, and will not be compiled.") diff --git a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp index 8364de1f8fb..9880a7bc056 100644 --- a/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp +++ b/Intersections_3/test/Intersections_3/bbox_other_do_intersect_test.cpp @@ -31,7 +31,6 @@ // leda_rational, or Gmpq, or Quotient typedef CGAL::Exact_rational Rational; -#include #include #include #include @@ -62,10 +61,10 @@ typename K::Point_3 random_point_in(const CGAL::Bbox_3& bbox) } -template +template bool test_aux(const T& t, const std::string& name, - const CGAL::Bbox_3& bbox, + const Box3& bbox, bool expected, bool /*exact_predicates*/ = false) { bool b = CGAL::do_intersect(t,bbox); @@ -386,6 +385,7 @@ bool test(bool exact_kernel = false) typedef typename K::Sphere_3 Sphere; typedef typename K::Plane_3 Plane; typedef typename K::Triangle_3 Triangle; + typedef typename K::Iso_cuboid_3 Iso_cuboid_3; CGAL::Bbox_3 bbox(1.0,1.0,1.0,10.0,50.0,100.0); @@ -540,6 +540,12 @@ bool test(bool exact_kernel = false) b &= test_aux(sphE_1,"sphE_1",bbox,true); b &= test_aux(sph1_3,"sph1_3",bbox,true); + b &= test_aux(sphA_1,"sphA_1",Iso_cuboid_3(bbox),false); + b &= test_aux(sphB_1,"sphB_1",Iso_cuboid_3(bbox),true); + b &= test_aux(sphC_1,"sphC_1",Iso_cuboid_3(bbox),false); + b &= test_aux(sphE_1,"sphE_1",Iso_cuboid_3(bbox),true); + b &= test_aux(sph1_3,"sph1_3",Iso_cuboid_3(bbox),true); + Plane Pl1(Point(1,1,1),Vector(0,0,1)); Plane Pl2(Point(1,1,1),Vector(1,1,1)); Plane Pl3(Point(5,5,5),Vector(1,2,-5)); @@ -550,6 +556,11 @@ bool test(bool exact_kernel = false) b &= test_aux(Pl3,"Pl3",bbox,true); b &= test_aux(Pl4,"Pl4",bbox,false); + b &= test_aux(Pl1,"Pl1",Iso_cuboid_3(bbox),true); + b &= test_aux(Pl2,"Pl2",Iso_cuboid_3(bbox),true); + b &= test_aux(Pl3,"Pl3",Iso_cuboid_3(bbox),true); + b &= test_aux(Pl4,"Pl4",Iso_cuboid_3(bbox),false); + Triangle t123(p1,p2,p3); Triangle t124(p1,p2,p4); Triangle t126(p1,p2,p6); @@ -568,6 +579,14 @@ bool test(bool exact_kernel = false) b &= test_aux(t2,"t2",bbox,true); b &= test_aux(t3,"t3",bbox,false); + b &= test_aux(t123,"t123",Iso_cuboid_3(bbox),true); + b &= test_aux(t124,"t124",Iso_cuboid_3(bbox),true); + b &= test_aux(t126,"t126",Iso_cuboid_3(bbox),true); + b &= test_aux(t136,"t136",Iso_cuboid_3(bbox),true); + b &= test_aux(tABC,"tABC",Iso_cuboid_3(bbox),true); + b &= test_aux(t1,"t1",Iso_cuboid_3(bbox),true); + b &= test_aux(t2,"t2",Iso_cuboid_3(bbox),true); + b &= test_aux(t3,"t3",Iso_cuboid_3(bbox),false); // Test more bboxes CGAL::Bbox_3 bbox2(-0.248143,-0.49325,0.0747943,-0.107021,-0.406955,0.151042); @@ -601,6 +620,9 @@ bool test(bool exact_kernel = false) b &= test_aux(line2, "line2", bbox2, false); b &= test_aux(line3, "line3", bbox3, true); b &= test_aux(line4, "line4", bbox4, false); + + Iso_cuboid_3 ic(bbox); + b &= test_aux(ic, "ic", bbox, true); // Use do_intersect(bbox,bbox) CGAL::do_intersect(bbox2,bbox4); diff --git a/Intersections_3/test/Intersections_3/call_test.cpp b/Intersections_3/test/Intersections_3/call_test.cpp index 303078d0076..768c7d4ac6e 100644 --- a/Intersections_3/test/Intersections_3/call_test.cpp +++ b/Intersections_3/test/Intersections_3/call_test.cpp @@ -1,8 +1,5 @@ -#include #include #include -#include -#include #include #include diff --git a/Intersections_3/test/Intersections_3/test_intersections_3.cpp b/Intersections_3/test/Intersections_3/test_intersections_3.cpp index 4a4ec69e0bf..fd14042279b 100644 --- a/Intersections_3/test/Intersections_3/test_intersections_3.cpp +++ b/Intersections_3/test/Intersections_3/test_intersections_3.cpp @@ -62,6 +62,7 @@ struct Test { typedef CGAL::Triangle_3< K > Tr; typedef CGAL::Ray_3< K > R; typedef CGAL::Iso_cuboid_3< K > Cub; + typedef CGAL::Sphere_3< K > Sph; typedef CGAL::Bbox_3 Bbox; @@ -155,6 +156,18 @@ struct Test { return Pl(to_nt(a*w), to_nt(b*w), to_nt(c*w), to_nt(d*w)); } + void P_do_intersect() + { + P p(0,0,0), q(1,0,0), r(2,0,0), s(10,10,10); + Sph sph(p,1); + Cub cub(p,r); + assert(do_intersect(q,sph)); + assert(do_intersect(sph,q)); + assert(! do_intersect(s,cub)); + assert(! do_intersect(cub,s)); + } + + void Cub_Cub() { std::cout << "Iso_cuboid - Iso_cuboid\n"; @@ -556,6 +569,7 @@ struct Test { void run() { std::cout << "3D Intersection tests\n"; + P_do_intersect(); Cub_Cub(); L_Cub(); Pl_L(); @@ -583,3 +597,4 @@ int main() Test< CGAL::Homogeneous >().run(); // TODO : test more kernels. } + diff --git a/Intersections_3/test/Intersections_3/test_point_3_intersections.cpp b/Intersections_3/test/Intersections_3/test_point_3_intersections.cpp new file mode 100644 index 00000000000..999c23f2278 --- /dev/null +++ b/Intersections_3/test/Intersections_3/test_point_3_intersections.cpp @@ -0,0 +1,136 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +typedef CGAL::Exact_predicates_exact_constructions_kernel Epeck; +typedef CGAL::Exact_predicates_inexact_constructions_kernel Epick; + +template +void test_P_Cub() +{ + typedef CGAL::Point_3 P; + typedef CGAL::Iso_cuboid_3 Cub; + P p(0.0,1.0,0.5); + Cub cub(P(-1.0,-1.0,-1.0), P(1.0,1.0,1.0)); + assert(CGAL::do_intersect(p, cub)); + CGAL::Object o = CGAL::intersection(p,cub); + P res; + assert(assign(res, o)); + assert(res == p); +} +template +void test_P_L() +{ + typedef CGAL::Point_3 P; + typedef CGAL::Line_3 Line; + P p(0.99,0.99,0.99); + Line line(P(-1.0,-1.0,-1.0), P(1.0,1.0,1.0)); + assert(CGAL::do_intersect(p, line)); + CGAL::Object o = CGAL::intersection(p,line); + P res; + assert(assign(res, o)); + assert(res == p); +} +template +void test_P_R() +{ + typedef CGAL::Point_3 P; + typedef CGAL::Ray_3 Ray; + P p(0.99,0.99,0.99); + Ray ray(P(-1.0,-1.0,-1.0), P(1.0,1.0,1.0)); + assert(CGAL::do_intersect(p, ray)); + CGAL::Object o = CGAL::intersection(p,ray); + P res; + assert(assign(res, o)); + assert(res == p); +} +template +void test_P_S() +{ + typedef CGAL::Point_3 P; + typedef CGAL::Segment_3 S; + P p(0.99,0.99,0.99); + S s(P(-1.0,-1.0,-1.0), P(1.0,1.0,1.0)); + assert(CGAL::do_intersect(p, s)); + CGAL::Object o = CGAL::intersection(p,s); + P res; + assert(assign(res, o)); + assert(res == p); +} +template +void test_P_P() +{ + typedef CGAL::Point_3 P; + P p(0.99,0.99,0.99); + assert(CGAL::do_intersect(p, p)); + CGAL::Object o = CGAL::intersection(p,p); + P res; + assert(assign(res, o)); + assert(res == p); +} +template +void test_P_Pl() +{ + typedef CGAL::Point_3 P; + typedef CGAL::Plane_3 Pl; + P p(0.99,0.99,0.99); + Pl pl(P(-1.0,-1.0,-1.0), P(1.0,1.0,1.0), P(0.0,0.0,0.0)); + assert(CGAL::do_intersect(p, pl)); + CGAL::Object o = CGAL::intersection(p,pl); + P res; + assert(assign(res, o)); + assert(res == p); +} + +template +void test_P_Tet() +{ + typedef CGAL::Point_3 P; + typedef CGAL::Tetrahedron_3 T; + P p(0,0,0), q(1,0,0), r(1,1,0), s(0,0,1); + T t(p,q,r,s); + P q0(0.1, 0.1, 0.1), q1(10,10,10); + + assert(CGAL::do_intersect(p,t)); + assert(CGAL::do_intersect(t,p)); + + assert(CGAL::do_intersect(q0,t)); + assert(CGAL::do_intersect(t,q0)); + + assert(! CGAL::do_intersect(q1,t)); + assert(! CGAL::do_intersect(t,q1)); +} + +int main() +{ + test_P_Cub(); + test_P_Cub(); + + test_P_L(); + test_P_L(); + + test_P_R(); + test_P_R(); + test_P_S(); + test_P_S(); + + test_P_P(); + test_P_P(); + + test_P_Pl(); + test_P_Pl(); + + test_P_Tet(); + test_P_Tet(); +} +#include + + + diff --git a/Intersections_3/test/Intersections_3/tetrahedron.cpp b/Intersections_3/test/Intersections_3/tetrahedron.cpp new file mode 100644 index 00000000000..2e39619ef3b --- /dev/null +++ b/Intersections_3/test/Intersections_3/tetrahedron.cpp @@ -0,0 +1,56 @@ +#include + +#include + +typedef CGAL::Cartesian K; + +typedef K::Point_3 Point; +typedef K::Tetrahedron_3 Tetrahedron; + +typedef K::Segment_3 Segment; +typedef K::Triangle_3 Triangle; +typedef K::Iso_cuboid_3 Iso_cuboid; +typedef K::Sphere_3 Sphere; + +typedef K::Plane_3 Plane; +typedef K::Line_3 Line; +typedef K::Ray_3 Ray; + +typedef CGAL::Bbox_3 Bbox; + +int main() +{ + Point p(0,0,0), q(10,0,0), r(10,10,0), s(0, 10,10); + Point p2(1,1,1), q2(20,20,20), r2(0,0,20); + Tetrahedron tet(p,q,r,s); + Sphere sp(p2,1.0); + + CGAL::do_intersect(tet,Triangle(p2,q2,r2)); + CGAL::do_intersect(tet,Segment(p2,q2)); + CGAL::do_intersect(tet,Iso_cuboid(p2,q2)); + CGAL::do_intersect(tet,sp); + CGAL::do_intersect(tet,Plane(p2,q2,r2)); + CGAL::do_intersect(tet,Line(p2,q2)); + CGAL::do_intersect(tet,Ray(p2,q2)); + CGAL::do_intersect(tet,tet); + CGAL::do_intersect(tet,sp.bbox()); + CGAL::do_intersect(sp, Line(p2,q2)); + CGAL::do_intersect(sp, Ray(p2,q2)); + CGAL::do_intersect(sp, Segment(p2,q2)); + + + CGAL::do_intersect(Triangle(p2,q2,r2), tet); + CGAL::do_intersect(Segment(p2,q2), tet); + CGAL::do_intersect(Iso_cuboid(p2,q2), tet); + CGAL::do_intersect(sp, tet); + CGAL::do_intersect(Plane(p2,q2,r2), tet); + CGAL::do_intersect(Line(p2,q2), tet); + CGAL::do_intersect(Ray(p2,q2), tet); + CGAL::do_intersect(sp.bbox(), tet); + + CGAL::do_intersect(Line(p2,q2), sp); + CGAL::do_intersect(Ray(p2,q2), sp); + CGAL::do_intersect(Segment(p2,q2), sp); + + return 0; +} diff --git a/Intersections_3/test/Intersections_3/triangle_other.cpp b/Intersections_3/test/Intersections_3/triangle_other.cpp index fdfccc372fe..e9ffa8b5861 100644 --- a/Intersections_3/test/Intersections_3/triangle_other.cpp +++ b/Intersections_3/test/Intersections_3/triangle_other.cpp @@ -1,15 +1,14 @@ #include - -#include #include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/Intersections_3/test/Intersections_3/triangle_other_intersection_test.cpp b/Intersections_3/test/Intersections_3/triangle_other_intersection_test.cpp index 312b2edbd15..c954ea13b0c 100644 --- a/Intersections_3/test/Intersections_3/triangle_other_intersection_test.cpp +++ b/Intersections_3/test/Intersections_3/triangle_other_intersection_test.cpp @@ -21,7 +21,6 @@ #include -#include #include #include #include diff --git a/Kernel_23/doc/Kernel_23/CGAL/intersections.h b/Kernel_23/doc/Kernel_23/CGAL/intersections.h index 29179cfc0bf..0678d09d11c 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/intersections.h +++ b/Kernel_23/doc/Kernel_23/CGAL/intersections.h @@ -63,6 +63,7 @@ Also, `Type1` and `Type2` can be both of type In three-dimensional space, the types `Type1` and `Type2` can be any of the following: +- `Point_3` - `Plane_3` - `Line_3` - `Ray_3` @@ -220,6 +221,9 @@ It is equivalent to `boost::optional< boost::variant< T... > >`, the last column +Additional overloads are provided for the type `Point_2` combined with any other type with the result type being +`boost::optional< boost::variant< Point_2 > >`. + \cgalHeading{3D Intersections} The return type can be obtained through `CGAL::cpp11::result_of::%type`. @@ -319,6 +323,10 @@ p Point_3, or Segment_3 +Additional overloads are provided for the type `Point_3` combined with any other type with the result type being +`boost::optional< boost::variant< Point_3 > >`. + + \cgalHeading{Examples} The following examples demonstrate the most common use of diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index 5f6f6b9e38e..20b78926626 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -7395,6 +7395,7 @@ public: the types `Type1` and `Type2` can be any of the following: + - `Kernel::Point_2` - `Kernel::Plane_3` - `Kernel::Line_3` - `Kernel::Ray_3` diff --git a/Kernel_23/include/CGAL/Bbox_3.h b/Kernel_23/include/CGAL/Bbox_3.h index c9a35081bfa..447e1cd4fde 100644 --- a/Kernel_23/include/CGAL/Bbox_3.h +++ b/Kernel_23/include/CGAL/Bbox_3.h @@ -77,6 +77,9 @@ public: inline double min BOOST_PREVENT_MACRO_SUBSTITUTION (int i) const; inline double max BOOST_PREVENT_MACRO_SUBSTITUTION (int i) const; + inline double min_coord(int i) const { return (min)(i); } + inline double max_coord(int i) const { return (max)(i); } + Bbox_3 operator+(const Bbox_3& b) const; Bbox_3& operator+=(const Bbox_3& b); diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index ef3224824ba..666344462d5 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -2951,7 +2951,7 @@ namespace CommonKernelFunctors { template result_type operator()(const T1& t1, const T2& t2) const - { return internal::do_intersect(t1, t2, K()); } + { return Intersections::internal::do_intersect(t1, t2, K()); } }; template @@ -2964,11 +2964,11 @@ namespace CommonKernelFunctors { template result_type operator()(const T1& t1, const T2& t2) const - { return internal::do_intersect(t1, t2, K()); } + { return Intersections::internal::do_intersect(t1, t2, K()); } result_type operator()(const typename K::Plane_3& pl1, const typename K::Plane_3& pl2, const typename K::Plane_3& pl3) const - { return internal::do_intersect(pl1, pl2, pl3, K() ); } + { return Intersections::internal::do_intersect(pl1, pl2, pl3, K() ); } }; @@ -3496,7 +3496,7 @@ namespace CommonKernelFunctors { template typename Intersection_traits::result_type operator()(const T1& t1, const T2& t2) const - { return internal::intersection(t1, t2, K()); } + { return Intersections::internal::intersection(t1, t2, K()); } }; template @@ -3529,7 +3529,7 @@ namespace CommonKernelFunctors { template typename cpp11::result_of< Intersect_3(T1, T2) >::type operator()(const T1& t1, const T2& t2) const - { return internal::intersection(t1, t2, K() ); } + { return Intersections::internal::intersection(t1, t2, K() ); } #if CGAL_INTERSECTION_VERSION < 2 CGAL::Object @@ -3537,7 +3537,7 @@ namespace CommonKernelFunctors { typename boost::optional< boost::variant< typename K::Point_3, typename K::Line_3, typename K::Plane_3 > > #endif operator()(const Plane_3& pl1, const Plane_3& pl2, const Plane_3& pl3)const - { return internal::intersection(pl1, pl2, pl3, K() ); } + { return Intersections::internal::intersection(pl1, pl2, pl3, K() ); } }; template diff --git a/Kernel_d/include/CGAL/Kernel_d/function_objects.h b/Kernel_d/include/CGAL/Kernel_d/function_objects.h index 591f4bd313c..4c1bd3b7829 100644 --- a/Kernel_d/include/CGAL/Kernel_d/function_objects.h +++ b/Kernel_d/include/CGAL/Kernel_d/function_objects.h @@ -222,7 +222,7 @@ public: template typename result::type operator()(const T1& t1, const T2& t2) const - { return internal::intersection(t1, t2, R()); } + { return Intersections::internal::intersection(t1, t2, R()); } #endif }; @@ -235,7 +235,7 @@ class Do_intersect template bool operator()(const T1& t1, const T2& t2) const - { return CGAL::internal::do_intersect(t1, t2, R()); } + { return CGAL::Intersections::internal::do_intersect(t1, t2, R()); } }; } // end namespace internal diff --git a/Kernel_d/include/CGAL/intersections_d.h b/Kernel_d/include/CGAL/intersections_d.h index 6ad4e019ba2..b37feb2356c 100644 --- a/Kernel_d/include/CGAL/intersections_d.h +++ b/Kernel_d/include/CGAL/intersections_d.h @@ -30,6 +30,7 @@ #include namespace CGAL { +namespace Intersections { namespace internal { template @@ -358,6 +359,7 @@ inline bool do_intersect(const typename R::Hyperplane_d& h, const typename R::Se { return do_intersect(s,h,r); } } //namespace internal +} // namespace Intersections template class Hyperplane_d; diff --git a/Nef_2/include/CGAL/Bounded_kernel.h b/Nef_2/include/CGAL/Bounded_kernel.h index 736788715f4..09868640f72 100644 --- a/Nef_2/include/CGAL/Bounded_kernel.h +++ b/Nef_2/include/CGAL/Bounded_kernel.h @@ -27,7 +27,7 @@ #include #include -#include +#include #undef CGAL_NEF_DEBUG diff --git a/Nef_2/include/CGAL/Extended_cartesian.h b/Nef_2/include/CGAL/Extended_cartesian.h index 9f6b4603dbb..c0f650302d6 100644 --- a/Nef_2/include/CGAL/Extended_cartesian.h +++ b/Nef_2/include/CGAL/Extended_cartesian.h @@ -27,7 +27,7 @@ #include #include -#include +#include #include #undef CGAL_NEF_DEBUG diff --git a/Nef_2/include/CGAL/Extended_homogeneous.h b/Nef_2/include/CGAL/Extended_homogeneous.h index ffa4a532689..dcbe2e843fb 100644 --- a/Nef_2/include/CGAL/Extended_homogeneous.h +++ b/Nef_2/include/CGAL/Extended_homogeneous.h @@ -28,7 +28,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Nef_S2/package_info/Nef_S2/dependencies b/Nef_S2/package_info/Nef_S2/dependencies index 37eb1b85d72..75135011028 100644 --- a/Nef_S2/package_info/Nef_S2/dependencies +++ b/Nef_S2/package_info/Nef_S2/dependencies @@ -16,3 +16,4 @@ Profiling_tools STL_Extension Stream_support Union_find +Distance_3 diff --git a/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies b/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies index 625a107675c..9b809650984 100644 --- a/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies +++ b/Optimal_transportation_reconstruction_2/package_info/Optimal_transportation_reconstruction_2/dependencies @@ -20,3 +20,4 @@ Spatial_sorting Stream_support TDS_2 Triangulation_2 +Distance_3 diff --git a/Partition_2/include/CGAL/Partition_2/Vertex_visibility_graph_2.h b/Partition_2/include/CGAL/Partition_2/Vertex_visibility_graph_2.h index bc931dce3c0..f38034fff5e 100644 --- a/Partition_2/include/CGAL/Partition_2/Vertex_visibility_graph_2.h +++ b/Partition_2/include/CGAL/Partition_2/Vertex_visibility_graph_2.h @@ -68,7 +68,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h index 41d488b23f4..1b36ff04416 100644 --- a/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h +++ b/Partition_2/include/CGAL/Partition_2/partition_y_monotone_2.h @@ -45,7 +45,7 @@ #include #include -#include +#include #include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h index 0bde009ee57..119d17a8cc6 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Corefinement/intersect_triangle_and_segment_3.h @@ -26,7 +26,7 @@ #include -#include +#include #include #include @@ -165,7 +165,7 @@ intersection_type( // the segment is coplanar with the triangle's supporting plane // we test whether the segment intersects the triangle in the common // supporting plane - if ( ::CGAL::internal::do_intersect_coplanar(a,b,c,p,q,Kernel()) ) + if ( ::CGAL::Intersections::internal::do_intersect_coplanar(a,b,c,p,q,Kernel()) ) return result_type(COPLANAR_TRIANGLES,GT::null_halfedge(),true,true); return result_type(EMPTY,GT::null_halfedge(),true,true); diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h index ee65e27aa3a..53c846cd686 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Polygon_mesh_slicer/Traversal_traits.h @@ -27,7 +27,7 @@ #include -#include +#include #include #include diff --git a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h index c4e94d216f2..57ffe845669 100644 --- a/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h +++ b/Polygon_mesh_processing/include/CGAL/Polygon_mesh_processing/internal/Side_of_triangle_mesh/Ray_3_Triangle_3_traversal_traits.h @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include @@ -60,16 +60,16 @@ public: template void intersection(const Query& query, const Primitive& primitive) { - internal::r3t3_do_intersect_endpoint_position_visitor visitor; - std::pair res= - internal::do_intersect(m_helper.get_primitive_datum(primitive, m_aabb_traits), query,Kernel(),visitor); + Intersections::internal::r3t3_do_intersect_endpoint_position_visitor visitor; + std::pair res= + Intersections::internal::do_intersect(m_helper.get_primitive_datum(primitive, m_aabb_traits), query,Kernel(),visitor); if (res.first){ switch (res.second){ - case internal::R3T3_intersection::CROSS_FACET: + case Intersections::internal::R3T3_intersection::CROSS_FACET: ++m_status.second; break; - case internal::R3T3_intersection::ENDPOINT_IN_TRIANGLE: + case Intersections::internal::R3T3_intersection::ENDPOINT_IN_TRIANGLE: m_status.first=false; m_stop=true; break; diff --git a/Polyhedron/package_info/Polyhedron/dependencies b/Polyhedron/package_info/Polyhedron/dependencies index 70c007e409d..b810ef1e411 100644 --- a/Polyhedron/package_info/Polyhedron/dependencies +++ b/Polyhedron/package_info/Polyhedron/dependencies @@ -19,3 +19,4 @@ Profiling_tools Property_map STL_Extension Stream_support +Distance_3 diff --git a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies index 3ea7153c7fe..9dbfd435104 100644 --- a/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies +++ b/Surface_mesh_parameterization/package_info/Surface_mesh_parameterization/dependencies @@ -24,3 +24,4 @@ Stream_support Surface_mesh_parameterization TDS_2 Triangulation_2 +Distance_3 diff --git a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h index 5a01a8b5375..674af767ad4 100644 --- a/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h +++ b/Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/AABB_traits.h @@ -61,7 +61,7 @@ public: const Point_3& p = segment.source(); const Point_3& q = segment.target(); - return internal::do_intersect_bbox_segment_aux + return Intersections::internal::do_intersect_bbox_segment_aux #include -#include +#include namespace CGAL { diff --git a/Visibility_2/package_info/Visibility_2/dependencies b/Visibility_2/package_info/Visibility_2/dependencies index c4a79a1d03c..df17db35a32 100644 --- a/Visibility_2/package_info/Visibility_2/dependencies +++ b/Visibility_2/package_info/Visibility_2/dependencies @@ -23,3 +23,4 @@ Surface_sweep_2 TDS_2 Triangulation_2 Visibility_2 +Distance_3