Qwt User's Guide 6.3.0
Loading...
Searching...
No Matches
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
22class 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
54Q_DECLARE_TYPEINFO( QwtPoint3D, Q_MOVABLE_TYPE );
55Q_DECLARE_METATYPE( QwtPoint3D )
56
57#ifndef QT_NO_DEBUG_STREAM
58QWT_EXPORT QDebug operator<<( QDebug, const QwtPoint3D& );
59#endif
60
66 : m_x( 0.0 )
67 , m_y( 0.0 )
68 , m_z( 0.0 )
69{
70}
71
73inline 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
84inline QwtPoint3D::QwtPoint3D( const QPointF& other )
85 : m_x( other.x() )
86 , m_y( other.y() )
87 , m_z( 0.0 )
88{
89}
90
97inline bool QwtPoint3D::isNull() const
98{
99 return m_x == 0.0 && m_y == 0.0 && m_z == 0.0;
100}
101
103inline double QwtPoint3D::x() const
104{
105 return m_x;
106}
107
109inline double QwtPoint3D::y() const
110{
111 return m_y;
112}
113
115inline double QwtPoint3D::z() const
116{
117 return m_z;
118}
119
121inline double& QwtPoint3D::rx()
122{
123 return m_x;
124}
125
127inline double& QwtPoint3D::ry()
128{
129 return m_y;
130}
131
133inline double& QwtPoint3D::rz()
134{
135 return m_z;
136}
137
139inline void QwtPoint3D::setX( double x )
140{
141 m_x = x;
142}
143
145inline void QwtPoint3D::setY( double y )
146{
147 m_y = y;
148}
149
151inline void QwtPoint3D::setZ( double z )
152{
153 m_z = z;
154}
155
159inline QPointF QwtPoint3D::toPoint() const
160{
161 return QPointF( m_x, m_y );
162}
163
165inline 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
171inline bool QwtPoint3D::operator!=( const QwtPoint3D& other ) const
172{
173 return !operator==( other );
174}
175
176#endif
QwtPoint3D class defines a 3D point in double coordinates.
double z() const
bool operator==(const QwtPoint3D &) const
double y() const
bool operator!=(const QwtPoint3D &) const
void setY(double y)
Sets the y-coordinate of the point to the value specified by y.
double & rx()
double & ry()
double x() const
void setZ(double y)
Sets the z-coordinate of the point to the value specified by z.
double & rz()
bool isNull() const
QPointF toPoint() const
void setX(double x)
Sets the x-coordinate of the point to the value specified by x.