summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/sensors2/qsensor2tilt.cpp10
-rw-r--r--src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp6
-rw-r--r--src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp6
-rw-r--r--src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp4
4 files changed, 13 insertions, 13 deletions
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 <math.h>
+#include <qmath.h>
#include <QtCore/QDebug>
#include <QtCore/QStringList>
@@ -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)
diff --git a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
index 6724190b..e90f52db 100644
--- a/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qpickupsensorgesturerecognizer.cpp
@@ -54,11 +54,11 @@ QT_BEGIN_NAMESPACE
inline qreal calcPitch(double Ax, double Ay, double Az)
{
- return (float)-atan2(Ax, sqrt(Ay * Ay + Az * Az));
+ return (float)-qAtan2(Ax, qSqrt(Ay * Ay + Az * Az));
}
inline qreal calcRoll(double Ax, double Ay, double Az)
{
- return (float)atan2(Ay, (sqrt(Ax * Ax + Az * Az)));
+ return (float)qAtan2(Ay, (qSqrt(Ax * Ax + Az * Az)));
}
QPickupSensorGestureRecognizer::QPickupSensorGestureRecognizer(QObject *parent) :
@@ -176,7 +176,7 @@ qreal QPickupSensorGestureRecognizer::calc(qreal yrot)
qreal aG = 1 * sin(yrot);
qreal 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)
diff --git a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
index ced3a4ec..df99f21a 100644
--- a/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qtwistsensorgesturerecognizer.cpp
@@ -56,12 +56,12 @@ QT_BEGIN_NAMESPACE
// from qsensor2tilt
inline qreal calcPitch(double Ax, double Ay, double Az)
{
- return (float)-atan2(Ax, sqrt(Ay * Ay + Az * Az));
+ return (float)-qAtan2(Ax, qSqrt(Ay * Ay + Az * Az));
}
inline qreal calcRoll(double Ax, double Ay, double Az)
{
- return (float)atan2(Ay, (sqrt(Ax * Ax + Az * Az)));
+ return (float)qAtan2(Ay, (qSqrt(Ax * Ax + Az * Az)));
}
QTwistSensorGestureRecognizer::QTwistSensorGestureRecognizer(QObject *parent) :
@@ -204,7 +204,7 @@ qreal QTwistSensorGestureRecognizer::calc(qreal yrot)
qreal aG = 1 * sin(yrot);
qreal 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)
diff --git a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
index e6ebe191..93e147ad 100644
--- a/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
+++ b/src/plugins/sensorgestures/qtsensors/qwhipsensorgesturerecognizer.cpp
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
inline qreal calcYaw(double Ax, double Ay, double Az)
{
- return (float)atan2(Az, (sqrt(Ax * Ax + Ay * Ay)));
+ return (float)qAtan2(Az, (qSqrt(Ax * Ax + Ay * Ay)));
}
QWhipSensorGestureRecognizer::QWhipSensorGestureRecognizer(QObject *parent) :
@@ -170,7 +170,7 @@ qreal QWhipSensorGestureRecognizer::calc(qreal yrot)
qreal aG = 1 * sin(yrot);
qreal 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)