mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Added a length_squared() member to vector.
This commit is contained in:
parent
db78a4991d
commit
c8907ff5e6
@ -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
|
||||
|
@ -152,6 +152,13 @@ namespace dlib
|
||||
- returns the length of the vector
|
||||
!*/
|
||||
|
||||
double length_squared(
|
||||
) const;
|
||||
/*!
|
||||
ensures
|
||||
- returns length()*length()
|
||||
!*/
|
||||
|
||||
T& x (
|
||||
);
|
||||
/*!
|
||||
|
Loading…
Reference in New Issue
Block a user