summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2020-07-21 15:19:41 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2020-07-27 11:23:30 +0200
commitd6537b7aa58693cf19f1a5bfd9d260d8f9f05e5e (patch)
treee699a3ea056812991a39f701305e38614cb2154d /src
parent197ba3e938169f73426c37e969c1529588e2fa26 (diff)
QLine: eliminate M_2PI in favor of qmath.h's radian<->degree converters
Task-number: QTBUG-85700 Change-Id: Ib916af901df518f3a16b3d6d948384f25011f9f6 Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/tools/qline.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/corelib/tools/qline.cpp b/src/corelib/tools/qline.cpp
index 40a69173c4..420ee4b64f 100644
--- a/src/corelib/tools/qline.cpp
+++ b/src/corelib/tools/qline.cpp
@@ -310,11 +310,6 @@ QDataStream &operator>>(QDataStream &stream, QLine &line)
#endif // QT_NO_DATASTREAM
-
-#ifndef M_2PI
-#define M_2PI 6.28318530717958647692528676655900576
-#endif
-
/*!
\class QLineF
\inmodule QtCore
@@ -597,7 +592,7 @@ qreal QLineF::angle() const
const qreal dx = pt2.x() - pt1.x();
const qreal dy = pt2.y() - pt1.y();
- const qreal theta = qAtan2(-dy, dx) * 360.0 / M_2PI;
+ const qreal theta = qRadiansToDegrees(qAtan2(-dy, dx));
const qreal theta_normalized = theta < 0 ? theta + 360 : theta;
@@ -621,7 +616,7 @@ qreal QLineF::angle() const
*/
void QLineF::setAngle(qreal angle)
{
- const qreal angleR = angle * M_2PI / 360.0;
+ const qreal angleR = qDegreesToRadians(angle);
const qreal l = length();
const qreal dx = qCos(angleR) * l;
@@ -643,7 +638,7 @@ void QLineF::setAngle(qreal angle)
*/
QLineF QLineF::fromPolar(qreal length, qreal angle)
{
- const qreal angleR = angle * M_2PI / 360.0;
+ const qreal angleR = qDegreesToRadians(angle);
return QLineF(0, 0, qCos(angleR) * length, -qSin(angleR) * length);
}