Math/Vector3: Add GetAbs method
This commit is contained in:
parent
a578b061b4
commit
147f1bc1cf
|
|
@ -43,6 +43,7 @@ namespace Nz
|
||||||
U Distance(const Vector3& vec) const;
|
U Distance(const Vector3& vec) const;
|
||||||
T DotProduct(const Vector3& vec) const;
|
T DotProduct(const Vector3& vec) const;
|
||||||
|
|
||||||
|
Vector3 GetAbs() const;
|
||||||
T GetLength() const;
|
T GetLength() const;
|
||||||
float GetLengthf() const;
|
float GetLengthf() const;
|
||||||
Vector3 GetNormal(T* length = nullptr) const;
|
Vector3 GetNormal(T* length = nullptr) const;
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,16 @@ namespace Nz
|
||||||
return x * vec.x + y * vec.y + z * vec.z;
|
return x * vec.x + y * vec.y + z * vec.z;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
* \brief Returns the absolute of this vector, ie: Vector3(abs(x), abs(y), abs(z))
|
||||||
|
* \return The absolute of this vector
|
||||||
|
*/
|
||||||
|
template<typename T>
|
||||||
|
Vector3<T> Vector3<T>::GetAbs() const
|
||||||
|
{
|
||||||
|
return Vector3(std::abs(x), std::abs(y), std::abs(z));
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Calculates the length (magnitude) of the vector
|
* \brief Calculates the length (magnitude) of the vector
|
||||||
* \return The length of the vector
|
* \return The length of the vector
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue