Base: [skip ci] add method to check for null vector

This commit is contained in:
wmayer
2021-10-19 19:19:31 +02:00
parent abf1cd1586
commit 0b63548ea1
2 changed files with 9 additions and 0 deletions

View File

@@ -416,6 +416,13 @@ Vector3<_Precision> & Vector3<_Precision>::Normalize (void)
return *this;
}
template <class _Precision>
bool Vector3<_Precision>::IsNull() const
{
_Precision n{0.0};
return (x == n) && (y == n) && (z == n);
}
template <class _Precision>
_Precision Vector3<_Precision>::GetAngle (const Vector3 &rcVect) const
{

View File

@@ -161,6 +161,8 @@ public:
_Precision Sqr (void) const;
/// Set length to 1.
Vector3 & Normalize (void);
/// Checks whether this is the null vector
bool IsNull() const;
/// Get angle between both vectors. The returned value lies in the interval [0,pi].
_Precision GetAngle (const Vector3 &rcVect) const;
/** Transforms this point to the coordinate system defined by origin \a rclBase,