qt5base-lts/tests/auto
Yuya Nishihara 6ffc8d8eb6 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>
2022-01-16 01:12:15 +01:00
..
bic/data Add BC files for 6.2.0 2022-01-07 13:31:38 +00:00
cmake Fix dependency chain that collects the metatype json files 2021-12-02 16:34:23 +01:00
concurrent QtConcurrent::run crashes on program exit 2021-12-20 13:18:26 +01:00
corelib Fix an assertion failure in massageAdjustedDateTime() 2022-01-13 19:47:22 +01:00
dbus tests: Remove unused SRCDIR defines 2021-08-17 12:41:57 +00:00
gui QtGui/math3d: Fix QQuaternion::getEulerAngles for GimbalLock cases 2022-01-16 01:12:15 +01:00
guiapplauncher
network QSslSocket (SecureTransport) add TLS 1.3 ciphersuites 2022-01-12 22:27:21 +01:00
opengl Remove the qmake project files 2021-01-07 15:32:28 +01:00
other QIODevice: use QVLA to hold the ring buffers, not QList 2021-12-15 17:35:13 +00:00
printsupport QtBase: replace windows.h with qt_windows.h 2021-11-23 12:53:46 +08:00
shared Remove false Q_UNREACHABLE from shaping code 2021-02-03 09:44:44 +01:00
sql Adapt SQL drivers to Qt 6 change of QVariant::isNull 2022-01-12 17:41:07 +01:00
testlib Make counts of various types of test result add up correctly 2022-01-13 19:47:22 +01:00
tools QHash: increase minimum buckets to a full span 2021-12-13 18:58:36 +01:00
widgets QCSS: Support Qt 5-style integer property selectors 2022-01-15 19:21:57 +01:00
xml QDomDocument::setContent: Open device if necessary 2021-11-09 18:33:39 +01:00
CMakeLists.txt Don't build tests/auto/tools when cross-compiling 2021-10-07 08:03:40 +02:00
network-settings.h Replace QtTest headers with QTest 2020-12-22 15:20:30 +01:00