Minor fixes

This commit is contained in:
Phillip Stephens 2020-03-03 16:47:59 -08:00
parent bf416af1ed
commit 82c2a2d85b
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
2 changed files with 6 additions and 6 deletions

View File

@ -152,12 +152,12 @@ public:
static CVector3f slerp(const CVector3f& a, const CVector3f& b, CRelAngle clampAngle);
bool isNormalized() const { return std::fabs(1.f - magSquared()) < 0.01f; }
bool isNormalized() const { return std::fabs(1.f - magSquared()) <= FLT_EPSILON; }
bool canBeNormalized() const {
if (std::isinf(x()) || std::isinf(y()) || std::isinf(z()))
return false;
return std::fabs(x()) >= FLT_EPSILON || std::fabs(y()) >= FLT_EPSILON || std::fabs(z()) >= FLT_EPSILON;
return !(std::fabs(x()) < FLT_EPSILON && std::fabs(y()) < FLT_EPSILON && std::fabs(z()) < FLT_EPSILON);
}
bool isZero() const { return magSquared() <= FLT_EPSILON; }

View File

@ -157,15 +157,15 @@ typename std::enable_if<std::is_enum<E>::value, int>::type PopCount(E e) {
return PopCount(static_cast<typename std::underlying_type<E>::type>(e));
}
bool close_enough(const CVector3f& a, const CVector3f& b, float epsilon = 0.000099999997f);
bool close_enough(const CVector3f& a, const CVector3f& b, float epsilon = FLT_EPSILON);
bool close_enough(const CVector2f& a, const CVector2f& b, float epsilon = 0.000099999997f);
bool close_enough(const CVector2f& a, const CVector2f& b, float epsilon = FLT_EPSILON);
inline bool close_enough(float a, float b, double epsilon = 0.000009999999747378752) {
inline bool close_enough(float a, float b, double epsilon = FLT_EPSILON) {
return std::fabs(a - b) < epsilon;
}
inline bool close_enough(double a, double b, double epsilon = 0.000009999999747378752) {
inline bool close_enough(double a, double b, double epsilon = FLT_EPSILON) {
return std::fabs(a - b) < epsilon;
}
} // namespace zeus