Qwt User's Guide 6.1.3

- Main Page
- Classes

qwt_point_3d.h
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *****************************************************************************/
9
11 #ifndef QWT_POINT_3D_H
12 #define QWT_POINT_3D_H 1
13
14 #include "qwt_global.h"
15 #include <qpoint.h>
16 #ifndef QT_NO_DEBUG_STREAM
17 #include <qdebug.h>
18 #endif
19
24 class QWT_EXPORT QwtPoint3D
25 {
26 public:
27 QwtPoint3D();
28 QwtPoint3D( double x, double y, double z );
29 QwtPoint3D( const QwtPoint3D & );
30 QwtPoint3D( const QPointF & );
31
32 bool isNull() const;
33
34 double x() const;
35 double y() const;
36 double z() const;
37
38 double &rx();
39 double &ry();
40 double &rz();
41
42 void setX( double x );
43 void setY( double y );
44 void setZ( double y );
45
46 QPointF toPoint() const;
47
48 bool operator==( const QwtPoint3D & ) const;
49 bool operator!=( const QwtPoint3D & ) const;
50
51 private:
52 double d_x;
53 double d_y;
54 double d_z;
55 };
56
57 Q_DECLARE_TYPEINFO(QwtPoint3D, Q_MOVABLE_TYPE);
58
59 #ifndef QT_NO_DEBUG_STREAM
60 QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D & );
61 #endif
62
67 inline QwtPoint3D::QwtPoint3D():
68 d_x( 0.0 ),
69 d_y( 0.0 ),
70 d_z( 0.0 )
71 {
72 }
73
75 inline QwtPoint3D::QwtPoint3D( double x, double y, double z = 0.0 ):
76 d_x( x ),
77 d_y( y ),
78 d_z( z )
79 {
80 }
81
86 inline QwtPoint3D::QwtPoint3D( const QwtPoint3D &other ):
87 d_x( other.d_x ),
88 d_y( other.d_y ),
89 d_z( other.d_z )
90 {
91 }
92
97 inline QwtPoint3D::QwtPoint3D( const QPointF &other ):
98 d_x( other.x() ),
99 d_y( other.y() ),
100 d_z( 0.0 )
101 {
102 }
103
110 inline bool QwtPoint3D::isNull() const
111 {
112 return d_x == 0.0 && d_y == 0.0 && d_z == 0.0;
113 }
114
116 inline double QwtPoint3D::x() const
117 {
118 return d_x;
119 }
120
122 inline double QwtPoint3D::y() const
123 {
124 return d_y;
125 }
126
128 inline double QwtPoint3D::z() const
129 {
130 return d_z;
131 }
132
134 inline double &QwtPoint3D::rx()
135 {
136 return d_x;
137 }
138
140 inline double &QwtPoint3D::ry()
141 {
142 return d_y;
143 }
144
146 inline double &QwtPoint3D::rz()
147 {
148 return d_z;
149 }
150
152 inline void QwtPoint3D::setX( double x )
153 {
154 d_x = x;
155 }
156
158 inline void QwtPoint3D::setY( double y )
159 {
160 d_y = y;
161 }
162
164 inline void QwtPoint3D::setZ( double z )
165 {
166 d_z = z;
167 }
168
172 inline QPointF QwtPoint3D::toPoint() const
173 {
174 return QPointF( d_x, d_y );
175 }
176
178 inline bool QwtPoint3D::operator==( const QwtPoint3D &other ) const
179 {
180 return ( d_x == other.d_x ) && ( d_y == other.d_y ) && ( d_z == other.d_z );
181 }
182
184 inline bool QwtPoint3D::operator!=( const QwtPoint3D &other ) const
185 {
186 return !operator==( other );
187 }
188
189 #endif
QwtPoint3D::setY
void setY(double y)
Sets the y-coordinate of the point to the value specified by y.
Definition: qwt_point_3d.h:158
QwtPoint3D::z
double z() const
Definition: qwt_point_3d.h:128
QwtPoint3D::isNull
bool isNull() const
Definition: qwt_point_3d.h:110
QwtPoint3D::operator!=
bool operator!=(const QwtPoint3D &) const
Definition: qwt_point_3d.h:184
QwtPoint3D::setZ
void setZ(double y)
Sets the z-coordinate of the point to the value specified by z.
Definition: qwt_point_3d.h:164
QwtPoint3D::QwtPoint3D
QwtPoint3D()
Definition: qwt_point_3d.h:67
QwtPoint3D::setX
void setX(double x)
Sets the x-coordinate of the point to the value specified by x.
Definition: qwt_point_3d.h:152
QwtPoint3D::y
double y() const
Definition: qwt_point_3d.h:122
QwtPoint3D::toPoint
QPointF toPoint() const
Definition: qwt_point_3d.h:172
QwtPoint3D::rx
double & rx()
Definition: qwt_point_3d.h:134
QwtPoint3D::rz
double & rz()
Definition: qwt_point_3d.h:146
QwtPoint3D::ry
double & ry()
Definition: qwt_point_3d.h:140
QwtPoint3D::x
double x() const
Definition: qwt_point_3d.h:116
QwtPoint3D::operator==
bool operator==(const QwtPoint3D &) const
Definition: qwt_point_3d.h:178
QwtPoint3D
QwtPoint3D class defines a 3D point in double coordinates.
Definition: qwt_point_3d.h:24