diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index adc25f0b55f..a8f75705857 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -23,7 +23,10 @@ #include #include +#include +#include +#include #include // The macro CGAL_INTERSECTION_VERSION controls which version of the @@ -38,29 +41,42 @@ #define CGAL_INTERSECTION_VERSION 2 #endif -#define CGAL_INTERSECTION_TRAITS_2(A, B, R1, R2, DIMTAG) \ +#if CGAL_INTERSECTION_VERSION < 2 + +#define CGAL_INTERSECTION_TRAITS_2(A, B, R1, R2) +#define CGAL_INTERSECTION_TRAITS_3(A, B, R1, R2, R3) + +#else + +#define CGAL_INTERSECTION_TRAITS_2(A, B, R1, R2) \ template \ struct Intersection_traits { \ typedef typename boost::variant \ variant_type; \ typedef typename boost::optional< variant_type > result_type; \ - typedef internal::DIMTAG Dim_tag; \ }; -#define CGAL_INTERSECTION_TRAITS_3(A, B, R1, R2, R3, DIMTAG) \ +#define CGAL_INTERSECTION_TRAITS_3(A, B, R1, R2, R3) \ template \ struct Intersection_traits { \ typedef typename boost::variant variant_type; \ typedef typename boost::optional< variant_type > result_type; \ - typedef internal::DIMTAG Dim_tag; \ }; +#endif + namespace CGAL { // only declarationn template -struct Intersection_traits {}; +struct Intersection_traits { + // This defaults to Object, if we use VERSION < 2 and to nothing + // otherwise. + #if CGAL_INTERSECTION_VERSION < 2 + typedef CGAL::Object result_type; + #endif +}; // alias template @@ -141,61 +157,44 @@ const T* intersect_get(const boost::variant & v) { return boost::get(&v); } -// tags for dispatch -struct Intersection_dim_two {}; -struct Intersection_dim_three {}; -struct Intersection_dim_d {}; - template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT< typename CGAL::Kernel_traits::Kernel, A, B>::result_type -#endif -intersection_impl(const A& a, const B& b, Intersection_dim_two) { +intersection_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_2_object()(a, b); } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT< typename CGAL::Kernel_traits::Kernel, A, B>::result_type -#endif -intersection_impl(const A& a, const B& b, Intersection_dim_three) { +intersection_impl(const A& a, const B& b, Dimension_tag<3>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_3_object()(a, b); } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT< typename CGAL::Kernel_traits::Kernel, A, B>::result_type -#endif -intersection_impl(const A& a, const B& b, Intersection_dim_d) { +intersection_impl(const A& a, const B& b, Dynamic_dimension_tag) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_d_object()(a, b); } template inline bool -do_intersect_impl(const A& a, const B& b, Intersection_dim_two) { +do_intersect_impl(const A& a, const B& b, CGAL::Dimension_tag<2>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_2_object()(a, b); } template inline bool -do_intersect_impl(const A& a, const B& b, Intersection_dim_three) { +do_intersect_impl(const A& a, const B& b, Dimension_tag<3>) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_3_object()(a, b); } template inline bool -do_intersect_impl(const A& a, const B& b, Intersection_dim_d) { +do_intersect_impl(const A& a, const B& b, Dynamic_dimension_tag) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().do_intersect_d_object()(a, b); } @@ -204,23 +203,20 @@ do_intersect_impl(const A& a, const B& b, Intersection_dim_d) { template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT< typename Kernel_traits::Kernel, A, B>::result_type -#endif intersection(const A& a, const B& b) { - typedef typename Kernel_traits::Kernel Kernel; - typedef IT Traits; - return internal::intersection_impl(a, b, typename Traits::Dim_tag()); + CGAL_static_assertion_msg( (boost::is_same::value), + "intersection with objects of different dimensions not supported"); + return internal::intersection_impl(a, b, typename A::Ambient_dimension()); } template -inline bool +inline +bool do_intersect(const A& a, const B& b) { - typedef typename Kernel_traits::Kernel Kernel; - typedef IT Traits; - return internal::do_intersect_impl(a, b, typename Traits::Dim_tag()); + CGAL_static_assertion_msg((boost::is_same::value), + "do_intersect with objects of different dimensions not supported"); + return internal::do_intersect_impl(a, b, typename A::Ambient_dimension()); } } // CGAL diff --git a/Intersections_2/include/CGAL/Intersection_traits_2.h b/Intersections_2/include/CGAL/Intersection_traits_2.h index 8a241d42c1e..f40bf50bd37 100644 --- a/Intersections_2/include/CGAL/Intersection_traits_2.h +++ b/Intersections_2/include/CGAL/Intersection_traits_2.h @@ -27,31 +27,34 @@ #include #include +#if !(CGAL_INTERSECTION_VERSION < 2) + namespace CGAL { -CGAL_INTERSECTION_TRAITS_2(Line_2, Line_2, Point_2, Line_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Line_2, Line_2, Point_2, Line_2) -CGAL_INTERSECTION_TRAITS_2(Segment_2, Line_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Line_2, Segment_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Segment_2, Line_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Line_2, Segment_2, Point_2, Segment_2) -CGAL_INTERSECTION_TRAITS_2(Segment_2, Segment_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Segment_2, Segment_2, Point_2, Segment_2) -CGAL_INTERSECTION_TRAITS_2(Ray_2, Line_2, Point_2, Ray_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Line_2, Ray_2, Point_2, Ray_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Ray_2, Line_2, Point_2, Ray_2) +CGAL_INTERSECTION_TRAITS_2(Line_2, Ray_2, Point_2, Ray_2) -CGAL_INTERSECTION_TRAITS_2(Ray_2, Segment_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Segment_2, Ray_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Ray_2, Segment_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Segment_2, Ray_2, Point_2, Segment_2) -CGAL_INTERSECTION_TRAITS_3(Ray_2, Ray_2, Point_2, Segment_2, Ray_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_3(Ray_2, Ray_2, Point_2, Segment_2, Ray_2) -CGAL_INTERSECTION_TRAITS_2(Triangle_2, Line_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Line_2, Triangle_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Triangle_2, Line_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Line_2, Triangle_2, Point_2, Segment_2) -CGAL_INTERSECTION_TRAITS_2(Triangle_2, Segment_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Segment_2, Triangle_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Triangle_2, Segment_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Segment_2, Triangle_2, Point_2, Segment_2) + +CGAL_INTERSECTION_TRAITS_2(Triangle_2, Ray_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Ray_2, Triangle_2, Point_2, Segment_2) -CGAL_INTERSECTION_TRAITS_2(Triangle_2, Ray_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Ray_2, Triangle_2, Point_2, Segment_2, Intersection_dim_two) template struct Intersection_traits { @@ -59,17 +62,16 @@ struct Intersection_traits { boost::variant< typename K::Point_2, typename K::Segment_2, typename K::Triangle_2, typename std::vector< typename K::Point_2 > > variant_type; typedef typename boost::optional< variant_type > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; -CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Line_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Line_2, Iso_rectangle_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Line_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Line_2, Iso_rectangle_2, Point_2, Segment_2) -CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Segment_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Segment_2, Iso_rectangle_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Segment_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Segment_2, Iso_rectangle_2, Point_2, Segment_2) -CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Ray_2, Point_2, Segment_2, Intersection_dim_two) -CGAL_INTERSECTION_TRAITS_2(Ray_2, Iso_rectangle_2, Point_2, Segment_2, Intersection_dim_two) +CGAL_INTERSECTION_TRAITS_2(Iso_rectangle_2, Ray_2, Point_2, Segment_2) +CGAL_INTERSECTION_TRAITS_2(Ray_2, Iso_rectangle_2, Point_2, Segment_2) // undocumented @@ -78,21 +80,18 @@ template struct Intersection_traits { typedef typename boost::variant variant_type; typedef boost::optional result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template struct Intersection_traits { typedef typename boost::variant variant_type; typedef boost::optional result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template struct Intersection_traits { typedef typename boost::variant variant_type; typedef boost::optional result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -102,7 +101,6 @@ struct Intersection_traits > variant_type; typedef typename boost::optional < variant_type > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -119,7 +117,6 @@ struct Intersection_traits typename std::pair< typename K::Circular_arc_point_2, unsigned int > > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; @@ -131,7 +128,6 @@ struct Intersection_traits > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -142,7 +138,6 @@ struct Intersection_traits typename std::pair< typename K::Circular_arc_point_2, unsigned int > > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -152,7 +147,6 @@ struct Intersection_traits boost::variant< typename std::pair< typename K::Circular_arc_point_2, unsigned int > > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -167,7 +161,6 @@ struct Intersection_traits > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -183,7 +176,6 @@ struct Intersection_traits typename std::pair< typename K::Circular_arc_point_2, unsigned int > > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -198,7 +190,6 @@ struct Intersection_traits boost::variant< typename std::pair< typename K::Circular_arc_point_2, unsigned int > > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -228,7 +219,6 @@ struct Intersection_traits boost::variant< typename std::pair< typename K::Circular_arc_point_2, unsigned int > > result_type; - typedef internal::Intersection_dim_two Dim_tag; }; template @@ -236,8 +226,9 @@ struct Intersection_traits : public Intersection_traits {}; - } // namespace CGAL +#endif + #endif /* CGAL_INTERSECTION_TRAITS_2_H */ diff --git a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h index d5ae633b1af..1106af18e4c 100644 --- a/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h +++ b/Intersections_2/include/CGAL/Intersections_2/Triangle_2_Triangle_2_intersection_impl.h @@ -318,12 +318,8 @@ Triangle_2_Triangle_2_pair::intersection_point() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Triangle_2 &tr1, const typename K::Triangle_2 &tr2, const K&) diff --git a/Intersections_2/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h index ba0864dac53..215e71fa0c7 100644 --- a/Intersections_2/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Iso_rectangle_2_Iso_rectangle_2_intersection.h @@ -33,12 +33,8 @@ namespace CGAL { namespace internal { template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection( const typename K::Iso_rectangle_2 &irect1, const typename K::Iso_rectangle_2 &irect2, diff --git a/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h index 9efeb3e1272..d11d63ddeb3 100644 --- a/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Line_2_Iso_rectangle_2_intersection.h @@ -184,12 +184,8 @@ intersection_segment() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Line_2 &line, const typename K::Iso_rectangle_2 &iso, const K&) @@ -209,12 +205,8 @@ intersection(const typename K::Line_2 &line, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Iso_rectangle_2 &iso, const typename K::Line_2 &line, const K& k) diff --git a/Intersections_2/include/CGAL/Line_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Line_2_intersection.h index df463363eb1..978ffa6633c 100644 --- a/Intersections_2/include/CGAL/Line_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Line_2_Line_2_intersection.h @@ -70,12 +70,8 @@ inline bool do_intersect( template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Line_2 &line1, const typename K::Line_2 &line2, const K&) diff --git a/Intersections_2/include/CGAL/Line_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Line_2_Triangle_2_intersection.h index 19401ecd757..fb8b9b4bff5 100644 --- a/Intersections_2/include/CGAL/Line_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Line_2_Triangle_2_intersection.h @@ -160,12 +160,8 @@ intersection_segment() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Line_2 &line, const typename K::Triangle_2 &tr, const K&) @@ -186,12 +182,8 @@ intersection(const typename K::Line_2 &line, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Triangle_2 &tr, const typename K::Line_2 &line, const K& k) diff --git a/Intersections_2/include/CGAL/Point_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Point_2_Iso_rectangle_2_intersection.h index 9ba422ae869..bf74b2205d6 100644 --- a/Intersections_2/include/CGAL/Point_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Point_2_Iso_rectangle_2_intersection.h @@ -54,12 +54,8 @@ do_intersect(const typename K::Iso_rectangle_2 &iso, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Point_2 &pt, const typename K::Iso_rectangle_2 &iso, const K& k) @@ -74,12 +70,8 @@ intersection(const typename K::Point_2 &pt, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Iso_rectangle_2 &iso, const typename K::Point_2 &pt, const K& k) diff --git a/Intersections_2/include/CGAL/Point_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Point_2_Line_2_intersection.h index a06dfcd89c4..20d3391b939 100644 --- a/Intersections_2/include/CGAL/Point_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Point_2_Line_2_intersection.h @@ -52,12 +52,8 @@ do_intersect(const typename K::Line_2 &line, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Point_2 &pt, const typename K::Line_2 &line, const K& k) @@ -69,12 +65,8 @@ intersection(const typename K::Point_2 &pt, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Line_2 &line, const typename K::Point_2 &pt, const K& k) diff --git a/Intersections_2/include/CGAL/Point_2_Point_2_intersection.h b/Intersections_2/include/CGAL/Point_2_Point_2_intersection.h index b289c7183e4..7c6b52b8eff 100644 --- a/Intersections_2/include/CGAL/Point_2_Point_2_intersection.h +++ b/Intersections_2/include/CGAL/Point_2_Point_2_intersection.h @@ -46,13 +46,10 @@ typename CGAL::Intersection_traits intersection(const typename K::Point_2 &pt1, const typename K::Point_2 &pt2) { - typedef typename CGAL::Intersection_traits - ::result_type result_type; - if (pt1 == pt2) { - return result_type(pt1); + return intersection_return(pt1); } - return result_type(); + return intersection_return(); } }// namespace internal diff --git a/Intersections_2/include/CGAL/Point_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Point_2_Ray_2_intersection.h index 89dd34ee300..c2387e320e5 100644 --- a/Intersections_2/include/CGAL/Point_2_Ray_2_intersection.h +++ b/Intersections_2/include/CGAL/Point_2_Ray_2_intersection.h @@ -56,12 +56,8 @@ do_intersect(const typename K::Ray_2 &ray, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Point_2 &pt, const typename K::Ray_2 &ray, const K& k) @@ -73,12 +69,8 @@ intersection(const typename K::Point_2 &pt, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Ray_2 &ray, const typename K::Point_2 &pt, const K& k) diff --git a/Intersections_2/include/CGAL/Point_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Point_2_Segment_2_intersection.h index 41da44a0a1d..92d760f8e68 100644 --- a/Intersections_2/include/CGAL/Point_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Point_2_Segment_2_intersection.h @@ -56,12 +56,8 @@ do_intersect(const typename K::Segment_2 &seg, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Point_2 &pt, const typename K::Segment_2 &seg, const K& k) @@ -74,12 +70,8 @@ intersection(const typename K::Point_2 &pt, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection( const typename K::Segment_2 &seg, const typename K::Point_2 &pt, const K& k) diff --git a/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h index aa495702b9d..551b8d15a04 100644 --- a/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Point_2_Triangle_2_intersection.h @@ -127,12 +127,8 @@ intersection_point() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits ::result_type -#endif intersection(const typename K::Point_2 &pt, const typename K::Triangle_2 &tr, const K&) @@ -150,12 +146,8 @@ intersection(const typename K::Point_2 &pt, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits ::result_type -#endif intersection(const typename K::Triangle_2 &tr, const typename K::Point_2 &pt, const K&k) diff --git a/Intersections_2/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h index af6c0bbe13e..6cc3d4ca59e 100644 --- a/Intersections_2/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Ray_2_Iso_rectangle_2_intersection.h @@ -79,12 +79,8 @@ inline bool do_intersect(const typename K::Iso_rectangle_2 &p2, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Ray_2 &ray, const typename K::Iso_rectangle_2 &iso, const K& ) @@ -103,12 +99,8 @@ intersection(const typename K::Ray_2 &ray, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Iso_rectangle_2 &iso, const typename K::Ray_2 &ray, const K& k) diff --git a/Intersections_2/include/CGAL/Ray_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Line_2_intersection.h index 99d19f56017..b725c949f76 100644 --- a/Intersections_2/include/CGAL/Ray_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Ray_2_Line_2_intersection.h @@ -71,12 +71,8 @@ inline bool do_intersect( template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits ::result_type -#endif intersection(const typename K::Ray_2 &ray, const typename K::Line_2 &line, const K&) @@ -97,12 +93,8 @@ intersection(const typename K::Ray_2 &ray, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits ::result_type -#endif intersection(const typename K::Line_2 &line, const typename K::Ray_2 &ray, const K& k) diff --git a/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h index 3d6314acdd4..a1264ca1bec 100644 --- a/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h +++ b/Intersections_2/include/CGAL/Ray_2_Ray_2_intersection.h @@ -233,12 +233,8 @@ Ray_2_Ray_2_pair::intersection_ray() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Ray_2 &ray1, const typename K::Ray_2 &ray2, const K&) diff --git a/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h index ae2421c3e31..72a9ed3994b 100644 --- a/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Ray_2_Segment_2_intersection.h @@ -236,12 +236,8 @@ Ray_2_Segment_2_pair::intersection_segment() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Ray_2 &ray, const typename K::Segment_2 &seg, const K&) @@ -261,12 +257,8 @@ intersection(const typename K::Ray_2 &ray, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Segment_2 &seg, const typename K::Ray_2 &ray, const K& k) diff --git a/Intersections_2/include/CGAL/Ray_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Ray_2_Triangle_2_intersection.h index 6ae685c5154..ca2f976f06e 100644 --- a/Intersections_2/include/CGAL/Ray_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Ray_2_Triangle_2_intersection.h @@ -142,12 +142,8 @@ intersection_segment() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Ray_2 &ray, const typename K::Triangle_2&tr, const K&) @@ -167,12 +163,8 @@ intersection(const typename K::Ray_2 &ray, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Triangle_2&tr, const typename K::Ray_2 &ray, const K& k) diff --git a/Intersections_2/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h index 97b8ea37f3d..5858983167c 100644 --- a/Intersections_2/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Segment_2_Iso_rectangle_2_intersection.h @@ -74,12 +74,8 @@ inline bool do_intersect( template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection( const typename K::Segment_2 &seg, const typename K::Iso_rectangle_2 &iso, @@ -100,12 +96,8 @@ intersection( template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Iso_rectangle_2 &iso, const typename K::Segment_2 &seg, const K& k) diff --git a/Intersections_2/include/CGAL/Segment_2_Line_2_intersection.h b/Intersections_2/include/CGAL/Segment_2_Line_2_intersection.h index b0070125eff..ad06e8223f6 100644 --- a/Intersections_2/include/CGAL/Segment_2_Line_2_intersection.h +++ b/Intersections_2/include/CGAL/Segment_2_Line_2_intersection.h @@ -69,12 +69,8 @@ inline bool do_intersect( } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Segment_2 &seg, const typename K::Line_2 &line, const K&) @@ -94,12 +90,8 @@ intersection(const typename K::Segment_2 &seg, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Line_2 &line, const typename K::Segment_2 &seg, const K& k) diff --git a/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h b/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h index 812d72f44ed..4d702d217a0 100644 --- a/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h +++ b/Intersections_2/include/CGAL/Segment_2_Segment_2_intersection.h @@ -431,12 +431,8 @@ Segment_2_Segment_2_pair::intersection_segment() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Segment_2 &seg1, const typename K::Segment_2 &seg2, const K&) diff --git a/Intersections_2/include/CGAL/Segment_2_Triangle_2_intersection.h b/Intersections_2/include/CGAL/Segment_2_Triangle_2_intersection.h index efc81c3ba90..e8fdb8795b2 100644 --- a/Intersections_2/include/CGAL/Segment_2_Triangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Segment_2_Triangle_2_intersection.h @@ -153,12 +153,8 @@ intersection_segment() const template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Segment_2 &seg, const typename K::Triangle_2&tr, const K&) @@ -178,12 +174,8 @@ intersection(const typename K::Segment_2 &seg, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits ::result_type -#endif intersection(const typename K::Triangle_2&tr, const typename K::Segment_2 &seg, const K& k) diff --git a/Intersections_2/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h b/Intersections_2/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h index 635b6bcd236..779e13c1bb8 100644 --- a/Intersections_2/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h +++ b/Intersections_2/include/CGAL/Triangle_2_Iso_rectangle_2_intersection.h @@ -34,11 +34,7 @@ namespace CGAL{ namespace internal { template - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else - typename Intersection_traits::result_type - #endif + typename Intersection_traits::result_type intersection(const Triangle_2 &t, const Iso_rectangle_2 &r, const R& rr) { typedef typename R::FT FT; @@ -152,18 +148,10 @@ namespace internal { if(position[next][j]) // if it's a second point direction { //test for intersection - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(Segment(p[index], p[next]), s[j], rr); if(v) { - #if CGAL_INTERSECTION_VERSION < 2 - if(const Point *p_obj = object_cast(v)) - #else - if(const Point *p_obj = boost::get(&*v)) - #endif + if(const Point *p_obj = intersect_get(v)) { //intersection found outside = true; @@ -180,18 +168,10 @@ namespace internal { if(position[index][j]) //watch only the first point directions { //test for intersection - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(Segment(p[index], p[next]), s[j], rr); if(v) { - #if CGAL_INTERSECTION_VERSION < 2 - if(const Point *p_obj = object_cast(v)) - #else - if(const Point *p_obj = boost::get(&*v)) - #endif + if(const Point *p_obj = intersect_get(v)) { //intersection found outside = false; @@ -224,19 +204,11 @@ namespace internal { if(position[next][j]) { //test for intersection - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits ::result_type - #endif v = internal::intersection(Segment(p[index], p[next]), s[j]); if(v) { - #if CGAL_INTERSECTION_VERSION < 3 - if(const Point *p_obj = object_cast(&*v)) - #else - if(const Point *p_obj = boost::get(&*v)) - #endif + if(const Point *p_obj = intersect_get(v)) //found the second intersection { outside = true; diff --git a/Intersections_3/include/CGAL/Intersection_traits_3.h b/Intersections_3/include/CGAL/Intersection_traits_3.h index 79dc98c1691..7c7a7a4b080 100644 --- a/Intersections_3/include/CGAL/Intersection_traits_3.h +++ b/Intersections_3/include/CGAL/Intersection_traits_3.h @@ -24,50 +24,52 @@ #include #include +#if !(CGAL_INTERSECTION_VERSION < 2) + namespace CGAL { -CGAL_INTERSECTION_TRAITS_2(Line_3, Line_3, Point_3, Line_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Line_3, Line_3, Point_3, Line_3) -CGAL_INTERSECTION_TRAITS_2(Line_3, Plane_3, Point_3, Line_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Plane_3, Line_3, Point_3, Line_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Line_3, Plane_3, Point_3, Line_3) +CGAL_INTERSECTION_TRAITS_2(Plane_3, Line_3, Point_3, Line_3) -CGAL_INTERSECTION_TRAITS_2(Line_3, Ray_3, Point_3, Ray_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Ray_3, Line_3, Point_3, Ray_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Line_3, Ray_3, Point_3, Ray_3) +CGAL_INTERSECTION_TRAITS_2(Ray_3, Line_3, Point_3, Ray_3) -CGAL_INTERSECTION_TRAITS_2(Line_3, Segment_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Segment_3, Line_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Line_3, Segment_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Segment_3, Line_3, Point_3, Segment_3) -CGAL_INTERSECTION_TRAITS_2(Line_3, Triangle_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Triangle_3, Line_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Line_3, Triangle_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Triangle_3, Line_3, Point_3, Segment_3) -CGAL_INTERSECTION_TRAITS_2(Plane_3, Plane_3, Line_3, Plane_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Plane_3, Plane_3, Line_3, Plane_3) -CGAL_INTERSECTION_TRAITS_2(Plane_3, Ray_3, Point_3, Ray_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Ray_3, Plane_3, Point_3, Ray_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Plane_3, Ray_3, Point_3, Ray_3) +CGAL_INTERSECTION_TRAITS_2(Ray_3, Plane_3, Point_3, Ray_3) -CGAL_INTERSECTION_TRAITS_2(Plane_3, Segment_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Segment_3, Plane_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Plane_3, Segment_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Segment_3, Plane_3, Point_3, Segment_3) -CGAL_INTERSECTION_TRAITS_2(Plane_3, Sphere_3, Point_3, Circle_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Sphere_3, Plane_3, Point_3, Circle_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Plane_3, Sphere_3, Point_3, Circle_3) +CGAL_INTERSECTION_TRAITS_2(Sphere_3, Plane_3, Point_3, Circle_3) -CGAL_INTERSECTION_TRAITS_3(Plane_3, Triangle_3, Point_3, Segment_3, Triangle_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_3(Triangle_3, Plane_3, Point_3, Segment_3, Triangle_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_3(Plane_3, Triangle_3, Point_3, Segment_3, Triangle_3) +CGAL_INTERSECTION_TRAITS_3(Triangle_3, Plane_3, Point_3, Segment_3, Triangle_3) -CGAL_INTERSECTION_TRAITS_3(Ray_3, Ray_3, Point_3, Ray_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_3(Ray_3, Ray_3, Point_3, Ray_3, Segment_3) -CGAL_INTERSECTION_TRAITS_2(Ray_3, Segment_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Segment_3, Ray_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Ray_3, Segment_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Segment_3, Ray_3, Point_3, Segment_3) -CGAL_INTERSECTION_TRAITS_2(Ray_3, Triangle_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Triangle_3, Ray_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Ray_3, Triangle_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Triangle_3, Ray_3, Point_3, Segment_3) -CGAL_INTERSECTION_TRAITS_2(Segment_3, Segment_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Segment_3, Segment_3, Point_3, Segment_3) -CGAL_INTERSECTION_TRAITS_2(Segment_3, Triangle_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Triangle_3, Segment_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Segment_3, Triangle_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Triangle_3, Segment_3, Point_3, Segment_3) -CGAL_INTERSECTION_TRAITS_3(Sphere_3, Sphere_3, Point_3, Circle_3, Sphere_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_3(Sphere_3, Sphere_3, Point_3, Circle_3, Sphere_3) template struct Intersection_traits { @@ -75,22 +77,21 @@ struct Intersection_traits { boost::variant< typename K::Point_3, typename K::Segment_3, typename K::Triangle_3, typename std::vector< typename K::Point_3 > > variant_type; typedef typename boost::optional< variant_type > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; // !!! undocumented !!! // Segment_3 Iso_cuboid_3 -CGAL_INTERSECTION_TRAITS_2(Segment_3, Iso_cuboid_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Iso_cuboid_3, Segment_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Segment_3, Iso_cuboid_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Iso_cuboid_3, Segment_3, Point_3, Segment_3) // Line_3 Iso_cuboid_3 -CGAL_INTERSECTION_TRAITS_2(Line_3, Iso_cuboid_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Iso_cuboid_3, Line_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Line_3, Iso_cuboid_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Iso_cuboid_3, Line_3, Point_3, Segment_3) // Ray_3 Iso_cuboid_3 -CGAL_INTERSECTION_TRAITS_2(Ray_3, Iso_cuboid_3, Point_3, Segment_3, Intersection_dim_three) -CGAL_INTERSECTION_TRAITS_2(Iso_cuboid_3, Ray_3, Point_3, Segment_3, Intersection_dim_three) +CGAL_INTERSECTION_TRAITS_2(Ray_3, Iso_cuboid_3, Point_3, Segment_3) +CGAL_INTERSECTION_TRAITS_2(Iso_cuboid_3, Ray_3, Point_3, Segment_3) // Iso_cuboid_3 Iso_cuboid_3, variant of one template @@ -98,7 +99,6 @@ struct Intersection_traits variant_type; typedef typename boost::optional< variant_type > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; // Intersections with BBox returns the same for Ray_3, Line_3 and Segment_3 @@ -108,7 +108,6 @@ struct Intersection_traits { typedef typename boost::variant< typename K::Segment_3, typename K::Point_3 > variant_type; typedef typename boost::optional< variant_type > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; template @@ -151,7 +150,6 @@ struct Intersection_traits { typedef typename boost::variant< std::pair< typename K::Circular_arc_point_3, unsigned int >, typename K::Circle_3 > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; template @@ -164,7 +162,6 @@ struct Intersection_traits { typedef typename boost::variant< std::pair< typename K::Circular_arc_point_3, unsigned int >, typename K::Circle_3 > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; template @@ -176,7 +173,6 @@ template struct Intersection_traits { typedef typename boost::variant< std::pair , typename K::Circle_3 > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; // Circle_3 Circle_3 @@ -184,7 +180,6 @@ template struct Intersection_traits { typedef typename boost::variant< std::pair > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; template @@ -198,7 +193,6 @@ struct Intersection_traits, typename K::Circular_arc_3 > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; // Circular_arc_3 Plane_3 @@ -207,7 +201,6 @@ struct Intersection_traits { typedef typename boost::variant< std::pair , typename K::Circular_arc_3 > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; template @@ -220,11 +213,12 @@ struct Intersection_traits { typedef typename boost::variant< std::pair , typename K::Line_arc_3 > result_type; - typedef internal::Intersection_dim_three Dim_tag; }; } // namespace +#endif // !(CGAL_INTERSECTION_VERSION < 2) + #endif /* CGAL_INTERSECTION_TRAITS_3_H */ diff --git a/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h b/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h index 855b4e22fa8..8d0f5026eda 100644 --- a/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h +++ b/Intersections_3/include/CGAL/Intersections_3/intersection_3_1_impl.h @@ -26,17 +26,14 @@ #include #include +#include namespace CGAL { namespace internal { template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Plane_3 &plane, const typename K::Line_3 &line, const K&) @@ -70,11 +67,7 @@ intersection(const typename K::Plane_3 &plane, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Line_3 &line, const typename K::Plane_3 &plane, const K& k) @@ -83,11 +76,7 @@ intersection(const typename K::Line_3 &line, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Plane_3 &plane1, const typename K::Plane_3 &plane2, const K&) @@ -159,10 +148,16 @@ intersection(const typename K::Plane_3 &plane1, const typename K::Plane_3 &plane3, const K& k) { - typedef typename boost::optional< + typedef + #if CGAL_INTERSECTION_VERSION < 2 + CGAL::Object + #else + typename boost::optional< boost::variant > result_type; + typename K::Plane_3> > + #endif + result_type; typedef typename K::Point_3 Point_3; @@ -171,61 +166,45 @@ intersection(const typename K::Plane_3 &plane1, // Intersection between plane1 and plane2 can either be // a line, a plane, or empty. - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif o12 = internal::intersection(plane1, plane2, k); if(o12) { if(const Line_3* l = intersect_get(o12)) { // either point or line - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(plane3, *l, k); if(v) { - // don't use intersect get, we don't have traits and can't - // use intersect_return. - #if CGAL_INTERSECTION_VERSION < 2 - if(const Point_3* p = object_cast(&v)) + if(const Point_3* p = intersect_get(v)) + #if CGAL_INTERSECTION_VERSION < 2 return make_object(*p); - else if(const Line_3* l = object_cast(&v)) - return make_object(*l); - #else - if(const Point_3* p = boost::get(&*v)) + #else return result_type(*p); - else if(const Line_3* l = boost::get(&*v)) + #endif + else if(const Line_3* l = intersect_get(v)) + #if CGAL_INTERSECTION_VERSION < 2 + return make_object(*l); + #else return result_type(*l); - #endif + #endif } - #if CGAL_INTERSECTION_VERSION < 2 - } else if(const Plane_3 *pl = object_cast(&o12)) { - #else - } else if(const Plane_3 *pl = boost::get(&(*o12))) { - #endif + } else if(const Plane_3 *pl = intersect_get(o12)) { // either line or plane - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(plane3, *pl, k); if(v) { - #if CGAL_INTERSECTION_VERSION < 2 - if(const Plane_3* p = object_cast(&v)) + if(const Plane_3* p = intersect_get(v)) + #if CGAL_INTERSECTION_VERSION < 2 return make_object(*p); - else if(const Line_3* l = object_cast(&v)) - return make_object(*l); - #else - if(const Plane_3* p = boost::get(&*v)) + #else return result_type(*p); - else if(const Line_3* l = boost::get(&*v)) + #endif + else if(const Line_3* l = intersect_get(v)) + #if CGAL_INTERSECTION_VERSION < 2 + return make_object(*l); + #else return result_type(*l); - #endif + #endif } } } @@ -276,11 +255,7 @@ do_intersect(const typename K::Line_3 &line, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Line_3 &l1, const typename K::Line_3 &l2, const K&) @@ -338,11 +313,7 @@ do_intersect(const typename K::Line_3 &l1, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection_collinear_segments(const typename K::Segment_3 &s1, const typename K::Segment_3 &s2, const K& k) @@ -381,13 +352,9 @@ intersection_collinear_segments(const typename K::Segment_3 &s1, template struct L_p_visitor : public boost::static_visitor< -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif -> + typename K::Segment_3>::result_type + > { typedef typename Intersection_traits(p); else - return result_type(); + return intersection_return(); } - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else result_type - #endif operator()(const typename K::Line_3&) const { return intersection_collinear_segments(s1,s2,K()); } }; template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Segment_3 &s1, const typename K::Segment_3 &s2, const K&) { CGAL_precondition(! s1.is_degenerate () && ! s2.is_degenerate () ); - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(s1.supporting_line(),s2.supporting_line(), K()); if(v) { @@ -488,22 +439,14 @@ do_intersect(const typename K::Segment_3 &s1, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Line_3 &l, const typename K::Segment_3 &s, const K& k) { CGAL_precondition(! l.is_degenerate () && ! s.is_degenerate () ); - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(l,s.supporting_line(), K()); if(v) { @@ -520,11 +463,7 @@ intersection(const typename K::Line_3 &l, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Segment_3 &s, const typename K::Line_3 &l, const K& k) @@ -584,22 +523,14 @@ Ray_3_has_on_collinear_Point_3( } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Line_3 &l, const typename K::Ray_3 &r, const K& k) { CGAL_precondition(! l.is_degenerate () && ! r.is_degenerate () ); - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(l,r.supporting_line(), k); if(v) { @@ -614,11 +545,7 @@ intersection(const typename K::Line_3 &l, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Ray_3 &r, const typename K::Line_3 &l, const K& k) @@ -655,22 +582,14 @@ do_intersect(const typename K::Ray_3 &r, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Segment_3 &s, const typename K::Ray_3 &r, const K& k) { CGAL_precondition(! s.is_degenerate () && ! r.is_degenerate () ); - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(r.supporting_line(),s, K()); if(v) { @@ -708,11 +627,7 @@ intersection(const typename K::Segment_3 &s, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Ray_3 &r, const typename K::Segment_3 &s, const K& k) @@ -755,22 +670,14 @@ do_intersect(const typename K::Ray_3 &r, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Ray_3 &r1, const typename K::Ray_3 &r2, const K& k) { CGAL_precondition(! r1.is_degenerate () && ! r2.is_degenerate () ); - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(r1.supporting_line(),r2, k); if(v) { @@ -829,11 +736,7 @@ do_intersect(const typename K::Ray_3 &r1, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Plane_3 &p, const typename K::Sphere_3 &s, const K&) @@ -889,11 +792,7 @@ do_intersect(const typename K::Sphere_3 &s, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Sphere_3 &s, const typename K::Plane_3 &p, const K& k) @@ -903,11 +802,7 @@ intersection(const typename K::Sphere_3 &s, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Sphere_3 &s1, const typename K::Sphere_3 &s2, const K& k) @@ -923,11 +818,7 @@ intersection(const typename K::Sphere_3 &s1, Plane_3 p = K().construct_radical_plane_3_object()(s1,s2); - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = intersection(p, s1, k); @@ -958,22 +849,14 @@ do_intersect(const typename K::Sphere_3 &s1, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Plane_3 &plane, const typename K::Ray_3 &ray, const K& k) { typedef typename K::Point_3 Point_3; - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(plane, ray.supporting_line(), k); if(v) { @@ -993,11 +876,7 @@ intersection(const typename K::Plane_3 &plane, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Ray_3 &ray, const typename K::Plane_3 &plane, const K& k) @@ -1015,12 +894,8 @@ do_intersect(const typename K::Plane_3 &plane, { typedef typename K::Point_3 Point_3; - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits ::result_type - #endif line_intersection = internal::intersection(plane, ray.supporting_line(), k); if(!line_intersection) @@ -1044,11 +919,7 @@ do_intersect(const typename K::Ray_3 &ray, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Plane_3 &plane, const typename K::Segment_3 &seg, const K& k) @@ -1076,11 +947,7 @@ intersection(const typename K::Plane_3 &plane, { // intersection object should be a point, but rounding errors // could lead to a line. In such case, return seg. - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(plane, seg.supporting_line(), k); if(v) { if(const typename K::Point_3* p = intersect_get(v)) @@ -1098,11 +965,7 @@ intersection(const typename K::Plane_3 &plane, { // intersection object should be a point, but rounding errors // could lead to a line. In such case, return seg. - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(plane, seg.supporting_line(), k); if(v) { if(const typename K::Point_3* p = intersect_get(v)) @@ -1122,11 +985,7 @@ intersection(const typename K::Plane_3 &plane, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Segment_3 &seg, const typename K::Plane_3 &plane, const K& k) @@ -1168,21 +1027,13 @@ do_intersect(const typename K::Segment_3 &seg, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Plane_3 &plane, const typename K::Triangle_3 &tri, const K& k) { typedef - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif pl_res; typename K::Construct_vertex_3 vertex_on = @@ -1277,11 +1128,7 @@ intersection(const typename K::Plane_3 &plane, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Triangle_3 &triangle, const typename K::Plane_3 &plane, const K& k) @@ -1290,11 +1137,7 @@ intersection(const typename K::Triangle_3 &triangle, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Line_3 &line, const Bbox_3 &box, const K&) @@ -1317,11 +1160,7 @@ intersection(const typename K::Line_3 &line, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const Bbox_3 &box, const typename K::Line_3 &line, const K& k) @@ -1331,11 +1170,7 @@ intersection(const Bbox_3 &box, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Ray_3 &ray, const Bbox_3 &box, const K&) @@ -1358,11 +1193,7 @@ intersection(const typename K::Ray_3 &ray, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const Bbox_3 &box, const typename K::Ray_3 &ray, const K& k) @@ -1373,11 +1204,7 @@ intersection(const Bbox_3 &box, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Segment_3 &seg, const Bbox_3 &box, const K&) @@ -1400,11 +1227,7 @@ intersection(const typename K::Segment_3 &seg, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const Bbox_3 &box, const typename K::Segment_3 &seg, const K& k) @@ -1414,11 +1237,7 @@ intersection(const Bbox_3 &box, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Line_3 &line, const typename K::Iso_cuboid_3 &box, const K&) @@ -1481,11 +1300,7 @@ intersection(const typename K::Line_3 &line, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Iso_cuboid_3 &box, const typename K::Line_3 &line, const K& k) @@ -1496,11 +1311,7 @@ intersection(const typename K::Iso_cuboid_3 &box, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Ray_3 &ray, const typename K::Iso_cuboid_3 &box, const K&) @@ -1562,11 +1373,7 @@ intersection(const typename K::Ray_3 &ray, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Iso_cuboid_3 &box, const typename K::Ray_3 &ray, const K& k) @@ -1576,11 +1383,7 @@ intersection(const typename K::Iso_cuboid_3 &box, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Segment_3 &seg, const typename K::Iso_cuboid_3 &box, const K&) @@ -1642,11 +1445,7 @@ intersection(const typename K::Segment_3 &seg, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Iso_cuboid_3 &box, const typename K::Segment_3 &seg, const K& k) @@ -1656,11 +1455,7 @@ intersection(const typename K::Iso_cuboid_3 &box, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection( const typename K::Iso_cuboid_3 &icub1, const typename K::Iso_cuboid_3 &icub2, diff --git a/Intersections_3/include/CGAL/Triangle_3_Triangle_3_intersection.h b/Intersections_3/include/CGAL/Triangle_3_Triangle_3_intersection.h index f0dfba3bed6..3d96fc2eaa4 100644 --- a/Intersections_3/include/CGAL/Triangle_3_Triangle_3_intersection.h +++ b/Intersections_3/include/CGAL/Triangle_3_Triangle_3_intersection.h @@ -61,13 +61,9 @@ void intersection_coplanar_triangles_cutoff( Orientation or_prev=orientations[prev],or_curr=orientations[&curr]; if ( (or_prev==POSITIVE && or_curr==NEGATIVE) || (or_prev==NEGATIVE && or_curr==POSITIVE) ) { - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits ::result_type - #endif obj = intersection(Line_3(p,q),Line_3(*prev,curr),k); // assert "not empty" CGAL_kernel_assertion(obj); @@ -92,11 +88,7 @@ void intersection_coplanar_triangles_cutoff( } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection_coplanar_triangles( const typename K::Triangle_3& t1, const typename K::Triangle_3& t2, @@ -133,12 +125,8 @@ intersection_coplanar_triangles( template struct Triangle_Line_visitor { - #if CGAL_INTERSECTION_VERSION < 2 - typedef CGAL::Object result_type; - #else typedef typename Intersection_traits ::result_type result_type; - #endif result_type operator()(const typename K::Point_3& p, const typename K::Segment_3&) const { @@ -157,11 +145,7 @@ struct Triangle_Line_visitor { result_type operator()(const typename K::Segment_3& s1, const typename K::Segment_3& s2) const { - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = intersection_collinear_segments(s1,s2,K()); if(v) { @@ -176,11 +160,7 @@ struct Triangle_Line_visitor { }; template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection( const typename K::Triangle_3& t1, const typename K::Triangle_3& t2, @@ -188,11 +168,7 @@ intersection( { CGAL_precondition(!t1.is_degenerate() && !t2.is_degenerate()); - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(t1.supporting_plane(), t2.supporting_plane(), k); if(!v) { @@ -208,11 +184,7 @@ intersection( if(const typename K::Line_3* line=intersect_get(v)) { //The supporting planes of the triangles intersect along a line. typedef - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif Triangle_Line_Inter; Triangle_Line_Inter inter1 = intersection_coplanar(t1,*line,k); @@ -226,15 +198,15 @@ intersection( Triangle_Line_visitor vis; if(const typename K::Point_3* p1 = intersect_get(inter1)) { if(const typename K::Point_3* p2 = intersect_get(inter2)) { - vis(*p1, *p2); + return vis(*p1, *p2); } else if(const typename K::Segment_3* s2 = intersect_get(inter2)) { - vis(*p1, *s2); + return vis(*p1, *s2); } } else if(const typename K::Segment_3* s1 = intersect_get(inter1)) { if(const typename K::Point_3* p2 = intersect_get(inter2)) { - vis(*s1, *p2); + return vis(*s1, *p2); } else if(const typename K::Segment_3* s2 = intersect_get(inter2)) { - vis(*s1, *s2); + return vis(*s1, *s2); } } #else diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h index bda9ea03902..e42a18d8159 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Line_3_intersection.h @@ -109,11 +109,7 @@ t3l3_intersection_coplanar_aux(const typename K::Point_3& a, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection_coplanar(const typename K::Triangle_3 &t, const typename K::Line_3 &l, const K & k ) @@ -314,11 +310,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits::result_type -#endif t3l3_intersection_aux(const typename K::Triangle_3 &t, const typename K::Line_3 &l, const K&) @@ -327,11 +319,7 @@ t3l3_intersection_aux(const typename K::Triangle_3 &t, // k.intersect_3_object(); // The intersection between a Line and Plane is either Point or Line - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(l,t.supporting_plane(), K()); // Intersection should be a point (because of orientation test done before) @@ -348,11 +336,7 @@ t3l3_intersection_aux(const typename K::Triangle_3 &t, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits::result_type -#endif intersection(const typename K::Triangle_3 &t, const typename K::Line_3 &l, const K& k) @@ -428,11 +412,7 @@ intersection(const typename K::Triangle_3 &t, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename CGAL::Intersection_traits::result_type -#endif intersection(const typename K::Line_3 &l, const typename K::Triangle_3 &t, const K& k) diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h index 903066b0586..81979f0f833 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Ray_3_intersection.h @@ -70,14 +70,8 @@ t3r3_intersection_coplanar_aux(const typename K::Point_3& p, } -// the return type is the same as the intersection(Triangle Ray). We -// spell it out here for clarity. template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else -typename boost::optional< boost::variant< typename K::Point_3, typename K::Segment_3> > -#endif +typename IT::result_type t3r3_intersection_coplanar_aux(const typename K::Point_3& a, const typename K::Point_3& b, const typename K::Point_3& c, @@ -167,14 +161,8 @@ t3r3_intersection_coplanar_aux(const typename K::Point_3& a, return intersection_return(); } -// the return type is the same as the intersection(Triangle Ray). We -// spell it out here for clarity. template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else -typename boost::optional< boost::variant< typename K::Point_3, typename K::Segment_3> > -#endif +typename IT::result_type intersection_coplanar(const typename K::Triangle_3 &t, const typename K::Ray_3 &r, const K & k ) @@ -441,12 +429,8 @@ t3r3_intersection_aux(const typename K::Triangle_3 &t, const typename K::Ray_3 &r, const K& k) { - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits ::result_type - #endif v = internal::intersection(r.supporting_line(),t.supporting_plane(), k); if(v) { @@ -458,12 +442,8 @@ t3r3_intersection_aux(const typename K::Triangle_3 &t, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Triangle_3 &t, const typename K::Ray_3 &r, const K& k) @@ -604,11 +584,7 @@ intersection(const typename K::Triangle_3 &t, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Ray_3 &r, const typename K::Triangle_3 &t, const K& k) { diff --git a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h index fd2264faeee..e0e480f4341 100644 --- a/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h +++ b/Intersections_3/include/CGAL/internal/Intersections_3/Triangle_3_Segment_3_intersection.h @@ -72,11 +72,7 @@ t3s3_intersection_coplanar_aux(const typename K::Point_3& p, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif t3s3_intersection_coplanar_aux(const typename K::Point_3& a, const typename K::Point_3& b, const typename K::Point_3& c, @@ -142,11 +138,7 @@ t3s3_intersection_coplanar_aux(const typename K::Point_3& a, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif t3s3_intersection_collinear_aux(const typename K::Point_3& a, const typename K::Point_3& b, const typename K::Point_3& p, @@ -188,11 +180,7 @@ t3s3_intersection_collinear_aux(const typename K::Point_3& a, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection_coplanar(const typename K::Triangle_3 &t, const typename K::Segment_3 &s, const K & k ) @@ -406,11 +394,7 @@ intersection_coplanar(const typename K::Triangle_3 &t, template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Triangle_3 &t, const typename K::Segment_3 &s, const K & k) @@ -457,12 +441,8 @@ intersection(const typename K::Triangle_3 &t, { // The intersection should be a point - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits ::result_type - #endif v = internal::intersection(s.supporting_line(),t.supporting_plane(), K()); if(v) { if(const Point_3* res = intersect_get(v)) @@ -498,11 +478,7 @@ intersection(const typename K::Triangle_3 &t, && orientation(q,p,b,c) != POSITIVE && orientation(q,p,c,a) != POSITIVE ) { - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename Intersection_traits::result_type - #endif v = internal::intersection(s.supporting_line(),t.supporting_plane(), K()); if(v) { if(const Point_3* res = intersect_get(v)) @@ -571,12 +547,8 @@ intersection(const typename K::Triangle_3 &t, template inline -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename Intersection_traits::result_type -#endif intersection(const typename K::Segment_3 &s, const typename K::Triangle_3 &t, const K & k) diff --git a/Intersections_3/include/CGAL/intersection_3_0.h b/Intersections_3/include/CGAL/intersection_3_0.h index 2f9cde4b92c..1f361a98be0 100644 --- a/Intersections_3/include/CGAL/intersection_3_0.h +++ b/Intersections_3/include/CGAL/intersection_3_0.h @@ -44,11 +44,7 @@ namespace CGAL { // intersections with Bbox_3 for which no kernel traits exist template inline - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename IT< typename CGAL::Kernel_traits::Kernel, A, CGAL::Bbox_3 >::result_type - #endif intersection(const A& a, const CGAL::Bbox_3& b) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_3_object()(a, b); @@ -56,11 +52,7 @@ namespace CGAL { template inline - #if CGAL_INTERSECTION_VERSION < 2 - CGAL::Object - #else typename IT< typename CGAL::Kernel_traits::Kernel, A, CGAL::Bbox_3 >::result_type - #endif intersection(const CGAL::Bbox_3& b, const A& a) { typedef typename CGAL::Kernel_traits::Kernel Kernel; return Kernel().intersect_3_object()(a, b); diff --git a/Kernel_d/include/CGAL/Intersection_traits_d.h b/Kernel_d/include/CGAL/Intersection_traits_d.h index 0c4e9cc9e35..b5806b67775 100644 --- a/Kernel_d/include/CGAL/Intersection_traits_d.h +++ b/Kernel_d/include/CGAL/Intersection_traits_d.h @@ -23,31 +23,35 @@ #include +#if !(CGAL_INTERSECTION_VERSION < 2) + namespace CGAL { - CGAL_INTERSECTION_TRAITS_2(Line_d, Line_d, Point_d, Line_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Line_d, Line_d, Point_d, Line_d) - CGAL_INTERSECTION_TRAITS_2(Segment_d, Line_d, Point_d, Segment_d, Intersection_dim_d) - CGAL_INTERSECTION_TRAITS_2(Line_d, Segment_d, Point_d, Segment_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Segment_d, Line_d, Point_d, Segment_d) + CGAL_INTERSECTION_TRAITS_2(Line_d, Segment_d, Point_d, Segment_d) - CGAL_INTERSECTION_TRAITS_2(Segment_d, Segment_d, Point_d, Segment_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Segment_d, Segment_d, Point_d, Segment_d) - CGAL_INTERSECTION_TRAITS_2(Ray_d, Line_d, Point_d, Ray_d, Intersection_dim_d) - CGAL_INTERSECTION_TRAITS_2(Line_d, Ray_d, Point_d, Ray_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Ray_d, Line_d, Point_d, Ray_d) + CGAL_INTERSECTION_TRAITS_2(Line_d, Ray_d, Point_d, Ray_d) - CGAL_INTERSECTION_TRAITS_2(Ray_d, Segment_d, Point_d, Segment_d, Intersection_dim_d) - CGAL_INTERSECTION_TRAITS_2(Segment_d, Ray_d, Point_d, Segment_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Ray_d, Segment_d, Point_d, Segment_d) + CGAL_INTERSECTION_TRAITS_2(Segment_d, Ray_d, Point_d, Segment_d) - CGAL_INTERSECTION_TRAITS_3(Ray_d, Ray_d, Point_d, Segment_d, Ray_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_3(Ray_d, Ray_d, Point_d, Segment_d, Ray_d) - CGAL_INTERSECTION_TRAITS_2(Hyperplane_d, Line_d, Point_d, Line_d, Intersection_dim_d) - CGAL_INTERSECTION_TRAITS_2(Line_d, Hyperplane_d, Point_d, Line_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Hyperplane_d, Line_d, Point_d, Line_d) + CGAL_INTERSECTION_TRAITS_2(Line_d, Hyperplane_d, Point_d, Line_d) - CGAL_INTERSECTION_TRAITS_2(Hyperplane_d, Ray_d, Point_d, Ray_d, Intersection_dim_d) - CGAL_INTERSECTION_TRAITS_2(Ray_d, Hyperplane_d, Point_d, Ray_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Hyperplane_d, Ray_d, Point_d, Ray_d) + CGAL_INTERSECTION_TRAITS_2(Ray_d, Hyperplane_d, Point_d, Ray_d) - CGAL_INTERSECTION_TRAITS_2(Hyperplane_d, Segment_d, Point_d, Segment_d, Intersection_dim_d) - CGAL_INTERSECTION_TRAITS_2(Segment_d, Hyperplane_d, Point_d, Segment_d, Intersection_dim_d) + CGAL_INTERSECTION_TRAITS_2(Hyperplane_d, Segment_d, Point_d, Segment_d) + CGAL_INTERSECTION_TRAITS_2(Segment_d, Hyperplane_d, Point_d, Segment_d) } +#endif // !(CGAL_INTERSECTION_VERSION < 2) + #endif /* CGAL_INTERSECTION_TRAITS_D_H */ diff --git a/Kernel_d/include/CGAL/intersections_d.h b/Kernel_d/include/CGAL/intersections_d.h index 2ee3ef23d8e..81e6e80261e 100644 --- a/Kernel_d/include/CGAL/intersections_d.h +++ b/Kernel_d/include/CGAL/intersections_d.h @@ -34,11 +34,7 @@ namespace CGAL { namespace internal { template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R&) { typedef typename R::Line_d_Line_d_pair ll_pair; @@ -59,11 +55,7 @@ intersection(const typename R::Line_d& l1, const typename R::Line_d& l2, const R } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&) { typedef typename R::Ray_d_Ray_d_pair ll_pair; @@ -92,11 +84,7 @@ intersection(const typename R::Ray_d& l1, const typename R::Ray_d& l2, const R&) } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, const R&) { typedef typename R::Segment_d_Segment_d_pair ll_pair; @@ -120,11 +108,7 @@ intersection(const typename R::Segment_d& l1, const typename R::Segment_d& l2, c } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&) { typedef typename R::Line_d_Ray_d_pair lr_pair; @@ -146,20 +130,12 @@ intersection(const typename R::Line_d& l, const typename R::Ray_d& r, const R&) } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Ray_d& r, const typename R::Line_d& l, const R& k) { return intersection(l,r,k); } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R&) { typedef typename R::Ray_d_Segment_d_pair rs_pair; @@ -183,20 +159,12 @@ intersection(const typename R::Ray_d& r, const typename R::Segment_d& s, const R } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Segment_d& s, const typename R::Ray_d& r, const R& k) { return intersection(r,s, k); } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const R&) { typedef typename R::Line_d_Segment_d_pair rs_pair; @@ -220,20 +188,12 @@ intersection(const typename R::Line_d& l, const typename R::Segment_d& s, const } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Segment_d& s, const typename R::Line_d& l, const R& r) { return intersection(l,s,r); } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, const R&) { typedef typename R::Line_d_Hyperplane_d_pair lh_pair; @@ -254,20 +214,12 @@ intersection(const typename R::Line_d& l, const typename R::Hyperplane_d& h, con } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Hyperplane_d& h, const typename R::Line_d& l, const R& r) { return intersection(l,h,r); } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, const R&) { typedef typename R::Ray_d_Hyperplane_d_pair rh_pair; @@ -288,20 +240,12 @@ intersection(const typename R::Ray_d& r, const typename R::Hyperplane_d& h, cons } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Hyperplane_d& h, const typename R::Ray_d& r, const R& k) { return intersection(r,h,k); } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, const R&) { typedef typename R::Segment_d_Hyperplane_d_pair sh_pair; @@ -322,11 +266,7 @@ intersection(const typename R::Segment_d& s, const typename R::Hyperplane_d& h, } template -#if CGAL_INTERSECTION_VERSION < 2 -CGAL::Object -#else typename IT::result_type -#endif intersection(const typename R::Hyperplane_d& h, const typename R::Segment_d& s, const R& r) { return intersection(s,h,r); }