28#ifndef QWT_POINT_POLAR_H
29#define QWT_POINT_POLAR_H
31#include "qwt_global.h"
58 void setPoint(
const QPointF& );
59 QPointF toPoint()
const;
64 double radius()
const;
65 double azimuth()
const;
70 void setRadius(
double );
71 void setAzimuth(
double );
86#ifndef QT_NO_DEBUG_STREAM
119 : m_azimuth( azimuth )
127 return m_radius >= 0.0;
133 return m_radius == 0.0;
172inline QPoint qwtPolar2Pos(
const QPoint& pole,
173 double radius,
double angle )
175 const double x = pole.x() + radius * std::cos( angle );
176 const double y = pole.y() - radius * std::sin( angle );
178 return QPoint( qRound( x ), qRound( y ) );
181inline QPoint qwtDegree2Pos(
const QPoint& pole,
182 double radius,
double angle )
184 return qwtPolar2Pos( pole, radius, angle / 180.0 * M_PI );
187inline QPointF qwtPolar2Pos(
const QPointF& pole,
188 double radius,
double angle )
190 const double x = pole.x() + radius * std::cos( angle );
191 const double y = pole.y() - radius * std::sin( angle );
193 return QPointF( x, y);
196inline QPointF qwtDegree2Pos(
const QPointF& pole,
197 double radius,
double angle )
199 return qwtPolar2Pos( pole, radius, angle / 180.0 * M_PI );
202inline QPointF qwtFastPolar2Pos(
const QPointF& pole,
203 double radius,
double angle )
205 const double x = pole.x() + radius * qFastCos( angle );
206 const double y = pole.y() - radius * qFastSin( angle );
208 return QPointF( x, y);
211inline QPointF qwtFastDegree2Pos(
const QPointF& pole,
212 double radius,
double angle )
214 return qwtFastPolar2Pos( pole, radius, angle / 180.0 * M_PI );
220 qSqrt( qwtSqr( pos.x() ) + qwtSqr( pos.y() ) ) );
A point in polar coordinates.
Definition qwt_point_polar.h:52
double radius() const
Return the radius
Definition qwt_point_polar.h:137
void setRadius(double)
Set the radius to radius
Definition qwt_point_polar.h:161
void setAzimuth(double)
Set the azimuth to azimuth
Definition qwt_point_polar.h:167
QwtPointPolar()
Default constructor - constructs a null point with radius and azimuth set to 0.0.
Definition qwt_point_polar.h:100
bool isValid() const
Return true if radius() >= 0.0
Definition qwt_point_polar.h:125
double azimuth() const
Return the azimuth
Definition qwt_point_polar.h:143
bool isNull() const
Return true if radius() == 0.0
Definition qwt_point_polar.h:131
double & rRadius()
Return a reference to the radius
Definition qwt_point_polar.h:149
double & rAzimuth()
Return a reference to the azimuth
Definition qwt_point_polar.h:155