Added a length_squared() member to vector.

This commit is contained in:
Davis King 2014-12-08 19:56:31 -05:00
parent db78a4991d
commit c8907ff5e6
2 changed files with 22 additions and 0 deletions

View File

@ -345,6 +345,14 @@ namespace dlib
// ---------------------------------------
double length_squared(
) const
{
return (double)(x()*x() + y()*y() + z()*z());
}
// ---------------------------------------
typename vc_rebind<double,3>::type normalize (
) const
{
@ -697,6 +705,13 @@ namespace dlib
// ---------------------------------------
double length_squared(
) const
{
return (double)(x()*x() + y()*y());
}
// ---------------------------------------
typename vc_rebind<double,2>::type normalize (
) const

View File

@ -152,6 +152,13 @@ namespace dlib
- returns the length of the vector
!*/
double length_squared(
) const;
/*!
ensures
- returns length()*length()
!*/
T& x (
);
/*!