Commit c8907ff5 authored by Davis King's avatar Davis King

Added a length_squared() member to vector.

parent db78a499
...@@ -345,6 +345,14 @@ namespace dlib ...@@ -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 ( typename vc_rebind<double,3>::type normalize (
) const ) const
{ {
...@@ -697,6 +705,13 @@ namespace dlib ...@@ -697,6 +705,13 @@ namespace dlib
// --------------------------------------- // ---------------------------------------
double length_squared(
) const
{
return (double)(x()*x() + y()*y());
}
// ---------------------------------------
typename vc_rebind<double,2>::type normalize ( typename vc_rebind<double,2>::type normalize (
) const ) const
......
...@@ -152,6 +152,13 @@ namespace dlib ...@@ -152,6 +152,13 @@ namespace dlib
- returns the length of the vector - returns the length of the vector
!*/ !*/
double length_squared(
) const;
/*!
ensures
- returns length()*length()
!*/
T& x ( T& x (
); );
/*! /*!
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment