diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 1d698f65b6e..4b06db737af 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -37,6 +37,41 @@ namespace CGAL { namespace CommonKernelFunctors { + + + template + class Non_zero_dimension_3 + { + typedef typename K::Vector_3 Vector_3; + + public: + typedef int result_type; + + int operator()(const Vector_3& vec) const + { + int dir = -1; + if(certainly_not(is_zero(vec.x()))){ + dir = 0; + } else if(certainly_not(is_zero(vec.y()))){ + dir = 1; + }else if(certainly_not(is_zero(vec.y()))){ + dir = 2; + } + + if(dir == -1){ + if(! is_zero(vec.x())){ + return 0; + } else if(! is_zero(vec.y())){ + return 1; + } else if(! is_zero(vec.z())){ + return 2; + } + } + return dir; + } + }; + + template class Are_ordered_along_line_2 { diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index a4caf77e7be..668749ff3d5 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -582,6 +582,8 @@ CGAL_Kernel_pred(Less_y_3, less_y_3_object) CGAL_Kernel_pred(Less_z_3, less_z_3_object) +CGAL_Kernel_pred(Non_zero_dimension_3, + non_zero_dimension_3_object) CGAL_Kernel_pred_RT(Orientation_2, orientation_2_object) CGAL_Kernel_pred_RT(Orientation_3, diff --git a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h index a34ed350fd4..90ff227e88c 100644 --- a/Nef_3/include/CGAL/Nef_3/bounded_side_3.h +++ b/Nef_3/include/CGAL/Nef_3/bounded_side_3.h @@ -99,8 +99,9 @@ Bounded_side bounded_side_3(IteratorForward first, we don't need to care about the plane orientation */ } - - + typename R::Non_zero_dimension_3 non_zero_dimension_3; + int dir = non_zero_dimension_3(plane.orthogonal_vector()); +#if 0 auto apv = approx(plane.orthogonal_vector()); int dir = 0; @@ -112,7 +113,7 @@ Bounded_side bounded_side_3(IteratorForward first, if(CGAL::abs(apv.z().sup()) > max){ dir = 2; } - +#endif CGAL_assertion(!plane.is_degenerate()); Point_2 (*t)(const Point_3&);