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()
|
inline void normalize()
|
||||||
{
|
{
|
||||||
float mag = magnitude();
|
float mag = 1.f / magnitude();
|
||||||
mag = 1.f / mag;
|
|
||||||
*this *= CVector3f(mag);
|
*this *= CVector3f(mag);
|
||||||
}
|
}
|
||||||
inline CVector3f normalized() const
|
inline CVector3f normalized() const
|
||||||
{
|
{
|
||||||
float mag = magnitude();
|
float mag = 1.f / magnitude();
|
||||||
mag = 1.f / mag;
|
|
||||||
return *this * mag;
|
return *this * mag;
|
||||||
}
|
}
|
||||||
inline CVector3f cross(const CVector3f& rhs) const
|
inline CVector3f cross(const CVector3f& rhs) const
|
||||||
|
@ -298,6 +296,16 @@ public:
|
||||||
|
|
||||||
inline float magnitude() const { return sqrtF(magSquared()); }
|
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()
|
inline void zeroOut()
|
||||||
{
|
{
|
||||||
*this = CVector3f::skZero;
|
*this = CVector3f::skZero;
|
||||||
|
|
Loading…
Reference in New Issue