Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_point_polar.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (5 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_point_polar.h (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_point_polar.h
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 9 9 10 10 /*! \file */ 11 #ifndef _QWT_POINT_POLAR_H_12 #define _QWT_POINT_POLAR_H_ 111 #ifndef QWT_POINT_POLAR_H 12 #define QWT_POINT_POLAR_H 13 13 14 14 #include "qwt_global.h" 15 15 #include "qwt_math.h" 16 16 17 #include <qpoint.h> 17 #ifndef QT_NO_DEBUG_STREAM 18 #include <qdebug.h> 19 #endif 18 #include <qmetatype.h> 19 #include <qmath.h> 20 20 21 21 /*! 22 \brief A point in polar coordinates 22 \brief A point in polar coordinates 23 23 24 In polar coordinates a point is determined by an angle and a distance. 25 See http://en.wikipedia.org/wiki/Polar_coordinate_system 26 */ 24 In polar coordinates a point is determined by an angle and a distance. 25 See http://en.wikipedia.org/wiki/Polar_coordinate_system 26 */ 27 27 28 28 class QWT_EXPORT QwtPointPolar 29 29 { 30 public: 30 public: 31 31 QwtPointPolar(); 32 32 QwtPointPolar( double azimuth, double radius ); 33 QwtPointPolar( const QPointF & );33 QwtPointPolar( const QPointF& ); 34 34 35 void setPoint( const QPointF & );35 void setPoint( const QPointF& ); 36 36 QPointF toPoint() const; 37 37 … … 42 42 double azimuth() const; 43 43 44 double &rRadius();45 double &rAzimuth();44 double& rRadius(); 45 double& rAzimuth(); 46 46 47 47 void setRadius( double ); 48 48 void setAzimuth( double ); 49 49 50 bool operator==( const QwtPointPolar & ) const;51 bool operator!=( const QwtPointPolar & ) const;50 bool operator==( const QwtPointPolar& ) const; 51 bool operator!=( const QwtPointPolar& ) const; 52 52 53 53 QwtPointPolar normalized() const; 54 54 55 double _value; // Change by LM 55 private: 56 double m_azimuth; 57 double m_radius; 58 }; 56 59 57 private: 58 double d_azimuth; 59 double d_radius; 60 }; 60 Q_DECLARE_TYPEINFO( QwtPointPolar, Q_MOVABLE_TYPE ); 61 Q_DECLARE_METATYPE( QwtPointPolar ) 62 63 #ifndef QT_NO_DEBUG_STREAM 64 QWT_EXPORT QDebug operator<<( QDebug, const QwtPointPolar& ); 65 #endif 61 66 62 67 /*! 63 68 Constructs a null point, with a radius and azimuth set to 0.0. 64 69 \sa QPointF::isNull() 65 */ 66 inline QwtPointPolar::QwtPointPolar() :67 d_azimuth( 0.0 ),68 d_radius( 0.0 )70 */ 71 inline QwtPointPolar::QwtPointPolar() 72 : m_azimuth( 0.0 ) 73 , m_radius( 0.0 ) 69 74 { 70 75 } … … 75 80 \param azimuth Azimuth 76 81 \param radius Radius 77 */ 78 inline QwtPointPolar::QwtPointPolar( double azimuth, double radius ) :79 d_azimuth( azimuth ),80 d_radius( radius )82 */ 83 inline QwtPointPolar::QwtPointPolar( double azimuth, double radius ) 84 : m_azimuth( azimuth ) 85 , m_radius( radius ) 81 86 { 82 87 } … … 85 90 inline bool QwtPointPolar::isValid() const 86 91 { 87 return d_radius >= 0.0;92 return m_radius >= 0.0; 88 93 } 89 94 … … 91 96 inline bool QwtPointPolar::isNull() const 92 97 { 93 return d_radius == 0.0;98 return m_radius == 0.0; 94 99 } 95 100 … … 97 102 inline double QwtPointPolar::radius() const 98 103 { 99 return d_radius;104 return m_radius; 100 105 } 101 106 … … 103 108 inline double QwtPointPolar::azimuth() const 104 109 { 105 return d_azimuth;110 return m_azimuth; 106 111 } 107 112 108 113 //! Returns the radius. 109 inline double &QwtPointPolar::rRadius()114 inline double& QwtPointPolar::rRadius() 110 115 { 111 return d_radius;116 return m_radius; 112 117 } 113 118 114 119 //! Returns the azimuth. 115 inline double &QwtPointPolar::rAzimuth()120 inline double& QwtPointPolar::rAzimuth() 116 121 { 117 return d_azimuth;122 return m_azimuth; 118 123 } 119 124 … … 121 126 inline void QwtPointPolar::setRadius( double radius ) 122 127 { 123 d_radius = radius;128 m_radius = radius; 124 129 } 125 130 126 //! Sets the a timuth to atimuth.131 //! Sets the azimuth to azimuth. 127 132 inline void QwtPointPolar::setAzimuth( double azimuth ) 128 133 { 129 d_azimuth = azimuth;134 m_azimuth = azimuth; 130 135 } 131 136 132 #ifndef QT_NO_DEBUG_STREAM 133 QWT_EXPORT QDebug operator<<( QDebug, const QwtPointPolar & ); 134 #endif 135 136 inline QPoint qwtPolar2Pos( const QPoint &pole, 137 inline QPoint qwtPolar2Pos( const QPoint& pole, 137 138 double radius, double angle ) 138 139 { 139 const double x = pole.x() + radius * qCos( angle );140 const double y = pole.y() - radius * qSin( angle );140 const double x = pole.x() + radius * std::cos( angle ); 141 const double y = pole.y() - radius * std::sin( angle ); 141 142 142 143 return QPoint( qRound( x ), qRound( y ) ); 143 144 } 144 145 145 inline QPoint qwtDegree2Pos( const QPoint &pole,146 inline QPoint qwtDegree2Pos( const QPoint& pole, 146 147 double radius, double angle ) 147 148 { … … 149 150 } 150 151 151 inline QPointF qwtPolar2Pos( const QPointF &pole,152 inline QPointF qwtPolar2Pos( const QPointF& pole, 152 153 double radius, double angle ) 153 154 { 154 const double x = pole.x() + radius * qCos( angle );155 const double y = pole.y() - radius * qSin( angle );155 const double x = pole.x() + radius * std::cos( angle ); 156 const double y = pole.y() - radius * std::sin( angle ); 156 157 157 158 return QPointF( x, y); 158 159 } 159 160 160 inline QPointF qwtDegree2Pos( const QPointF &pole,161 inline QPointF qwtDegree2Pos( const QPointF& pole, 161 162 double radius, double angle ) 162 163 { … … 164 165 } 165 166 166 inline QPointF qwtFastPolar2Pos( const QPointF &pole,167 inline QPointF qwtFastPolar2Pos( const QPointF& pole, 167 168 double radius, double angle ) 168 169 { 169 #if QT_VERSION < 0x040601170 const double x = pole.x() + radius * ::cos( angle );171 const double y = pole.y() - radius * ::sin( angle );172 #else173 170 const double x = pole.x() + radius * qFastCos( angle ); 174 171 const double y = pole.y() - radius * qFastSin( angle ); 175 #endif176 172 177 173 return QPointF( x, y); 178 174 } 179 175 180 inline QPointF qwtFastDegree2Pos( const QPointF &pole,176 inline QPointF qwtFastDegree2Pos( const QPointF& pole, 181 177 double radius, double angle ) 182 178 { … … 184 180 } 185 181 186 inline QwtPointPolar qwtFastPos2Polar( const QPointF &pos )182 inline QwtPointPolar qwtFastPos2Polar( const QPointF& pos ) 187 183 { 188 184 return QwtPointPolar( qwtFastAtan2( pos.y(), pos.x() ),
Note:
See TracChangeset
for help on using the changeset viewer.
