summaryrefslogtreecommitdiffstats
path: root/src/corelib/Qt6CoreMacros.cmake
diff options
context:
space:
mode:
authorYuya Nishihara <yuya@tcha.org>2021-08-01 14:02:27 +0900
committerInho Lee <inho.lee@qt.io>2022-01-16 01:12:15 +0100
commit6ffc8d8eb6c44fbd51e37770e7013c4610ead96d (patch)
treecb915e45be2b701ed8bda4a92b8f6f86e3139101 /src/corelib/Qt6CoreMacros.cmake
parent6852c20502ffc78ad76924630d9021552287e35d (diff)
QtGui/math3d: Fix QQuaternion::getEulerAngles for GimbalLock cases
This is heavily inspired by the patch written by Inho Lee <inho.lee@qt.io>, which says "There is a precision problem in the previous algorithm when checking pitch value. (In the case that the rotation on the X-axis makes Gimbal lock.)" In order to work around the precision problem, this patch does: 1. switch to the algorithm described in the inline comment to make the story simple. 2. forcibly normalize the {x, y, z, w} components to eliminate fractional errors. 3. set threshold to avoid hidden division by cos(pitch) =~ 0. From my testing which compares dot product of the original quaternion and the one recreated from Euler angles, calculation within float range seems okay. (abs(normalize(q_orig) * normalize(q_roundtrip)) >= 0.99999) Many thanks to Inho Lee for the original patch and discussion about rounding errors. Fixes: QTBUG-72103 Pick-to: 6.3 6.2 5.15 Change-Id: I8995e4affe603111ff2303a0dfcbdb0b1ae03f10 Reviewed-by: Yuya Nishihara <yuya@tcha.org> Reviewed-by: Inho Lee <inho.lee@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/corelib/Qt6CoreMacros.cmake')
0 files changed, 0 insertions, 0 deletions