summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qrect.cpp
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-11-23 12:15:35 +0100
committerEdward Welbourne <edward.welbourne@qt.io>2021-02-04 17:18:38 +0100
commit8c1532eeaae6a220569cef3476d1124399478285 (patch)
treee06e5ec33af3bbe8db8bd008cb2be18068dd7dbc /src/corelib/tools/qrect.cpp
parentd6b9200e329281269ad8c74177f2b2621798ae56 (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/qrect.cpp')
0 files changed, 0 insertions, 0 deletions