diff options
author | Inho Lee <inho.lee@qt.io> | 2022-04-19 11:30:19 +0200 |
---|---|---|
committer | Inho Lee <inho.lee@qt.io> | 2022-04-27 09:16:29 +0200 |
commit | 8f9049ddbcedbc1f623acb7bfcd2b31c286f4583 (patch) | |
tree | 30fc0e30eb1462e4da778b0ad91395232f895954 | |
parent | 6625a4744ee3b5441d7ebc07e5722df86415c809 (diff) |
Update comments in QQuaternion::getEulerAngles
A comment from the patch 6ffc8d8eb6c44fbd51e37770e7013c4610ead96d
is a little ambiguous. This patch is just to give information
about the modification.
Task-number: QTBUG-72103
Pick-to: 6.3 6.2 5.15
Change-Id: I6bfc3ae926c118de0d969a4b44f438c24f8d4f72
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
-rw-r--r-- | src/gui/math3d/qquaternion.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp index 93e396c5a1..2f12accc41 100644 --- a/src/gui/math3d/qquaternion.cpp +++ b/src/gui/math3d/qquaternion.cpp @@ -495,8 +495,9 @@ void QQuaternion::getEulerAngles(float *pitch, float *yaw, float *roll) const // https://ingmec.ual.es/~jlblanco/papers/jlblanco2010geometry3D_techrep.pdf // "A tutorial on SE(3) transformation parameterizations and on-manifold optimization". - // Normalize values even if the length is below the margin. Otherwise we might fail - // to detect Gimbal lock due to cumulative errors. + // We can only detect Gimbal lock when we normalize, which we can't do when + // length is nearly zero. Do so before multiplying co-ordinates, to avoid + // underflow. const float len = length(); const bool rescale = !qFuzzyIsNull(len); const float xps = rescale ? xp / len : xp; |