From bc1edab4570f2c7e8e017f72880322a153de1f9e Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 8 Sep 2021 10:05:00 +0200 Subject: 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 Reviewed-by: Qt CI Bot --- examples/qt3d/qardboard/iosdeviceorientation_p.mm | 12 +++++------- 1 file 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 @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 -- cgit v1.2.3