From cdbf7acc80eb4c559f6259202138cbecc53fc3fb Mon Sep 17 00:00:00 2001
From: 0penBrain <48731257+0penBrain@users.noreply.github.com>
Date: Sun, 12 Sep 2021 19:45:28 +0200
Subject: [PATCH] [Core] Rotation : fix gimbal lock handling
+ fix Euler representation on GUI
---
src/Base/Rotation.cpp | 4 ++--
src/Gui/Placement.ui | 18 +++++++++---------
2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/Base/Rotation.cpp b/src/Base/Rotation.cpp
index ec15219388..118a7c6563 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) <= DBL_EPSILON) {
// 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) <= DBL_EPSILON) {
// south pole
y = 0.0;
p = -D_PI/2.0;
diff --git a/src/Gui/Placement.ui b/src/Gui/Placement.ui
index 844efe6d0a..a8fc09cedd 100644
--- a/src/Gui/Placement.ui
+++ b/src/Gui/Placement.ui
@@ -347,7 +347,7 @@
- Around y-axis:
+ Pitch (around y-axis):
@@ -360,7 +360,7 @@
- Around z-axis:
+ Roll (around x-axis):
@@ -373,28 +373,28 @@
- Around x-axis:
+ Yaw (around z-axis):
-
-
+
- Rotation around the x-axis
+ Yaw (around z-axis)
-
- Rotation around the y-axis
+ Pitch (around y-axis)
-
-
+
- Rotation around the z-axis
+ Roll (around the x-axis)
@@ -414,7 +414,7 @@
-
- Euler angles (xy'z'')
+ Euler angles (zy'x'')