From 0e80d2ff3278d1a0c9ef46d7870b8c94bc81cbd7 Mon Sep 17 00:00:00 2001 From: Daniel Chappuis Date: Mon, 15 Jun 2020 22:11:23 +0200 Subject: [PATCH] Edit tolerance value in Quaternion::isValid() method --- include/reactphysics3d/mathematics/Quaternion.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/reactphysics3d/mathematics/Quaternion.h b/include/reactphysics3d/mathematics/Quaternion.h index fcb5baee..8db5682d 100644 --- a/include/reactphysics3d/mathematics/Quaternion.h +++ b/include/reactphysics3d/mathematics/Quaternion.h @@ -307,8 +307,9 @@ inline bool Quaternion::isFinite() const { // Return true if it is a unit quaternion inline bool Quaternion::isUnit() const { - decimal length = std::sqrt(x*x + y*y + z*z + w*w); - return std::abs(length - decimal(1.0)) < MACHINE_EPSILON; + const decimal length = std::sqrt(x*x + y*y + z*z + w*w); + const decimal tolerance = 1e-5f; + return std::abs(length - decimal(1.0)) < tolerance; } // Return true if it is a valid quaternion