core: Implement Vector{2,3}D::GetLength ()
This commit is contained in:
@@ -75,6 +75,19 @@ Vector2D::Vector2D ()
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
double
|
||||
Vector3D::GetLength () const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return std::sqrt (x * x + y * y + z * z);
|
||||
}
|
||||
double
|
||||
Vector2D::GetLength () const
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
return std::sqrt (x * x + y * y);
|
||||
}
|
||||
|
||||
double
|
||||
CalculateDistance (const Vector3D &a, const Vector3D &b)
|
||||
{
|
||||
|
||||
@@ -63,6 +63,7 @@ public:
|
||||
*/
|
||||
double z;
|
||||
|
||||
double GetLength () const;
|
||||
friend double CalculateDistance (const Vector3D &a, const Vector3D &b);
|
||||
friend std::ostream &operator << (std::ostream &os, const Vector3D &vector);
|
||||
friend std::istream &operator >> (std::istream &is, Vector3D &vector);
|
||||
@@ -96,6 +97,7 @@ public:
|
||||
*/
|
||||
double y;
|
||||
|
||||
double GetLength () const;
|
||||
friend double CalculateDistance (const Vector2D &a, const Vector2D &b);
|
||||
friend std::ostream &operator << (std::ostream &os, const Vector2D &vector);
|
||||
friend std::istream &operator >> (std::istream &is, Vector2D &vector);
|
||||
|
||||
Reference in New Issue
Block a user