From d601ed62f96cb07a0663e2281f2ec9d651cf73fa Mon Sep 17 00:00:00 2001 From: Luke Street Date: Fri, 21 Oct 2022 00:48:12 -0400 Subject: [PATCH] Simplify CVector3f::IsMagnitudeSafe Former-commit-id: 9dacbaf36c0bc8f96199b7d7d95f6f78219ee03b --- src/Kyoto/Math/CVector3f.cpp | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/Kyoto/Math/CVector3f.cpp b/src/Kyoto/Math/CVector3f.cpp index 7189ef38..17734a0a 100644 --- a/src/Kyoto/Math/CVector3f.cpp +++ b/src/Kyoto/Math/CVector3f.cpp @@ -38,11 +38,9 @@ CVector3f CVector3f::Slerp(const CVector3f& a, const CVector3f& b, const CRelAng CVector3f& CVector3f::Normalize() { float mag = 1.f / Magnitude(); - mX *= mag; mY *= mag; mZ *= mag; - return *this; } @@ -65,7 +63,6 @@ bool CVector3f::IsNotInf() const { int x = __HI(mX); int y = __HI(mY); int z = __HI(mZ); - if ((x & 0x7f800000) == 0x7f800000 || (y & 0x7f800000) == 0x7f800000 || (z & 0x7f800000) == 0x7f800000) { return false; @@ -74,14 +71,7 @@ bool CVector3f::IsNotInf() const { return true; } -bool CVector3f::IsMagnitudeSafe() const { - bool ret = false; - if (IsNotInf() && mX * mX + mY * mY + mZ * mZ >= 9.999999e-29f) { - ret = true; - } - - return ret; -} +bool CVector3f::IsMagnitudeSafe() const { return IsNotInf() && MagSquared() >= 9.999999e-29f; } bool CVector3f::CanBeNormalized() const { int x = __HI(mX);