QGIS API Documentation  2.99.0-Master (f867b65)
Vector3D.h
Go to the documentation of this file.
1 /***************************************************************************
2  Vector3D.h - description
3  -------------------
4  copyright : (C) 2004 by Marco Hugentobler
5  email : [email protected]
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 
17 #ifndef VECTOR3D_H
18 #define VECTOR3D_H
19 
20 #include <cmath>
21 #include "qgis_analysis.h"
22 
29 class ANALYSIS_EXPORT Vector3D
30 {
31  protected:
33  double mX;
35  double mY;
37  double mZ;
38 
39  public:
41  Vector3D( double x, double y, double z );
43  Vector3D();
44 
45  bool operator==( const Vector3D &v ) const;
46  bool operator!=( const Vector3D &v ) const;
48  double getX() const;
50  double getY() const;
52  double getZ() const;
54  double getLength() const;
56  void setX( double x );
58  void setY( double y );
60  void setZ( double z );
62  void standardise();
63 
64  private:
65 #ifdef SIP_RUN
66  Vector3D( const Vector3D &v );
67 #endif
68 };
69 
70 #ifndef SIP_RUN
71 
72 //------------------------------------------constructors------------------------------------
73 
74 inline Vector3D::Vector3D( double x, double y, double z )
75  : mX( x )
76  , mY( y )
77  , mZ( z )
78 {
79 
80 }
81 
83  : mX( 0 )
84  , mY( 0 )
85  , mZ( 0 )//using a list
86 {
87 
88 }
89 
90 //-------------------------------------------setter and getters-------------------------------
91 
92 inline double Vector3D::getX() const
93 {
94  return mX;
95 }
96 
97 inline double Vector3D::getY() const
98 {
99  return mY;
100 }
101 
102 inline double Vector3D::getZ() const
103 {
104  return mZ;
105 }
106 
107 inline void Vector3D::setX( double x )
108 {
109  mX = x;
110 }
111 
112 inline void Vector3D::setY( double y )
113 {
114  mY = y;
115 }
116 
117 inline void Vector3D::setZ( double z )
118 {
119  mZ = z;
120 }
121 
122 #endif
123 #endif
void setX(double x)
Sets the x-component of the vector.
Definition: Vector3D.h:107
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
double getZ() const
Returns the z-component of the vector.
Definition: Vector3D.h:102
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
Definition: Vector3D.h:29
void setZ(double z)
Sets the z-component of the vector.
Definition: Vector3D.h:117
double mX
X-component of the vector.
Definition: Vector3D.h:33
double mZ
Z-component of the vector.
Definition: Vector3D.h:37
double getY() const
Returns the y-component of the vector.
Definition: Vector3D.h:97
double mY
Y-component of the vector.
Definition: Vector3D.h:35
void setY(double y)
Sets the y-component of the vector.
Definition: Vector3D.h:112
Vector3D()
Default constructor.
Definition: Vector3D.h:82
double getX() const
Returns the x-component of the vector.
Definition: Vector3D.h:92