00001
00002
00003
00004
00005
00006
00007
00008
00009
00011 #ifndef QWT_DOUBLE_POINT_3D_H
00012 #define QWT_DOUBLE_POINT_3D_H 1
00013
00014 #include "qwt_global.h"
00015 #include <qpoint.h>
00016
00021 class QWT_EXPORT QwtDoublePoint3D
00022 {
00023 public:
00024 QwtDoublePoint3D();
00025 QwtDoublePoint3D(double x, double y, double z);
00026 QwtDoublePoint3D(const QwtDoublePoint3D &);
00027 QwtDoublePoint3D(const QPointF &);
00028
00029 bool isNull() const;
00030
00031 double x() const;
00032 double y() const;
00033 double z() const;
00034
00035 double &rx();
00036 double &ry();
00037 double &rz();
00038
00039 void setX(double x);
00040 void setY(double y);
00041 void setZ(double y);
00042
00043 QPointF toPoint() const;
00044
00045 bool operator==(const QwtDoublePoint3D &) const;
00046 bool operator!=(const QwtDoublePoint3D &) const;
00047
00048 private:
00049 double d_x;
00050 double d_y;
00051 double d_z;
00052 };
00053
00058 inline QwtDoublePoint3D::QwtDoublePoint3D():
00059 d_x(0.0),
00060 d_y(0.0),
00061 d_z(0.0)
00062 {
00063 }
00064
00066 inline QwtDoublePoint3D::QwtDoublePoint3D(double x, double y, double z = 0.0):
00067 d_x(x),
00068 d_y(y),
00069 d_z(z)
00070 {
00071 }
00072
00077 inline QwtDoublePoint3D::QwtDoublePoint3D(const QwtDoublePoint3D &other):
00078 d_x(other.d_x),
00079 d_y(other.d_y),
00080 d_z(other.d_z)
00081 {
00082 }
00083
00088 inline QwtDoublePoint3D::QwtDoublePoint3D(const QPointF &other):
00089 d_x(other.x()),
00090 d_y(other.y()),
00091 d_z(0.0)
00092 {
00093 }
00094
00101 inline bool QwtDoublePoint3D::isNull() const
00102 {
00103 return d_x == 0.0 && d_y == 0.0 && d_z == 0;
00104 }
00105
00107 inline double QwtDoublePoint3D::x() const
00108 {
00109 return d_x;
00110 }
00111
00113 inline double QwtDoublePoint3D::y() const
00114 {
00115 return d_y;
00116 }
00117
00119 inline double QwtDoublePoint3D::z() const
00120 {
00121 return d_z;
00122 }
00123
00125 inline double &QwtDoublePoint3D::rx()
00126 {
00127 return d_x;
00128 }
00129
00131 inline double &QwtDoublePoint3D::ry()
00132 {
00133 return d_y;
00134 }
00135
00137 inline double &QwtDoublePoint3D::rz()
00138 {
00139 return d_z;
00140 }
00141
00143 inline void QwtDoublePoint3D::setX(double x)
00144 {
00145 d_x = x;
00146 }
00147
00149 inline void QwtDoublePoint3D::setY(double y)
00150 {
00151 d_y = y;
00152 }
00153
00155 inline void QwtDoublePoint3D::setZ(double z)
00156 {
00157 d_z = z;
00158 }
00159
00163 inline QPointF QwtDoublePoint3D::toPoint() const
00164 {
00165 return QPointF(d_x, d_y);
00166 }
00167
00169 inline bool QwtDoublePoint3D::operator==(const QwtDoublePoint3D &other) const
00170 {
00171 return (d_x == other.d_x) && (d_y == other.d_y) && (d_z == other.d_z);
00172 }
00173
00175 inline bool QwtDoublePoint3D::operator!=(const QwtDoublePoint3D &other) const
00176 {
00177 return !operator==(other);
00178 }
00179
00180 #endif