mirror of https://github.com/AxioDL/zeus.git
Add CVector3f::isMagnitudeSafe()
This commit is contained in:
parent
527b503bd7
commit
ca54d1b54d
|
@ -247,14 +247,12 @@ public:
|
|||
|
||||
inline void normalize()
|
||||
{
|
||||
float mag = magnitude();
|
||||
mag = 1.f / mag;
|
||||
float mag = 1.f / magnitude();
|
||||
*this *= CVector3f(mag);
|
||||
}
|
||||
inline CVector3f normalized() const
|
||||
{
|
||||
float mag = magnitude();
|
||||
mag = 1.f / mag;
|
||||
float mag = 1.f / magnitude();
|
||||
return *this * mag;
|
||||
}
|
||||
inline CVector3f cross(const CVector3f& rhs) const
|
||||
|
@ -298,6 +296,16 @@ public:
|
|||
|
||||
inline float magnitude() const { return sqrtF(magSquared()); }
|
||||
|
||||
inline bool isNotInf() const
|
||||
{
|
||||
return !(isinf(x) || isinf(y) || isinf(z));
|
||||
}
|
||||
|
||||
inline bool isMagnitudeSafe() const
|
||||
{
|
||||
return isNotInf() && magSquared() >= 9.9999994e-29;
|
||||
}
|
||||
|
||||
inline void zeroOut()
|
||||
{
|
||||
*this = CVector3f::skZero;
|
||||
|
|
Loading…
Reference in New Issue