[Core] Rotation : fix gimbal lock handling

+ fix Euler representation on GUI
This commit is contained in:
0penBrain
2021-09-12 19:45:28 +02:00
parent 022bb81754
commit cdbf7acc80
2 changed files with 11 additions and 11 deletions

View File

@@ -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;

View File

@@ -347,7 +347,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Around y-axis:</string>
<string>Pitch (around y-axis):</string>
</property>
</widget>
</item>
@@ -360,7 +360,7 @@
</sizepolicy>
</property>
<property name="text">
<string>Around z-axis:</string>
<string>Roll (around x-axis):</string>
</property>
</widget>
</item>
@@ -373,28 +373,28 @@
</sizepolicy>
</property>
<property name="text">
<string>Around x-axis:</string>
<string>Yaw (around z-axis):</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="rollAngle">
<widget class="Gui::QuantitySpinBox" name="yawAngle">
<property name="toolTip">
<string>Rotation around the x-axis</string>
<string>Yaw (around z-axis)</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="pitchAngle">
<property name="toolTip">
<string>Rotation around the y-axis</string>
<string>Pitch (around y-axis)</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="yawAngle">
<widget class="Gui::QuantitySpinBox" name="rollAngle">
<property name="toolTip">
<string>Rotation around the z-axis</string>
<string>Roll (around the x-axis)</string>
</property>
</widget>
</item>
@@ -414,7 +414,7 @@
</item>
<item>
<property name="text">
<string>Euler angles (xy'z'')</string>
<string>Euler angles (zy'x'')</string>
</property>
</item>
</widget>