From b94b2cdd02bfe0647031c89f116e26d06337dffe Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Sat, 18 Nov 2017 01:17:40 -0800 Subject: [PATCH] Fix `CVector3f::canBeNormalized` --- include/zeus/CVector3f.hpp | 5 ++++- include/zeus/Math.hpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/include/zeus/CVector3f.hpp b/include/zeus/CVector3f.hpp index 6087b3a..d172516 100644 --- a/include/zeus/CVector3f.hpp +++ b/include/zeus/CVector3f.hpp @@ -341,7 +341,10 @@ public: inline bool isNormalized() const { return std::fabs(1.f - magSquared()) < 0.01f; } - inline bool canBeNormalized() const { return !isNormalized(); } + inline bool canBeNormalized() const + { + return (x < FLT_EPSILON || y < FLT_EPSILON || z < FLT_EPSILON); + } inline bool isZero() const { return magSquared() <= 1.1920929e-7f; } diff --git a/include/zeus/Math.hpp b/include/zeus/Math.hpp index 726fafa..b573de2 100644 --- a/include/zeus/Math.hpp +++ b/include/zeus/Math.hpp @@ -1,6 +1,7 @@ #ifndef MATH_HPP #define MATH_HPP +#include #undef min #undef max