diff options
author | Allan Sandfeld Jensen <allan.jensen@theqtcompany.com> | 2015-02-13 12:02:19 +0100 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-02-19 10:49:03 +0000 |
commit | 373ce8878321aa561b55131bada78ad4a2ce8427 (patch) | |
tree | 0b64429ea79163f1f13b4073bbe60040047d0540 /src/particles/qquickfriction.cpp | |
parent | 6f264b755501fd322d1e357187b42120210a7ba3 (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/qquickfriction.cpp')
-rw-r--r-- | src/particles/qquickfriction.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/particles/qquickfriction.cpp b/src/particles/qquickfriction.cpp index 84f6d5a80d..8f46575e1c 100644 --- a/src/particles/qquickfriction.cpp +++ b/src/particles/qquickfriction.cpp @@ -32,7 +32,7 @@ ****************************************************************************/ #include "qquickfriction_p.h" -#include <math.h> +#include <qmath.h> QT_BEGIN_NAMESPACE /*! @@ -87,16 +87,16 @@ bool QQuickFrictionAffector::affectParticle(QQuickParticleData *d, qreal dt) if (sign(curVY) != sign(newVY)) newVY = 0; } else { - qreal curMag = sqrt(curVX*curVX + curVY*curVY); + qreal curMag = qSqrt(curVX*curVX + curVY*curVY); if (curMag <= m_threshold + epsilon) return false; - qreal newMag = sqrt(newVX*newVX + newVY*newVY); + qreal newMag = qSqrt(newVX*newVX + newVY*newVY); if (newMag <= m_threshold + epsilon || //went past the threshold, stop there instead sign(curVX) != sign(newVX) || //went so far past maybe it came out the other side! sign(curVY) != sign(newVY)) { - qreal theta = atan2(curVY, curVX); - newVX = m_threshold * cos(theta); - newVY = m_threshold * sin(theta); + qreal theta = qAtan2(curVY, curVX); + newVX = m_threshold * qCos(theta); + newVY = m_threshold * qSin(theta); } } |