28#ifndef QWT_POINT_POLAR_H
29#define QWT_POINT_POLAR_H
31#include "qwtcore_global.h"
51 void setPoint(
const QPointF&);
52 QPointF toPoint()
const;
54 bool isValid()
const noexcept;
55 bool isNull()
const noexcept;
57 double radius()
const noexcept;
58 double azimuth()
const noexcept;
60 double& rRadius()
noexcept;
61 double& rAzimuth()
noexcept;
63 void setRadius(
double)
noexcept;
64 void setAzimuth(
double)
noexcept;
72 double m_azimuth { 0.0 };
73 double m_radius { 0.0 };
79#ifndef QT_NO_DEBUG_STREAM
80QWTCORE_EXPORT QDebug operator<<(QDebug,
const QwtPointPolar&);
103 return m_radius >= 0.0;
109 return m_radius == 0.0;
148inline QPoint qwtPolar2Pos(
const QPoint& pole,
double radius,
double angle)
150 const double x = pole.x() + radius * std::cos(angle);
151 const double y = pole.y() - radius * std::sin(angle);
153 return QPoint(qRound(x), qRound(y));
156inline QPoint qwtDegree2Pos(
const QPoint& pole,
double radius,
double angle)
158 return qwtPolar2Pos(pole, radius, angle / 180.0 * M_PI);
161inline QPointF qwtPolar2Pos(
const QPointF& pole,
double radius,
double angle)
163 const double x = pole.x() + radius * std::cos(angle);
164 const double y = pole.y() - radius * std::sin(angle);
166 return QPointF(x, y);
169inline QPointF qwtDegree2Pos(
const QPointF& pole,
double radius,
double angle)
171 return qwtPolar2Pos(pole, radius, angle / 180.0 * M_PI);
174inline QPointF qwtFastPolar2Pos(
const QPointF& pole,
double radius,
double angle)
176 const double x = pole.x() + radius * qFastCos(angle);
177 const double y = pole.y() - radius * qFastSin(angle);
179 return QPointF(x, y);
182inline QPointF qwtFastDegree2Pos(
const QPointF& pole,
double radius,
double angle)
184 return qwtFastPolar2Pos(pole, radius, angle / 180.0 * M_PI);
189 return QwtPointPolar(qwtFastAtan2(pos.y(), pos.x()), qSqrt(qwtSqr(pos.x()) + qwtSqr(pos.y())));
A point in polar coordinates
Definition qwt_point_polar.h:45
QwtPointPolar()
Default constructor - constructs a null point with radius and azimuth set to 0.0
Definition qwt_point_polar.h:87
bool isNull() const noexcept
Return true if radius() == 0.0
Definition qwt_point_polar.h:107
double & rAzimuth() noexcept
Return a reference to the azimuth
Definition qwt_point_polar.h:131
double & rRadius() noexcept
Return a reference to the radius
Definition qwt_point_polar.h:125
void setRadius(double) noexcept
Set the radius to radius
Definition qwt_point_polar.h:137
double azimuth() const noexcept
Return the azimuth
Definition qwt_point_polar.h:119
void setAzimuth(double) noexcept
Set the azimuth to azimuth
Definition qwt_point_polar.h:143
double radius() const noexcept
Return the radius
Definition qwt_point_polar.h:113
bool isValid() const noexcept
Return true if radius() >= 0.0
Definition qwt_point_polar.h:101