11#ifndef QWT_POINT_POLAR_H
12#define QWT_POINT_POLAR_H
14#include "qwt_global.h"
35 void setPoint(
const QPointF& );
36 QPointF toPoint()
const;
41 double radius()
const;
42 double azimuth()
const;
47 void setRadius(
double );
48 void setAzimuth(
double );
63#ifndef QT_NO_DEBUG_STREAM
84 : m_azimuth( azimuth )
92 return m_radius >= 0.0;
98 return m_radius == 0.0;
137inline QPoint qwtPolar2Pos(
const QPoint& pole,
138 double radius,
double angle )
140 const double x = pole.x() + radius * std::cos( angle );
141 const double y = pole.y() - radius * std::sin( angle );
143 return QPoint( qRound( x ), qRound( y ) );
146inline QPoint qwtDegree2Pos(
const QPoint& pole,
147 double radius,
double angle )
149 return qwtPolar2Pos( pole, radius, angle / 180.0 * M_PI );
152inline QPointF qwtPolar2Pos(
const QPointF& pole,
153 double radius,
double angle )
155 const double x = pole.x() + radius * std::cos( angle );
156 const double y = pole.y() - radius * std::sin( angle );
158 return QPointF( x, y);
161inline QPointF qwtDegree2Pos(
const QPointF& pole,
162 double radius,
double angle )
164 return qwtPolar2Pos( pole, radius, angle / 180.0 * M_PI );
167inline QPointF qwtFastPolar2Pos(
const QPointF& pole,
168 double radius,
double angle )
170 const double x = pole.x() + radius * qFastCos( angle );
171 const double y = pole.y() - radius * qFastSin( angle );
173 return QPointF( x, y);
176inline QPointF qwtFastDegree2Pos(
const QPointF& pole,
177 double radius,
double angle )
179 return qwtFastPolar2Pos( pole, radius, angle / 180.0 * M_PI );
185 qSqrt( qwtSqr( pos.x() ) + qwtSqr( pos.y() ) ) );
A point in polar coordinates.
double radius() const
Returns the radius.
void setRadius(double)
Sets the radius to radius.
void setAzimuth(double)
Sets the azimuth to azimuth.
bool isValid() const
Returns true if radius() >= 0.0.
double azimuth() const
Returns the azimuth.
bool isNull() const
Returns true if radius() >= 0.0.
double & rRadius()
Returns the radius.
double & rAzimuth()
Returns the azimuth.