diff --git a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h index 27d9029b088..bbe7e938a06 100644 --- a/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h +++ b/Cartesian_kernel/include/CGAL/Cartesian/function_objects.h @@ -541,8 +541,10 @@ namespace CartesianKernelFunctors { typedef typename K::Point_2 Point_2; typedef typename K::Line_2 Line_2; typedef typename K::Equal_2 Equal_2; + typedef typename K::Less_signed_distance_to_line_2 Less_signed_distance_to_line_2; + public: - typedef Comparison_result result_type; + typedef typename K::Comparison_result result_type; result_type operator()(const Point_2& a, const Point_2& b, @@ -555,6 +557,15 @@ namespace CartesianKernelFunctors { c.x(), c.y(), d.x(), d.y()); } + + result_type + operator()(const Line_2& l, const Point_2& p, const Point_2& q) const + { + Less_signed_distance_to_line_2 less = K().less_signed_distance_to_line_2_object(); + if (less(l, p, q)) return SMALLER; + if (less(l, q, p)) return LARGER; + return EQUAL; + } }; template diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h index 5ca5dd5a880..e86d75a6b81 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h @@ -803,6 +803,15 @@ namespace HomogeneousKernelFunctors { return compare(scaled_dist_r_minus_scaled_dist_s, 0); } + + result_type + operator()(const Line_2& l, const Point_2& p, const Point_2& q) const + { + Less_signed_distance_to_line_2 less = K().less_signed_distance_to_line_2_object(); + if (less(l, p, q)) return SMALLER; + if (less(l, q, p)) return LARGER; + return EQUAL; + } }; template diff --git a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h index e3f773acdee..4a250abb319 100644 --- a/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h +++ b/Kernel_23/doc/Kernel_23/Concepts/FunctionObjectConcepts.h @@ -999,6 +999,13 @@ public: const Kernel::Point_2& q, const Kernel::Point_2& r, const Kernel::Point_2& s); + + /*! + compares the signed distance of `r` and `s` to the directed line `l`. + */ + Comparison_result operator()(const Kernel::Line_2& l, + const Kernel::Point_2& r, + const Kernel::Point_2& s); /// @} }; /* end Kernel::CompareSignedDistanceToLine_2 */ diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_internal_2.h b/Kernel_23/include/CGAL/Kernel/global_functions_internal_2.h index 2b94ed2d71a..65ae49eda3f 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_internal_2.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_internal_2.h @@ -361,9 +361,7 @@ compare_signed_distance_to_line(const typename K::Line_2& l, const typename K::Point_2& q, const K& k) { - if (k.less_signed_distance_to_line_2_object()(l, p, q)) return SMALLER; - if (k.less_signed_distance_to_line_2_object()(l, q, p)) return LARGER; - return EQUAL; + return k.compare_signed_distance_to_line_2_object()(l, p, q); } template < class K >