From b997c33952ebb4938fc3aa76a654b32c25b15402 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 28 May 2008 14:25:42 +0000 Subject: [PATCH] Added compare_squared_radius, its functor, doc, testsuite --- .../Kernel_CompareSquaredRadius_3.tex | 33 +++++++++++++++++ .../Kernel_23_ref/compare_squared_radius.tex | 30 ++++++++++++++++ Kernel_23/doc_tex/Kernel_23_ref/main.tex | 2 ++ .../include/CGAL/Kernel/global_functions_3.h | 33 +++++++++++++++++ .../CGAL/Kernel/global_functions_internal_3.h | 36 +++++++++++++++++++ .../include/CGAL/Kernel/interface_macros.h | 2 ++ .../include/CGAL/_test_fct_point_3.h | 8 +++++ .../test/Kernel_23/include/CGAL/_test_new_3.h | 12 +++++++ 8 files changed, 156 insertions(+) create mode 100644 Kernel_23/doc_tex/Kernel_23_ref/Kernel_CompareSquaredRadius_3.tex create mode 100644 Kernel_23/doc_tex/Kernel_23_ref/compare_squared_radius.tex diff --git a/Kernel_23/doc_tex/Kernel_23_ref/Kernel_CompareSquaredRadius_3.tex b/Kernel_23/doc_tex/Kernel_23_ref/Kernel_CompareSquaredRadius_3.tex new file mode 100644 index 00000000000..ba0838d1281 --- /dev/null +++ b/Kernel_23/doc_tex/Kernel_23_ref/Kernel_CompareSquaredRadius_3.tex @@ -0,0 +1,33 @@ +\begin{ccRefFunctionObjectConcept}{Kernel::CompareSquaredRadius_3} +A model for this must provide: + +\ccCreationVariable{fo} + +\ccMemberFunction{Comparison_result operator()(const Kernel::Point_3&p, + const Kernel::Point_3&q, + const Kernel::FT& sr);} + {compares the squared radius of the sphere defined by the + points \ccc{p} and \ccc{q} to \ccc{sr}.} + +\ccMemberFunction{Comparison_result operator()(const Kernel::Point_3&p, + const Kernel::Point_3&q, + const Kernel::Point_3&r, + const Kernel::FT& sr);} + {compares the squared radius of the sphere defined by the + points \ccc{p}, \ccc{q}, and \ccc{r} to \ccc{sr}.} + +\ccMemberFunction{Comparison_result operator()(const Kernel::Point_3&p, + const Kernel::Point_3&q, + const Kernel::Point_3&r, + const Kernel::Point_3&s, + const Kernel::FT& sr);} + {compares the squared radius of the sphere defined by the + points \ccc{p}, \ccc{q}, , \ccc{r}, and \ccc{s} to \ccc{sr}.} + +\ccRefines +\ccc{AdaptableFunctor} (with three arguments) + +\ccSeeAlso +\ccRefIdfierPage{CGAL::compare_squared_radius} + +\end{ccRefFunctionObjectConcept} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/compare_squared_radius.tex b/Kernel_23/doc_tex/Kernel_23_ref/compare_squared_radius.tex new file mode 100644 index 00000000000..24c7cd41672 --- /dev/null +++ b/Kernel_23/doc_tex/Kernel_23_ref/compare_squared_radius.tex @@ -0,0 +1,30 @@ +\begin{ccRefFunction}{compare_squared_radius} + +\ccFunction{Comparison_result +compare_squared_radius(const Point_3& p, + const Point_3& q, + const typename Kernel::FT& sr);} + {compares the squared radius of the sphere defined by the + points \ccStyle{p} and \ccStyle{q} to \ccStyle{sr}.} + + +\ccFunction{Comparison_result +compare_squared_radius(const Point_3& p, + const Point_3& q, + const Point_3& r, + const typename Kernel::FT& sr);} + {compares the squared radius of the sphere defined by the + points \ccStyle{p}, \ccStyle{q}, and \ccStyle{r} to \ccStyle{sr}.} + +\ccFunction{Comparison_result +compare_squared_radius(const Point_3& p, + const Point_3& q, + const Point_3& r, + const Point_3& s, + const typename Kernel::FT& sr);} + {compares the squared radius of the sphere defined by the + points \ccStyle{p}, \ccStyle{q}, \ccStyle{r}, and \ccStyle{r} to \ccStyle{sr}.} + + + +\end{ccRefFunction} diff --git a/Kernel_23/doc_tex/Kernel_23_ref/main.tex b/Kernel_23/doc_tex/Kernel_23_ref/main.tex index e05bf560082..fcf5343235c 100644 --- a/Kernel_23/doc_tex/Kernel_23_ref/main.tex +++ b/Kernel_23/doc_tex/Kernel_23_ref/main.tex @@ -165,6 +165,7 @@ in the kernel. \input{Kernel_23_ref/compare_signed_distance_to_plane.tex} \input{Kernel_23_ref/compare_slopes.tex} \input{Kernel_23_ref/compare_squared_distance.tex} +\input{Kernel_23_ref/compare_squared_radius.tex} \input{Kernel_23_ref/compare_x.tex} \input{Kernel_23_ref/compare_xy.tex} \input{Kernel_23_ref/compare_xyz.tex} @@ -276,6 +277,7 @@ in the kernel. \input{Kernel_23_ref/Kernel_CompareSlope_2.tex} \input{Kernel_23_ref/Kernel_CompareSquaredDistance_2.tex} \input{Kernel_23_ref/Kernel_CompareSquaredDistance_3.tex} +\input{Kernel_23_ref/Kernel_CompareSquaredRadius_3.tex} \input{Kernel_23_ref/Kernel_CompareXAtY_2.tex} \input{Kernel_23_ref/Kernel_CompareXYZ_3.tex} \input{Kernel_23_ref/Kernel_CompareXY_2.tex} diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_3.h b/Kernel_23/include/CGAL/Kernel/global_functions_3.h index 158e43ab678..ae61425e49b 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_3.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_3.h @@ -280,6 +280,39 @@ compare_squared_distance(const Point_3 &p, return CGALi::compare_squared_distance(p, q, d2, K()); } +template < class K > +inline +Comparison_result +compare_squared_radius(const Point_3 &p, + const Point_3 &q, + const typename K::FT &sr) +{ + return CGALi::compare_squared_radius(p, q, sr, K()); +} + +template < class K > +inline +Comparison_result +compare_squared_radius(const Point_3 &p, + const Point_3 &q, + const Point_3 &r, + const typename K::FT &sr) +{ + return CGALi::compare_squared_radius(p, q, r, sr, K()); +} + +template < class K > +inline +Comparison_result +compare_squared_radius(const Point_3 &p, + const Point_3 &q, + const Point_3 &r, + const Point_3 &s, + const typename K::FT &sr) +{ + return CGALi::compare_squared_radius(p, q, r, s, sr, K()); +} + template < class K > inline Comparison_result diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_internal_3.h b/Kernel_23/include/CGAL/Kernel/global_functions_internal_3.h index 53670804980..a3ddd9c3ba4 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_internal_3.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_internal_3.h @@ -280,6 +280,42 @@ compare_squared_distance(const typename K::Point_3 &p, return k.compare_squared_distance_3_object()(p, q, d2); } +template < class K > +inline +Comparison_result +compare_squared_radius(const typename K::Point_3 &p, + const typename K::Point_3 &q, + const typename K::FT &sr, + const K& k) +{ + return k.compare_squared_radius_3_object()(p, q, sr); +} + +template < class K > +inline +Comparison_result +compare_squared_radius(const typename K::Point_3 &p, + const typename K::Point_3 &q, + const typename K::Point_3 &r, + const typename K::FT &sr, + const K& k) +{ + return k.compare_squared_radius_3_object()(p, q, r, sr); +} + +template < class K > +inline +Comparison_result +compare_squared_radius(const typename K::Point_3 &p, + const typename K::Point_3 &q, + const typename K::Point_3 &r, + const typename K::Point_3 &s, + const typename K::FT &sr, + const K& k) +{ + return k.compare_squared_radius_3_object()(p, q, r, s, sr); +} + template < class K > inline Comparison_result diff --git a/Kernel_23/include/CGAL/Kernel/interface_macros.h b/Kernel_23/include/CGAL/Kernel/interface_macros.h index 6aaaed24a90..3d1bbb4c90a 100644 --- a/Kernel_23/include/CGAL/Kernel/interface_macros.h +++ b/Kernel_23/include/CGAL/Kernel/interface_macros.h @@ -115,6 +115,8 @@ CGAL_Kernel_pred(Compare_squared_distance_2, compare_squared_distance_2_object) CGAL_Kernel_pred(Compare_squared_distance_3, compare_squared_distance_3_object) +CGAL_Kernel_pred(Compare_squared_radius_3, + compare_squared_radius_3_object) CGAL_Kernel_pred(Compare_x_at_y_2, compare_x_at_y_2_object) CGAL_Kernel_pred(Compare_xyz_3, diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_point_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_point_3.h index 993222d50ff..b1d18e2cc34 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_point_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_fct_point_3.h @@ -204,6 +204,14 @@ _test_fct_point_3(const R& ) assert( CGAL::compare_squared_distance(p0, p3, CGAL::squared_distance(p1,p0)) == CGAL::SMALLER ); assert( CGAL::compare_squared_distance(p1, p3, CGAL::squared_distance(p5,p1)) == CGAL::SMALLER ); + { + CGAL::Point_3 p0(-2,0,0), p1(2,0,0), p2(0,2,0), p3(0,0,2); + FT four(4); + assert( CGAL::compare_squared_radius(p0, p1, four) == CGAL::EQUAL ); + assert( CGAL::compare_squared_radius(p0, p1, p2, four) == CGAL::EQUAL ); + assert( CGAL::compare_squared_radius(p0, p1, p2, p3, four) == CGAL::EQUAL ); + } + // More tests, that require sqrt(). { typedef ::CGAL::Algebraic_structure_traits AST; diff --git a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h index 61eca6665a2..b26deae65cd 100644 --- a/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h +++ b/Kernel_23/test/Kernel_23/include/CGAL/_test_new_3.h @@ -592,6 +592,18 @@ test_new_3(const R& rep) = rep.compare_squared_distance_3_object(); tmp34ab = compare_sq_dist(p2,p3,FT(1)); + typename R::Compare_squared_radius_3 compare_sq_radius + = rep.compare_squared_radius_3_object(); + + { + FT rad(0); + Comparison_result tmp; + tmp = compare_sq_radius(p1, p2, p3, p4, rad); + tmp = compare_sq_radius(p1, p2, p3, rad); + tmp = compare_sq_radius(p1, p2, rad); + (void)tmp; + } + typename R::Collinear_3 collinear = rep.collinear_3_object(); bool tmp29 = collinear(p2,p3,p4);