aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickangledirection.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-02-13 12:02:19 +0100
committerSean Harmer <sean.harmer@kdab.com>2015-02-19 10:49:03 +0000
commit373ce8878321aa561b55131bada78ad4a2ce8427 (patch)
tree0b64429ea79163f1f13b4073bbe60040047d0540 /src/particles/qquickangledirection.cpp
parent6f264b755501fd322d1e357187b42120210a7ba3 (diff)
Cleanup math function includes and usage
Use std::math on floats and doubles, and qMath on qreals, and only include the math headers actually needed. Change-Id: I1d511d7b1bac0050eaa947c7baee760b736858bf Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/particles/qquickangledirection.cpp')
-rw-r--r--src/particles/qquickangledirection.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/particles/qquickangledirection.cpp b/src/particles/qquickangledirection.cpp
index 81c92f8bfa..3fa5d21108 100644
--- a/src/particles/qquickangledirection.cpp
+++ b/src/particles/qquickangledirection.cpp
@@ -33,10 +33,8 @@
#include "qquickangledirection_p.h"
#include <stdlib.h>
-#include <cmath>
-#ifdef Q_OS_QNX
-#include <math.h>
-#endif
+#include <qmath.h>
+
QT_BEGIN_NAMESPACE
const qreal CONV = 0.017453292519943295;
/*!
@@ -106,8 +104,8 @@ const QPointF QQuickAngleDirection::sample(const QPointF &from)
QPointF ret;
qreal theta = m_angle*CONV - m_angleVariation*CONV + rand()/float(RAND_MAX) * m_angleVariation*CONV * 2;
qreal mag = m_magnitude- m_magnitudeVariation + rand()/float(RAND_MAX) * m_magnitudeVariation * 2;
- ret.setX(mag * cos(theta));
- ret.setY(mag * sin(theta));
+ ret.setX(mag * qCos(theta));
+ ret.setY(mag * qSin(theta));
return ret;
}