12 #if QT_VERSION >= 0x050200 23 static const struct RegisterQwtPointPolar
25 inline RegisterQwtPointPolar()
27 qRegisterMetaType< QwtPointPolar >();
29 #if QT_VERSION >= 0x050200 30 QMetaType::registerConverter< QPointF, QwtPointPolar >( qwtPointToPolar );
35 } qwtRegisterQwtPointPolar;
46 m_radius = std::sqrt(
qwtSqr( p.x() ) +
qwtSqr( p.y() ) );
47 m_azimuth = std::atan2( p.y(), p.x() );
56 m_radius = std::sqrt(
qwtSqr( p.x() ) +
qwtSqr( p.y() ) );
57 m_azimuth = std::atan2( p.y(), p.x() );
70 if ( m_radius <= 0.0 )
71 return QPointF( 0.0, 0.0 );
73 const double x = m_radius * std::cos( m_azimuth );
74 const double y = m_radius * std::sin( m_azimuth );
76 return QPointF( x, y );
120 const double radius =
qwtMaxF( m_radius, 0.0 );
122 double azimuth = m_azimuth;
123 if ( azimuth < -2.0 * M_PI || azimuth >= 2 *
M_PI )
124 azimuth = std::fmod( m_azimuth, 2 *
M_PI );
132 #ifndef QT_NO_DEBUG_STREAM 138 debug.nospace() <<
"QwtPointPolar(" 141 return debug.space();
A point in polar coordinates.
double radius() const
Returns the radius.
QWT_CONSTEXPR float qwtMaxF(float a, float b)
bool operator==(const QwtPointPolar &) const
Compare 2 points.
void setPoint(const QPointF &)
QwtPointPolar normalized() const
QDebug operator<<(QDebug debug, const QwtPointPolar &point)
double azimuth() const
Returns the azimuth.
bool operator!=(const QwtPointPolar &) const
double qwtSqr(double x)
Return the square of a number.