diff options
author | Edward Welbourne <edward.welbourne@qt.io> | 2021-09-08 10:05:00 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2021-09-10 13:18:14 +0200 |
commit | bc1edab4570f2c7e8e017f72880322a153de1f9e (patch) | |
tree | 8485bd0c1ca814796fc8441318285e38d563c64c | |
parent | ea97722b666c4bce4e07bc7f69df7a9d5a6d35c3 (diff) |
Use qDegreesToRadians() in preference to hand-rolled macros
Also remove an unused macro, as well as the one that was used.
Change-Id: I230c6ffded0a6db7e25c0a6b8f3f82bf583f4005
Reviewed-by: Mike Krus <mike.krus@kdab.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
-rw-r--r-- | examples/qt3d/qardboard/iosdeviceorientation_p.mm | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/examples/qt3d/qardboard/iosdeviceorientation_p.mm b/examples/qt3d/qardboard/iosdeviceorientation_p.mm index 4e7db4820..f054aaef8 100644 --- a/examples/qt3d/qardboard/iosdeviceorientation_p.mm +++ b/examples/qt3d/qardboard/iosdeviceorientation_p.mm @@ -1,5 +1,6 @@ /**************************************************************************** ** +** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). ** Contact: https://www.qt.io/licensing/ ** @@ -53,10 +54,7 @@ #include "iosdeviceorientation.h" #import "iosdeviceorientation_p.h" - -#define RADIANS_TO_DEGREES(radians) ((radians) * (180.0 / M_PI)) -#define DEGREES_TO_RADIANS(angle) ((angle) / 180.0 * M_PI) - +#include <QtCore/qmath.h> @interface QIOSMotionManager : NSObject { } @@ -146,9 +144,9 @@ // body of the device, with its origin at the center of gravity and directed toward the bottom of the device. CMAttitude *attitude = motion.attitude; - handler->setRoll(90 - RADIANS_TO_DEGREES(attitude.roll)); - handler->setPitch(RADIANS_TO_DEGREES(attitude.pitch)); - handler->setYaw(RADIANS_TO_DEGREES(attitude.yaw)); + handler->setRoll(90 - qRadiansToDegrees(attitude.roll)); + handler->setPitch(qRadiansToDegrees(attitude.pitch)); + handler->setYaw(qRadiansToDegrees(attitude.yaw)); } @end |