9#include "qwt_point_polar.h"
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 );
92 return m_radius == other.m_radius && m_azimuth == other.m_azimuth;
107 return m_radius != other.m_radius || m_azimuth != other.m_azimuth;
120 const double radius = qwtMaxF( m_radius, 0.0 );
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.
double azimuth() const
Returns the azimuth.
void setPoint(const QPointF &)
bool operator!=(const QwtPointPolar &) const
QwtPointPolar normalized() const
bool operator==(const QwtPointPolar &) const
Compare 2 points.