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