Qwt User's Guide 6.2.0

qwt_point_3d.h
1 /******************************************************************************
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
13
14 #include "qwt_global.h"
15 #include <qpoint.h>
16 #include <qmetatype.h>
17
22 class QWT_EXPORT QwtPoint3D
23 {
24 public:
25 QwtPoint3D();
26 QwtPoint3D( double x, double y, double z );
27 QwtPoint3D( const QPointF& );
28
29 bool isNull() const;
30
31 double x() const;
32 double y() const;
33 double z() const;
34
35 double& rx();
36 double& ry();
37 double& rz();
38
39 void setX( double x );
40 void setY( double y );
41 void setZ( double y );
42
43 QPointF toPoint() const;
44
45 bool operator==( const QwtPoint3D& ) const;
46 bool operator!=( const QwtPoint3D& ) const;
47
48 private:
49 double m_x;
50 double m_y;
51 double m_z;
52 };
53
54 Q_DECLARE_TYPEINFO( QwtPoint3D, Q_MOVABLE_TYPE );
55 Q_DECLARE_METATYPE( QwtPoint3D );
56
57 #ifndef QT_NO_DEBUG_STREAM
58 QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D& );
59 #endif
60
65 inline QwtPoint3D::QwtPoint3D()
66 : m_x( 0.0 )
67 , m_y( 0.0 )
68 , m_z( 0.0 )
69 {
70 }
71
73 inline QwtPoint3D::QwtPoint3D( double x, double y, double z = 0.0 )
74 : m_x( x )
75 , m_y( y )
76 , m_z( z )
77 {
78 }
79
84 inline QwtPoint3D::QwtPoint3D( const QPointF& other )
85 : m_x( other.x() )
86 , m_y( other.y() )
87 , m_z( 0.0 )
88 {
89 }
90
97 inline bool QwtPoint3D::isNull() const
98 {
99 return m_x == 0.0 && m_y == 0.0 && m_z == 0.0;
100 }
101
103 inline double QwtPoint3D::x() const
104 {
105 return m_x;
106 }
107
109 inline double QwtPoint3D::y() const
110 {
111 return m_y;
112 }
113
115 inline double QwtPoint3D::z() const
116 {
117 return m_z;
118 }
119
121 inline double& QwtPoint3D::rx()
122 {
123 return m_x;
124 }
125
127 inline double& QwtPoint3D::ry()
128 {
129 return m_y;
130 }
131
133 inline double& QwtPoint3D::rz()
134 {
135 return m_z;
136 }
137
139 inline void QwtPoint3D::setX( double x )
140 {
141 m_x = x;
142 }
143
145 inline void QwtPoint3D::setY( double y )
146 {
147 m_y = y;
148 }
149
151 inline void QwtPoint3D::setZ( double z )
152 {
153 m_z = z;
154 }
155
159 inline QPointF QwtPoint3D::toPoint() const
160 {
161 return QPointF( m_x, m_y );
162 }
163
165 inline bool QwtPoint3D::operator==( const QwtPoint3D& other ) const
166 {
167 return ( m_x == other.m_x ) && ( m_y == other.m_y ) && ( m_z == other.m_z );
168 }
169
171 inline bool QwtPoint3D::operator!=( const QwtPoint3D& other ) const
172 {
173 return !operator==( other );
174 }
175
176 #endif
QwtPoint3D
QwtPoint3D class defines a 3D point in double coordinates.
Definition: qwt_point_3d.h:23
QwtPoint3D::z
double z() const
Definition: qwt_point_3d.h:115
QwtPoint3D::operator==
bool operator==(const QwtPoint3D &) const
Definition: qwt_point_3d.h:165
QwtPoint3D::y
double y() const
Definition: qwt_point_3d.h:109
QwtPoint3D::operator!=
bool operator!=(const QwtPoint3D &) const
Definition: qwt_point_3d.h:171
QwtPoint3D::setY
void setY(double y)
Sets the y-coordinate of the point to the value specified by y.
Definition: qwt_point_3d.h:145
QwtPoint3D::rx
double & rx()
Definition: qwt_point_3d.h:121
QwtPoint3D::ry
double & ry()
Definition: qwt_point_3d.h:127
QwtPoint3D::x
double x() const
Definition: qwt_point_3d.h:103
QwtPoint3D::QwtPoint3D
QwtPoint3D()
Definition: qwt_point_3d.h:65
QwtPoint3D::setZ
void setZ(double y)
Sets the z-coordinate of the point to the value specified by z.
Definition: qwt_point_3d.h:151
QwtPoint3D::rz
double & rz()
Definition: qwt_point_3d.h:133
QwtPoint3D::isNull
bool isNull() const
Definition: qwt_point_3d.h:97
QwtPoint3D::toPoint
QPointF toPoint() const
Definition: qwt_point_3d.h:159
QwtPoint3D::setX
void setX(double x)
Sets the x-coordinate of the point to the value specified by x.
Definition: qwt_point_3d.h:139