From ab19b99105cb81f4b96df167155b3c39defa9e6c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 29 Jan 2024 16:16:17 +0000 Subject: [PATCH] Kernel_23: Add function squared_length() --- .../Kernel_23/CGAL/Kernel/global_functions.h | 34 +++++++++++++++++++ .../include/CGAL/Kernel/global_functions_2.h | 16 +++++++++ .../include/CGAL/Kernel/global_functions_3.h | 16 +++++++++ .../CGAL/Kernel/global_functions_internal_2.h | 17 ++++++++++ .../CGAL/Kernel/global_functions_internal_3.h | 16 +++++++++ 5 files changed, 99 insertions(+) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h b/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h index 243ca48a93e..b26638c84b1 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Kernel/global_functions.h @@ -2691,6 +2691,40 @@ const CGAL::Point_3& r); /// \defgroup squared_distance_grp CGAL::squared_distance() /// \ingroup kernel_global_function +/// \defgroup squared_radius_grp CGAL::squared_length() +/// \ingroup kernel_global_function + +/*! +compute the squared length of vector `v`. +*/ +template +FT +squared_length(const CGAL::Vector_2& v); + +/*! +compute the squared length of segment `s`. +*/ +template +FT +squared_length(const CGAL::Segment_2& s); + +/*! +compute the squared length of vector `v`. +*/ +template +FT +squared_length(const CGAL::Vector_3& v); + +/*! +compute the squared length of segment `s`. +*/ +template +FT +squared_length(const CGAL::Segment_3& s); + +/// @} + + /// \defgroup squared_radius_grp CGAL::squared_radius() /// \ingroup kernel_global_function /// \sa `Circle_2_grp` diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_2.h b/Kernel_23/include/CGAL/Kernel/global_functions_2.h index e974eae730d..ad67bff1041 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_2.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_2.h @@ -1114,6 +1114,22 @@ side_of_oriented_circle(const Point_2 &p, return internal::side_of_oriented_circle(p, q, r, t, K()); } +template < class K > +inline +typename K::FT +squared_length(const Vector_2 &v) +{ + return internal::squared_length(v, K()); +} + +template < class K > +inline +typename K::FT +squared_length(const Segment_2 &s) +{ + return internal::squared_length(s, K()); +} + template < class K > inline typename K::FT diff --git a/Kernel_23/include/CGAL/Kernel/global_functions_3.h b/Kernel_23/include/CGAL/Kernel/global_functions_3.h index e17211e184b..aa16e5d7cb8 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_3.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_3.h @@ -1276,6 +1276,22 @@ squared_area(const Point_3 &p, const Point_3 &q, const Point_3 &r) return internal::squared_area(p, q, r, K()); } +template < class K > +inline +typename K::FT +squared_length(const Vector_3 &v) +{ + return internal::squared_length(v, K()); +} + +template < class K > +inline +typename K::FT +squared_length(const Segment_3 &s) +{ + return internal::squared_length(s, K()); +} + template < class K > inline typename K::FT 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 7212eb7ed60..a7407a9fd74 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_internal_2.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_internal_2.h @@ -988,6 +988,23 @@ side_of_oriented_circle(const typename K::Point_2 &p, return k.side_of_oriented_circle_2_object()(p, q, r, t); } + +template +inline +typename K::FT +squared_length(const typename K::Vector_2 &v, const K &k) +{ + return k.compute_squared_length_2_object()(v); +} + +template +inline +typename K::FT +squared_length(const typename K::Segment_2 &s, const K &k) +{ + return k.compute_squared_length_2_object()(s); +} + template < class K > inline typename K::FT 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 e48ec201f38..8ae26a9c787 100644 --- a/Kernel_23/include/CGAL/Kernel/global_functions_internal_3.h +++ b/Kernel_23/include/CGAL/Kernel/global_functions_internal_3.h @@ -1112,6 +1112,22 @@ squared_area(const typename K::Point_3 &p, return k.compute_squared_area_3_object()(p, q, r); } +template +inline +typename K::FT +squared_length(const typename K::Vector_3 &v, const K &k) +{ + return k.compute_squared_length_3_object()(v); +} + +template +inline +typename K::FT +squared_length(const typename K::Segment_3 &s, const K &k) +{ + return k.compute_squared_length_3_object()(s); +} + template < class K > inline typename K::FT