From 436ac0b3890ac7ec0dd5cc9ca9f7a099d5e8a813 Mon Sep 17 00:00:00 2001 From: Lorn Potter Date: Thu, 16 Feb 2012 09:27:40 +1000 Subject: sqrt => qSqrt, atan2 => qAtan2 Change-Id: I2da59daada99184a166967fb0fe45fc5bae7eba1 Reviewed-by: Lincoln Ramsay --- src/imports/sensors2/qsensor2tilt.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/imports/sensors2/qsensor2tilt.cpp') diff --git a/src/imports/sensors2/qsensor2tilt.cpp b/src/imports/sensors2/qsensor2tilt.cpp index 8c294f9b..8cf4a617 100644 --- a/src/imports/sensors2/qsensor2tilt.cpp +++ b/src/imports/sensors2/qsensor2tilt.cpp @@ -41,7 +41,7 @@ #include "qsensor2tilt.h" #define _USE_MATH_DEFINES -#include +#include #include #include @@ -266,7 +266,7 @@ qreal QSensor2Tilt::xRotation() */ inline qreal calcPitch(double Ax, double Ay, double Az) { - return (float)-atan2(Ax, sqrt(Ay * Ay + Az * Az)); + return (float)-qAtan2(Ax, sqrt(Ay * Ay + Az * Az)); } /* @@ -277,7 +277,7 @@ inline qreal calcPitch(double Ax, double Ay, double Az) */ inline qreal calcRoll(double Ax, double Ay, double Az) { - return (float)atan2(Ay, (sqrt(Ax * Ax + Az * Az))); + return (float)qAtan2(Ay, (sqrt(Ax * Ax + Az * Az))); } /*! @@ -376,14 +376,14 @@ bool QSensor2Tilt::filter(QAccelerometerReading* reading) //get angle beteen 0 and 180 or 0 -180 qreal aG = 1 * sin(xrot); qreal aK = 1 * cos(xrot); - xrot = atan2(aG, aK); + xrot = qAtan2(aG, aK); if (xrot > M_PI_2) xrot = M_PI - xrot; else if (xrot < -M_PI_2) xrot = -(M_PI + xrot); aG = 1 * sin(yrot); aK = 1 * cos(yrot); - yrot = atan2(aG, aK); + yrot = qAtan2(aG, aK); if (yrot > M_PI_2) yrot = M_PI - yrot; else if (yrot < -M_PI_2) -- cgit v1.2.3