From e1dc69f56d5725415b2945ecdf72faecd098b67c Mon Sep 17 00:00:00 2001 From: 0penBrain <48731257+0penBrain@users.noreply.github.com> Date: Tue, 21 Sep 2021 19:10:46 +0200 Subject: [PATCH] [Core] Rotation : improve gimbal lock handling Tolerance copied from OCC "gp_Quaternion.cxx" --- src/Base/Rotation.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp index 118a7c6563..646731561d 100644 --- a/src/Base/Rotation.cpp +++ b/src/Base/Rotation.cpp @@ -673,13 +673,13 @@ void Rotation::getYawPitchRoll(double& y, double& p, double& r) const double qd2 = 2.0*(q13-q02); // handle gimbal lock - if (fabs(qd2-1.0) <= DBL_EPSILON) { + if (fabs(qd2-1.0) <= 16 * DBL_EPSILON) { // Tolerance copied from OCC "gp_Quaternion.cxx" // north pole y = 0.0; p = D_PI/2.0; r = 2.0 * atan2(quat[0],quat[3]); } - else if (fabs(qd2+1.0) <= DBL_EPSILON) { + else if (fabs(qd2+1.0) <= 16 * DBL_EPSILON) { // Tolerance copied from OCC "gp_Quaternion.cxx" // south pole y = 0.0; p = -D_PI/2.0;