00001
00002
00003
00004
00005
00006
00007
00008
00009
00011 #ifndef QWT_POINT_3D_H
00012 #define QWT_POINT_3D_H 1
00013
00014 #include "qwt_global.h"
00015 #include <qpoint.h>
00016 #ifndef QT_NO_DEBUG_STREAM
00017 #include <qdebug.h>
00018 #endif
00019
00024 class QWT_EXPORT QwtPoint3D
00025 {
00026 public:
00027 QwtPoint3D();
00028 QwtPoint3D( double x, double y, double z );
00029 QwtPoint3D( const QwtPoint3D & );
00030 QwtPoint3D( const QPointF & );
00031
00032 bool isNull() const;
00033
00034 double x() const;
00035 double y() const;
00036 double z() const;
00037
00038 double &rx();
00039 double &ry();
00040 double &rz();
00041
00042 void setX( double x );
00043 void setY( double y );
00044 void setZ( double y );
00045
00046 QPointF toPoint() const;
00047
00048 bool operator==( const QwtPoint3D & ) const;
00049 bool operator!=( const QwtPoint3D & ) const;
00050
00051 private:
00052 double d_x;
00053 double d_y;
00054 double d_z;
00055 };
00056
00057 #ifndef QT_NO_DEBUG_STREAM
00058 QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D & );
00059 #endif
00060
00065 inline QwtPoint3D::QwtPoint3D():
00066 d_x( 0.0 ),
00067 d_y( 0.0 ),
00068 d_z( 0.0 )
00069 {
00070 }
00071
00073 inline QwtPoint3D::QwtPoint3D( double x, double y, double z = 0.0 ):
00074 d_x( x ),
00075 d_y( y ),
00076 d_z( z )
00077 {
00078 }
00079
00084 inline QwtPoint3D::QwtPoint3D( const QwtPoint3D &other ):
00085 d_x( other.d_x ),
00086 d_y( other.d_y ),
00087 d_z( other.d_z )
00088 {
00089 }
00090
00095 inline QwtPoint3D::QwtPoint3D( const QPointF &other ):
00096 d_x( other.x() ),
00097 d_y( other.y() ),
00098 d_z( 0.0 )
00099 {
00100 }
00101
00108 inline bool QwtPoint3D::isNull() const
00109 {
00110 return d_x == 0.0 && d_y == 0.0 && d_z == 0;
00111 }
00112
00114 inline double QwtPoint3D::x() const
00115 {
00116 return d_x;
00117 }
00118
00120 inline double QwtPoint3D::y() const
00121 {
00122 return d_y;
00123 }
00124
00126 inline double QwtPoint3D::z() const
00127 {
00128 return d_z;
00129 }
00130
00132 inline double &QwtPoint3D::rx()
00133 {
00134 return d_x;
00135 }
00136
00138 inline double &QwtPoint3D::ry()
00139 {
00140 return d_y;
00141 }
00142
00144 inline double &QwtPoint3D::rz()
00145 {
00146 return d_z;
00147 }
00148
00150 inline void QwtPoint3D::setX( double x )
00151 {
00152 d_x = x;
00153 }
00154
00156 inline void QwtPoint3D::setY( double y )
00157 {
00158 d_y = y;
00159 }
00160
00162 inline void QwtPoint3D::setZ( double z )
00163 {
00164 d_z = z;
00165 }
00166
00170 inline QPointF QwtPoint3D::toPoint() const
00171 {
00172 return QPointF( d_x, d_y );
00173 }
00174
00176 inline bool QwtPoint3D::operator==( const QwtPoint3D &other ) const
00177 {
00178 return ( d_x == other.d_x ) && ( d_y == other.d_y ) && ( d_z == other.d_z );
00179 }
00180
00182 inline bool QwtPoint3D::operator!=( const QwtPoint3D &other ) const
00183 {
00184 return !operator==( other );
00185 }
00186
00187 #endif