Kernel_23: Add function squared_length()

This commit is contained in:
Andreas Fabri 2024-01-29 16:16:17 +00:00
parent 96f698ca09
commit ab19b99105
5 changed files with 99 additions and 0 deletions

View File

@ -2691,6 +2691,40 @@ const CGAL::Point_3<Kernel>& r);
/// \defgroup squared_distance_grp CGAL::squared_distance() /// \defgroup squared_distance_grp CGAL::squared_distance()
/// \ingroup kernel_global_function /// \ingroup kernel_global_function
/// \defgroup squared_radius_grp CGAL::squared_length()
/// \ingroup kernel_global_function
/*!
compute the squared length of vector `v`.
*/
template <typename Kernel>
FT
squared_length(const CGAL::Vector_2<Kernel>& v);
/*!
compute the squared length of segment `s`.
*/
template <typename Kernel>
FT
squared_length(const CGAL::Segment_2<Kernel>& s);
/*!
compute the squared length of vector `v`.
*/
template <typename Kernel>
FT
squared_length(const CGAL::Vector_3<Kernel>& v);
/*!
compute the squared length of segment `s`.
*/
template <typename Kernel>
FT
squared_length(const CGAL::Segment_3<Kernel>& s);
/// @}
/// \defgroup squared_radius_grp CGAL::squared_radius() /// \defgroup squared_radius_grp CGAL::squared_radius()
/// \ingroup kernel_global_function /// \ingroup kernel_global_function
/// \sa `Circle_2<Kernel>_grp` /// \sa `Circle_2<Kernel>_grp`

View File

@ -1114,6 +1114,22 @@ side_of_oriented_circle(const Point_2<K> &p,
return internal::side_of_oriented_circle(p, q, r, t, K()); return internal::side_of_oriented_circle(p, q, r, t, K());
} }
template < class K >
inline
typename K::FT
squared_length(const Vector_2<K> &v)
{
return internal::squared_length(v, K());
}
template < class K >
inline
typename K::FT
squared_length(const Segment_2<K> &s)
{
return internal::squared_length(s, K());
}
template < class K > template < class K >
inline inline
typename K::FT typename K::FT

View File

@ -1276,6 +1276,22 @@ squared_area(const Point_3<K> &p, const Point_3<K> &q, const Point_3<K> &r)
return internal::squared_area(p, q, r, K()); return internal::squared_area(p, q, r, K());
} }
template < class K >
inline
typename K::FT
squared_length(const Vector_3<K> &v)
{
return internal::squared_length(v, K());
}
template < class K >
inline
typename K::FT
squared_length(const Segment_3<K> &s)
{
return internal::squared_length(s, K());
}
template < class K > template < class K >
inline inline
typename K::FT typename K::FT

View File

@ -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); return k.side_of_oriented_circle_2_object()(p, q, r, t);
} }
template <typename K>
inline
typename K::FT
squared_length(const typename K::Vector_2 &v, const K &k)
{
return k.compute_squared_length_2_object()(v);
}
template <typename K>
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 > template < class K >
inline inline
typename K::FT typename K::FT

View File

@ -1112,6 +1112,22 @@ squared_area(const typename K::Point_3 &p,
return k.compute_squared_area_3_object()(p, q, r); return k.compute_squared_area_3_object()(p, q, r);
} }
template <typename K>
inline
typename K::FT
squared_length(const typename K::Vector_3 &v, const K &k)
{
return k.compute_squared_length_3_object()(v);
}
template <typename K>
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 > template < class K >
inline inline
typename K::FT typename K::FT