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 0acf0d44641..ece63dfdc56 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 @@ -184,7 +184,7 @@ namespace internal { // the circles intersect const std::pair* - result = boost::get< std::pair >(&(*it)); + result = CGAL::internal::intersect_get< std::pair >(*it); if ( result->second == 2 ){ // double solution _begin = result->first; _end = result->first; @@ -195,7 +195,7 @@ namespace internal { _end = result->first; if (!(b_1 && b_2)) { ++it; - result = boost::get< std::pair >(&(*it)); + result = CGAL::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 d7d4d7a76f2..3be99c49091 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 @@ -86,13 +86,13 @@ public: // the circles intersect const std::pair* - result = boost::get >(&(*it)); + result = CGAL::internal::intersect_get >(*it); // get must have succeeded if ( result->second == 2 ) // double solution return result->first; if (b) return result->first; ++it; - result = boost::get >(&(*it)); + result = CGAL::internal::intersect_get >(*it); return result->first; } @@ -133,11 +133,11 @@ public: v = CGAL::internal::intersection(support, l1, CK()); CGAL_assertion(v); - const Point_2 *pt = boost::get(&*v); + const Point_2 *pt = CGAL::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 = boost::get(&*v); + const Point_2 *pt2 = CGAL::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 58dfcc1be55..9933149fe90 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 @@ -29,6 +29,7 @@ #include #include #include +#include namespace CGAL { namespace CircularFunctors { @@ -519,6 +520,10 @@ namespace CircularFunctors { using CK::Linear_kernel::Intersect_2::operator(); + #if CGAL_INTERSECTION_VERSION < 2 + typedef typename CK::Linear_kernel::Intersect_2::result_type result_type; + #endif + template < class OutputIterator > OutputIterator operator()(const Line & c1, const Circle & c2, 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 d3df7a33d5e..c61942f4994 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 @@ -46,7 +46,7 @@ circle_intersect( const typename CK::Circle_2 & c1, // the circles intersect const std::pair* - result = boost::get > (&(*it)); + result = internal::intersect_get > (*it); if ( result->second == 2 ) // double solution return result->first; @@ -55,7 +55,7 @@ circle_intersect( const typename CK::Circle_2 & c1, return result->first; ++it; - result = boost::get > (&(*it)); + result = internal::intersect_get > (*it); return result->first; } @@ -132,7 +132,7 @@ namespace CircularFunctors { Equation e2 = CircularFunctors::get_equation(c2); if (e1 == e2) { - *res++ = result_type(e1); + *res++ = CGAL::internal::intersection_return(e1); return res; } @@ -148,8 +148,9 @@ namespace CircularFunctors { for ( typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it ) { - *res++ = result_type(std::make_pair(Circular_arc_point_2(it->first), - it->second )); + *res++ = CGAL::internal::intersection_return + (std::make_pair(Circular_arc_point_2(it->first), + it->second )); } return res; diff --git a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h index 8870162d4d5..bedbd384f29 100644 --- a/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h +++ b/Circular_kernel_2/include/CGAL/Circular_kernel_2/internal_functions_on_circular_arc_2.h @@ -642,11 +642,13 @@ namespace CircularFunctors { if(sqr1_eq_sqr2 && c1_eq_c2) { if(a1.is_full()) { - *res++ = result_type(a2); + *res++ =CGAL::internal::intersection_return(a2); //return res; } else if(a2.is_full()) { - *res++ = result_type(a1); + *res++ =CGAL::internal::intersection_return(a1); //return res; } else { bool t2_in_a1 = has_on(a1,a2.target(),true); @@ -659,60 +661,75 @@ namespace CircularFunctors { CircularFunctors::compare_xy(a1.source(), a2.source()); if(comp < 0) { if(a1.source() == a2.target()) { - *res++ = result_type(std::make_pair(a1.source(),1u)); + *res++ =CGAL::internal::intersection_return(std::make_pair(a1.source(),1u)); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = result_type(arc); + *res++ =CGAL::internal::intersection_return(arc); } if(a2.source() == a1.target()) { - *res++ = result_type(std::make_pair(a2.source(),1u)); + *res++ =CGAL::internal::intersection_return(std::make_pair(a2.source(),1u)); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = result_type(arc); + *res++ =CGAL::internal::intersection_return(arc); } } else if (comp > 0) { if(a2.source() == a1.target()) { - *res++ = result_type(std::make_pair(a2.source(),1u)); + *res++ =CGAL::internal::intersection_return(std::make_pair(a2.source(),1u)); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = result_type(arc); + *res++ =CGAL::internal::intersection_return(arc); } if(a1.source() == a2.target()) { - *res++ = result_type(std::make_pair(a1.source(),1u)); + *res++ =CGAL::internal::intersection_return(std::make_pair(a1.source(),1u)); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = result_type(arc); + *res++ =CGAL::internal::intersection_return(arc); } } else { - *res++ = result_type(a1); + *res++ =CGAL::internal::intersection_return(a1); } } else { - *res++ = result_type(a2); + *res++ =CGAL::internal::intersection_return(a2); //return res; } } else if(t2_in_a1) { if(a1.source() == a2.target()) - *res++ = result_type(std::make_pair(a1.source(),1u)); + *res++ =CGAL::internal::intersection_return(std::make_pair(a1.source(),1u)); else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = result_type(arc); + *res++ =CGAL::internal::intersection_return(arc); } //return res; } else if(s2_in_a1) { if(a2.source() == a1.target()) { - *res++ = result_type(std::make_pair(a2.source(),1u)); + *res++ =CGAL::internal::intersection_return(std::make_pair(a2.source(),1u)); } else { const Circular_arc_2 & arc = Circular_arc_2(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = result_type(arc); + *res++ =CGAL::internal::intersection_return(arc); } //return res; } else if(has_on(a2,a1.source(),true)) { - *res++ = result_type(a1); + *res++ =CGAL::internal::intersection_return(a1); //return res; } //return res; @@ -750,13 +767,15 @@ namespace CircularFunctors { if(do_overlap(a1.bbox(), rb) && do_overlap(a2.bbox(),rb)){ if (has_on(a1,result->first,true) && has_on(a2,result->first,true)) { - *res++ = result_type(*result); + *res++ =CGAL::internal::intersection_return(*result); } } #else if (has_on(a1,result->first,true) && has_on(a2,result->first,true)) { - *res++ = result_type(*result); + *res++ =CGAL::internal::intersection_return(*result); } #endif } 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 06eca0c6e57..63189622241 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 @@ -403,7 +403,7 @@ namespace CircularFunctors { for ( typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it ) { - *res++ = result_type + *res++ = CGAL::internal::intersection_return (std::make_pair(Circular_arc_point_2(it->first), it->second )); } @@ -437,8 +437,8 @@ namespace CircularFunctors { } if(a1s_a2s || a1s_a2t || a1t_a2s || a1t_a2t) { if(! LinearFunctors::non_oriented_equal(a1.supporting_line(),a2.supporting_line())){ - if(a1s_a2s || a1s_a2t) *res++ = result_type(std::make_pair(a1.source(), 1u)); - if(a1t_a2s || a1t_a2t) *res++ = result_type(std::make_pair(a1.target(), 1u)); + if(a1s_a2s || a1s_a2t) *res++ = CGAL::internal::intersection_return(std::make_pair(a1.source(), 1u)); + if(a1t_a2s || a1t_a2t) *res++ = CGAL::internal::intersection_return(std::make_pair(a1.target(), 1u)); return res; } } @@ -450,15 +450,15 @@ namespace CircularFunctors { int comparison = compare_xy(a2.left(),a1.right()); if(comparison < 0){ if(compare_xy(a1.right(),a2.right()) <= 0){ - *res++ = result_type + *res++ = CGAL::internal::intersection_return (Line_arc_2(a1.supporting_line(), a2.left(), a1.right() )); } else{ - *res++ = result_type + *res++ = CGAL::internal::intersection_return (Line_arc_2(a1.supporting_line(), a2.left(), a2.right() )); } } else if (comparison == 0){ - *res++ =result_type + *res++ =CGAL::internal::intersection_return ( std::make_pair(a2.left(),1u)); } return res; @@ -467,16 +467,16 @@ namespace CircularFunctors { int comparison = compare_xy(a1.left(),a2.right()); if(comparison < 0){ if(compare_xy(a1.right(),a2.right()) <= 0){ - *res++ = result_type + *res++ = CGAL::internal::intersection_return (Line_arc_2(a1.supporting_line(), a1.left(), a1.right() )); } else{ - *res++ = result_type + *res++ = CGAL::internal::intersection_return (Line_arc_2(a1.supporting_line(), a1.left(), a2.right() )); } } else if (comparison == 0){ - *res++ = result_type + *res++ = CGAL::internal::intersection_return ( std::make_pair(a1.left(),1u)); } return res; @@ -487,7 +487,7 @@ namespace CircularFunctors { v = CGAL::internal::intersection(a1.supporting_line(), a2.supporting_line(), CK()); if(!v) return res; - const Point_2 *pt = boost::get(&*v); + const Point_2 *pt = CGAL::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()))); @@ -496,7 +496,7 @@ namespace CircularFunctors { CircularFunctors::compare_xy(intersect_point, a1.target())) && (CircularFunctors::compare_xy(intersect_point, a2.source()) != CircularFunctors::compare_xy(intersect_point, a2.target()))) - *res++ = result_type(std::make_pair(intersect_point, 1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(intersect_point, 1u)); return res; } @@ -525,8 +525,18 @@ namespace CircularFunctors { for (typename solutions_container::iterator it = solutions.begin(); it != solutions.end(); ++it) { + #if CGAL_INTERSECTION_VERSION < 2 + if(const std::pair* p = + object_cast< std::pair< typename CK::Circular_arc_point_2, unsigned> >(& (*it))) { + Has_on_visitor vis(&l); + if(vis(*p)) { + *res++ = *it; + } + } + #else if(boost::apply_visitor(Has_on_visitor(&l), *it)) *res++ = *it; + #endif } return res; @@ -796,8 +806,18 @@ namespace CircularFunctors { for (typename solutions_container::const_iterator it = solutions.begin(); it != solutions.end(); ++it) { + #if CGAL_INTERSECTION_VERSION < 2 + if( const std::pair* p = + object_cast >(& (*it)) ) { + Has_on_visitor vis(&c); + if(vis(*p)) { + *res++ = *it; + } + } + #else if(boost::apply_visitor(Has_on_visitor(&c), *it)) *res++ = *it; + #endif } return res; } diff --git a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h index 8366a77c6aa..95ab1c4f81d 100644 --- a/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h +++ b/Circular_kernel_3/include/CGAL/Circular_kernel_3/function_objects_polynomial_sphere.h @@ -1167,8 +1167,10 @@ template < class SK > \ public: - typedef typename SK::Object_3 Object_3; - + #if CGAL_INTERSECTION_VERSION < 2 + typedef typename CK::Linear_kernel::Intersect_2::result_type result_type; + #endif + using SK::Linear_kernel::Intersect_3::operator(); template < class OutputIterator > 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 171d12f78b2..1e9e7bd5528 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 @@ -124,8 +124,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]=boost::get >(&inters[0]); - pt[1]=boost::get >(&inters[1]); + pt[0]=CGAL::internal::intersect_get >(inters[0]); + pt[1]=CGAL::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 54570b746fc..b29f9c05a2e 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 @@ -96,12 +96,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*boost::get(&solutions[0]); + const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*boost::get(&solutions[0]); - const Solution& sol2=*boost::get(&solutions[1]); + const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::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)) @@ -134,12 +134,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*boost::get(&solutions[0]); + const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*boost::get(&solutions[0]); - const Solution& sol2=*boost::get(&solutions[1]); + const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::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)) @@ -173,12 +173,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*boost::get(&solutions[0]); + const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(c,sol.first,true)) *res++ = solutions[0]; } else { - const Solution& sol1=*boost::get(&solutions[0]); - const Solution& sol2=*boost::get(&solutions[1]); + const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::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)) @@ -200,7 +200,7 @@ namespace CGAL { typename SK::Plane_3>::result_type> solutions_container; typedef std::pair Solution; if(SK().has_on_3_object()(p,ca.supporting_circle())) { - *res++ = result_type(ca); + *res++ = CGAL::internal::intersection_return(ca); } solutions_container solutions; @@ -208,16 +208,16 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*boost::get(&solutions[0]); + const Solution& sol=*CGAL::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(ca,sol.first,true)) - *res++ = result_type(sol); + *res++ = CGAL::internal::intersection_return(sol); } else { - const Solution& sol1=*boost::get(&solutions[0]); - const Solution& sol2=*boost::get(&solutions[1]); + const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(ca,sol1.first,true)) - *res++ = result_type(sol1); + *res++ = CGAL::internal::intersection_return(sol1); if(SK().has_on_3_object()(ca,sol2.first,true)) - *res++ = result_type(sol2); + *res++ = CGAL::internal::intersection_return(sol2); } return res; } @@ -240,13 +240,13 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*boost::get(&solutions[0]); + const Solution& sol=*CGAL::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=*boost::get(&solutions[0]); - const Solution& sol2=*boost::get(&solutions[1]); + const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::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]; @@ -273,11 +273,13 @@ namespace CGAL { if(non_oriented_equal(a1.supporting_circle(), a2.supporting_circle())) { if(a1.rep().is_full()) { - *res++ = result_type(a2); + *res++ = CGAL::internal::intersection_return(a2); //return res; } else if(a2.rep().is_full()) { - *res++ = result_type(a1); + *res++ = CGAL::internal::intersection_return(a1); //return res; } else { bool t2_in_a1 = SK().has_on_3_object()(a1,a2.target(),true); @@ -290,58 +292,73 @@ namespace CGAL { SK().compare_xyz_3_object()(a1.source(), a2.source()); if(comp < 0) { if(a1.source() == a2.target()) { - *res++ = result_type(std::make_pair(a1.source(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(a1.source(),1u)); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = result_type(arc); + *res++ = CGAL::internal::intersection_return(arc); } if(a2.source() == a1.target()) { - *res++ = result_type(std::make_pair(a2.source(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(a2.source(),1u)); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = result_type(arc); + *res++ = CGAL::internal::intersection_return(arc); } } else if(comp > 0) { if(a2.source() == a1.target()) { - *res++ = result_type(std::make_pair(a2.source(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(a2.source(),1u)); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = result_type(arc); + *res++ = CGAL::internal::intersection_return(arc); } if(a1.source() == a2.target()) { - *res++ = result_type(std::make_pair(a1.source(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(a1.source(),1u)); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = result_type(arc); + *res++ = CGAL::internal::intersection_return(arc); } } else { - *res++ = result_type(a1); + *res++ = CGAL::internal::intersection_return(a1); } } else { - *res++ = result_type(a2); + *res++ = CGAL::internal::intersection_return(a2); } } else if(t2_in_a1) { if(a1.source() == a2.target()) - *res++ = result_type(std::make_pair(a1.source(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(a1.source(),1u)); else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a1.source(),a2.target()); - *res++ = result_type(arc); + *res++ = CGAL::internal::intersection_return(arc); } //return res; } else if(s2_in_a1) { if(a2.source() == a1.target()) { - *res++ = result_type(std::make_pair(a2.source(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(a2.source(),1u)); } else { const Circular_arc_3 & arc = Circular_arc_3(a1.supporting_circle(),a2.source(),a1.target()); - *res++ = result_type(arc); + *res++ = CGAL::internal::intersection_return(arc); } } else if(SK().has_on_3_object()(a2,a1.source(),true)) { - *res++ = result_type(a1); + *res++ = CGAL::internal::intersection_return(a1); } } } else { @@ -351,13 +368,13 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution& sol=*boost::get(&solutions[0]); + const Solution& sol=*CGAL::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=*boost::get(&solutions[0]); - const Solution& sol2=*boost::get(&solutions[1]); + const Solution& sol1=*CGAL::internal::intersect_get(solutions[0]); + const Solution& sol2=*CGAL::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]; @@ -473,8 +490,8 @@ namespace CGAL { //one endpoint is extremal: just split the arc if (nb_extrem==1){ const std::pair* pt[2]={NULL,NULL}; - pt[0]=boost::get >(&inters[0]); - pt[1]=boost::get >(&inters[1]); + pt[0]=CGAL::internal::intersect_get >(inters[0]); + pt[1]=CGAL::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; @@ -488,7 +505,7 @@ namespace CGAL { //only one intersection points if (inters.size()==1){ const std::pair* midpt=NULL; - midpt=boost::get >(&inters[0]); + midpt=CGAL::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()); @@ -497,8 +514,8 @@ namespace CGAL { //three arcs are defined by two intersection points const std::pair* pt[2]={NULL,NULL}; - pt[0]=boost::get >(&inters[0]); - pt[1]=boost::get >(&inters[1]); + pt[0]=CGAL::internal::intersect_get >(inters[0]); + pt[1]=CGAL::internal::intersect_get >(inters[1]); CGAL_kernel_precondition(pt[0]!=NULL); CGAL_kernel_precondition(pt[1]!=NULL); @@ -581,14 +598,16 @@ namespace CGAL { CGAL_kernel_precondition(!inters.empty()); if (inters.size()==1){ const typename SK::Circular_arc_point_3& pt= - boost::get >(&inters[0])->first; + CGAL::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=boost::get >(&inters[0])->first; - const typename SK::Circular_arc_point_3& pts2=boost::get >(&inters[1])->first; + const typename SK::Circular_arc_point_3& pts1 = + CGAL::internal::intersect_get >(inters[0])->first; + const typename SK::Circular_arc_point_3& pts2 = + CGAL::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 0ac83054e11..181a2e933ad 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 @@ -94,12 +94,12 @@ namespace CGAL { if(!o) return res; - if(const Point_3* inters_p = boost::get(&(*o))) { + if(const Point_3* inters_p = CGAL::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++ = result_type(std::make_pair(p,1u)); - } else if(const Line_3* inters_l = boost::get(&(*o))) { + *res++ = CGAL::internal::intersection_return(std::make_pair(p,1u)); + } else if(const Line_3* inters_l = CGAL::internal::intersect_get(o)) { if(SK().compare_xyz_3_object()(l1.lower_xyz_extremity(), l2.lower_xyz_extremity()) < 0) { int comparison = @@ -108,15 +108,15 @@ namespace CGAL { if(comparison < 0) { if(SK().compare_xyz_3_object()(l1.higher_xyz_extremity(), l2.higher_xyz_extremity()) <= 0) { - *res++ = result_type + *res++ = CGAL::internal::intersection_return (Line_arc_3(l1.supporting_line(), l2.lower_xyz_extremity(), l1.higher_xyz_extremity())); } else { - *res++ = result_type(l2); + *res++ = CGAL::internal::intersection_return(l2); } } else if (comparison == 0) { - *res++ = result_type(std::make_pair(l2.lower_xyz_extremity(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(l2.lower_xyz_extremity(),1u)); } } else { @@ -126,16 +126,16 @@ namespace CGAL { if(comparison < 0) { if(SK().compare_xyz_3_object()(l1.higher_xyz_extremity(), l2.higher_xyz_extremity()) <= 0) { - *res++ = result_type(l1); + *res++ = CGAL::internal::intersection_return(l1); } else { - *res++ = result_type + *res++ = CGAL::internal::intersection_return (Line_arc_3(l1.supporting_line(), l1.lower_xyz_extremity(), l2.higher_xyz_extremity() )); } } else if (comparison == 0){ - *res++ = result_type(std::make_pair(l1.lower_xyz_extremity(),1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(l1.lower_xyz_extremity(),1u)); } } } @@ -160,12 +160,12 @@ namespace CGAL { if(!o) return res; - if(const Line_3* inters_l = boost::get(&*o)) { - *res++ = result_type(la); - } else if(const Point_3* inters_p = boost::get(&*o)) { + if(const Line_3* inters_l = CGAL::internal::intersect_get(o)) { + *res++ = CGAL::internal::intersection_return(la); + } else if(const Point_3* inters_p = CGAL::internal::intersect_get(o)) { Circular_arc_point_3 p = *inters_p; if(!SK().has_on_3_object()(la,p,true)) return res; - *res++ = result_type(std::make_pair(p,1u)); + *res++ = CGAL::internal::intersection_return(std::make_pair(p,1u)); } return res; @@ -188,12 +188,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution* sol = boost::get(&solutions[0]); + const Solution* sol = CGAL::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(l,(*sol).first,true)) *res++ = solutions[0]; } else { - const Solution* sol1 = boost::get(&solutions[0]); - const Solution* sol2 = boost::get(&solutions[1]); + const Solution* sol1 = CGAL::internal::intersect_get(solutions[0]); + const Solution* sol2 = CGAL::internal::intersect_get(solutions[1]); if(SK().has_on_3_object()(l,(*sol1).first,true)) *res++ = solutions[0]; @@ -218,12 +218,12 @@ namespace CGAL { std::back_inserter(solutions) ); if(solutions.size() == 0) return res; if(solutions.size() == 1) { - const Solution* sol = boost::get(&solutions[0]); + const Solution* sol = CGAL::internal::intersect_get(solutions[0]); if(SK().has_on_3_object()(l,(*sol).first,true)) *res++ = solutions[0]; } else { - const Solution* sol1 = boost::get(&solutions[0]); - const Solution* sol2 = boost::get(&solutions[1]); + const Solution* sol1 = CGAL::internal::intersect_get(solutions[0]); + const Solution* sol2 = CGAL::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)) @@ -249,7 +249,7 @@ namespace CGAL { if(!o) return res; - if(sol = boost::get(&*o)) { + if(sol = CGAL::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 c17d7f36cda..649039babd1 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 @@ -203,9 +203,18 @@ namespace CGAL { // we need to pass the result_type, to hack around the fact that // object doesn't support operator=(const T&) and so we keep backwards compatibility template - RT pair_transform(const std::pair< typename SK::Root_for_spheres_2_3, unsigned >& p) { - return RT(std::make_pair(typename SK::Circular_arc_point_3(p.first), p.second)); - } + struct pair_transform { + RT operator()(const std::pair< typename SK::Root_for_spheres_2_3, unsigned >& p) { + return RT(std::make_pair(typename SK::Circular_arc_point_3(p.first), p.second)); + } + }; + + template + struct pair_transform { + CGAL::Object operator()(const std::pair< typename SK::Root_for_spheres_2_3, unsigned >& p) { + return CGAL::make_object(std::make_pair(typename SK::Circular_arc_point_3(p.first), p.second)); + } + }; // obscure trick: calculate the regular intersection between two // objects, throw it away if empty, else check if the result was a @@ -218,6 +227,7 @@ namespace CGAL { Point_conversion_visitor(const OutputIterator& it) : it(it) {} template OutputIterator operator()(const T& t) { *it++ = RT(t); return it; } + OutputIterator operator()(const typename SK::Point_3& p) { // 2 multiplicities *it++ = RT(std::make_pair(typename SK::Circular_arc_point_3(p), 2u)); @@ -250,7 +260,7 @@ namespace CGAL { solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } // The special 3 object functions @@ -276,25 +286,43 @@ namespace CGAL { CGAL_kernel_precondition(!s2.is_degenerate()); CGAL_kernel_precondition(!s3.is_degenerate()); if(non_oriented_equal(s1,s2) && non_oriented_equal(s2,s3)) { + #if CGAL_INTERSECTION_VERSION < 2 + *res++ = make_object(s1); + #else *res++ = result_type(s1); + #endif return res; } if(non_oriented_equal(s1,s2)) { if(typename IT::result_type v = SK().intersect_3_object()(s1, s3)) { + #if CGAL_INTERSECTION_VERSION < 2 + if( const Point_3* p = object_cast(&v) ) + *res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u)); + else + *res++ = v; + #else internal::Point_conversion_visitor visitor(res); return boost::apply_visitor(visitor, *v); + #endif } return res; } if(non_oriented_equal(s1,s3) || non_oriented_equal(s2,s3)) { if(typename IT::result_type v = SK().intersect_3_object()(s1, s2)) { + #if CGAL_INTERSECTION_VERSION < 2 + if( const Point_3* p = object_cast(&v) ) + *res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u)); + else + *res++ = v; + #else internal::Point_conversion_visitor visitor(res); return boost::apply_visitor( visitor, *v); + #endif } return res; } @@ -302,15 +330,23 @@ namespace CGAL { typename IT::result_type v = SK().intersect_3_object()(s1, s2); if(!v) return res; - if(const Point_3* p = boost::get(&*v)) { + if(const Point_3* p = CGAL::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)); + #else *res++ = result_type(std::make_pair(Circular_arc_point_3(*p),2u)); + #endif } return res; } - if(const Circle_3* c = boost::get(&*v)) { + if(const Circle_3* c = CGAL::internal::intersect_get(v)) { if(SK().has_on_3_object()(s3, *c)) { + #if CGAL_INTERSECTION_VERSION < 2 + *res++ = make_object(*c); + #else *res++ = result_type(*c); + #endif } return res; } @@ -324,7 +360,7 @@ namespace CGAL { algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, e3, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -349,10 +385,17 @@ namespace CGAL { if(non_oriented_equal(s1,s2)) { if(typename IT::result_type v = SK().intersect_3_object()(p, s1)) { + #if CGAL_INTERSECTION_VERSION < 2 + if( const typename SK::Point_3* p = CGAL::object_cast(&v) ) + *res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u)); + else + *res++ = v; + #else internal::Point_conversion_visitor visitor(res); return boost::apply_visitor( visitor, *v); + #endif } return res; } @@ -360,10 +403,17 @@ namespace CGAL { if(non_oriented_equal(p,radical_p)) { if(typename IT::result_type v = SK().intersect_3_object()(p, s1)) { + #if CGAL_INTERSECTION_VERSION < 2 + if( const typename SK::Point_3* p = CGAL::object_cast(&v) ) + *res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u)); + else + *res++ = v; + #else internal::Point_conversion_visitor visitor(res); return boost::apply_visitor( visitor, *v); + #endif } return res; } @@ -374,7 +424,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, e3, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -399,10 +449,17 @@ namespace CGAL { if(non_oriented_equal(p1,p2)) { if(typename IT::result_type v = SK().intersect_3_object()(p1, s)) { + #if CGAL_INTERSECTION_VERSION < 2 + if( const typename SK::Point_3* p = CGAL::object_cast(&v) ) + *res++ = make_object(std::make_pair(Circular_arc_point_3(*p), 2u)); + else + *res++ = v; + #else internal::Point_conversion_visitor visitor(res); return boost::apply_visitor( visitor, *v); + #endif } return res; } @@ -413,7 +470,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, e3, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -449,7 +506,7 @@ namespace CGAL { ::result_type result_type; if(non_oriented_equal(c1,c2)) { - *res++ = result_type(c1); + *res++ = CGAL::internal::intersection_return(c1); return res; } Equation_circle e1 = get_equation(c1); @@ -458,7 +515,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } template < class SK, class OutputIterator > @@ -481,7 +538,7 @@ namespace CGAL { algebraic_solutions_container; algebraic_solutions_container solutions; Algebraic_kernel().solve_object()(e1, e2, std::back_inserter(solutions)); - return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform); + return std::transform(solutions.begin(), solutions.end(), res, internal::pair_transform()); } // At the moment we dont need those functions diff --git a/Intersections_2/include/CGAL/Intersection_traits.h b/Intersections_2/include/CGAL/Intersection_traits.h index a8f75705857..b68422ebdc2 100644 --- a/Intersections_2/include/CGAL/Intersection_traits.h +++ b/Intersections_2/include/CGAL/Intersection_traits.h @@ -85,9 +85,13 @@ struct IT : public Intersection_traits {}; // The version to cover ternary intersections of the Spherical_kernel template struct Intersection_traits_spherical { +#if CGAL_INTERSECTION_VERSION < 2 + typedef CGAL::Object result_type; +#else typedef boost::variant< typename K::Circle_3, typename K::Plane_3, typename K::Sphere_3, std::pair< typename K::Circular_arc_point_3, unsigned > > result_type; +#endif }; template