QGIS API Documentation  3.0.2-Girona (307d082)
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 
23 #define SIP_NO_FILE
24 
33 class ANALYSIS_EXPORT Vector3D
34 {
35  protected:
37  double mX = 0;
39  double mY = 0;
41  double mZ = 0;
42 
43  public:
45  Vector3D( double x, double y, double z );
47  Vector3D() = default;
48 
49  bool operator==( const Vector3D &v ) const;
50  bool operator!=( const Vector3D &v ) const;
52  double getX() const;
54  double getY() const;
56  double getZ() const;
58  double getLength() const;
60  void setX( double x );
62  void setY( double y );
64  void setZ( double z );
66  void standardise();
67 
68  private:
69 #ifdef SIP_RUN
70  Vector3D( const Vector3D &v );
71 #endif
72 };
73 
74 #ifndef SIP_RUN
75 
76 //------------------------------------------constructors------------------------------------
77 
78 inline Vector3D::Vector3D( double x, double y, double z )
79  : mX( x )
80  , mY( y )
81  , mZ( z )
82 {
83 
84 }
85 
86 //-------------------------------------------setter and getters-------------------------------
87 
88 inline double Vector3D::getX() const
89 {
90  return mX;
91 }
92 
93 inline double Vector3D::getY() const
94 {
95  return mY;
96 }
97 
98 inline double Vector3D::getZ() const
99 {
100  return mZ;
101 }
102 
103 inline void Vector3D::setX( double x )
104 {
105  mX = x;
106 }
107 
108 inline void Vector3D::setY( double y )
109 {
110  mY = y;
111 }
112 
113 inline void Vector3D::setZ( double z )
114 {
115  mZ = z;
116 }
117 
118 #endif
119 #endif
void setX(double x)
Sets the x-component of the vector.
Definition: Vector3D.h:103
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:98
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
Definition: Vector3D.h:33
void setZ(double z)
Sets the z-component of the vector.
Definition: Vector3D.h:113
double mX
X-component of the vector.
Definition: Vector3D.h:37
double mZ
Z-component of the vector.
Definition: Vector3D.h:41
double getY() const
Returns the y-component of the vector.
Definition: Vector3D.h:93
double mY
Y-component of the vector.
Definition: Vector3D.h:39
void setY(double y)
Sets the y-component of the vector.
Definition: Vector3D.h:108
double getX() const
Returns the x-component of the vector.
Definition: Vector3D.h:88
Vector3D()=default
Default constructor.