diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2020-11-23 12:15:35 +0100 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-02-04 17:18:38 +0100 |
commit | 8c1532eeaae6a220569cef3476d1124399478285 (patch) | |
tree | e06e5ec33af3bbe8db8bd008cb2be18068dd7dbc /src/corelib/tools | |
parent | d6b9200e329281269ad8c74177f2b2621798ae56 (diff) |
Rationalize QQuaternion's length-scaling code
Use qHypot() to implement length(), avoid duplicating its code and use
its result more carefully, saving the need for casting to and from
double.
Subtracting a double from 1.0f still got a double, so the
qFuzzyIsNull() checks were using double's tolerance, where the use of
1.0f indicates the float tolerance would have been more apt. Also, use
qFuzzyCompare(_, 1.0f) instead of qFuzzyIsNull(_ - 1.0f).
In getEulerAngles(), scale co-ordinates by length before multiplying
(to ensure O(1) quantities) rather than scaling the products by the
squared length (possibly after {ov,und}erflowing).
Change-Id: Id8792d6eb047ee9567a9bbb246657b0217b0849f
Reviewed-by: Andreas Buhr <andreas.buhr@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Diffstat (limited to 'src/corelib/tools')
0 files changed, 0 insertions, 0 deletions