QGIS API Documentation  2.15.0-Master (13f053b)
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 
22 class ANALYSIS_EXPORT Vector3D
27 {
28  protected:
30  double mX;
32  double mY;
34  double mZ;
35 
36  public:
38  Vector3D( double x, double y, double z );
40  Vector3D();
42  Vector3D( const Vector3D& v );
44  ~Vector3D();
45  Vector3D& operator=( const Vector3D& v );
46  bool operator==( const Vector3D& v ) const;
47  bool operator!=( const Vector3D& v ) const;
49  double getX() const;
51  double getY() const;
53  double getZ() const;
55  double getLength() const;
57  void setX( double x );
59  void setY( double y );
61  void setZ( double z );
63  void standardise();
64 };
65 
66 //------------------------------------------constructors------------------------------------
67 
68 inline Vector3D::Vector3D( double x, double y, double z )
69  : mX( x )
70  , mY( y )
71  , mZ( z )
72 {
73 
74 }
75 
77  : mX( 0 )
78  , mY( 0 )
79  , mZ( 0 )//using a list
80 {
81 
82 }
83 
85 {
86 
87 }
88 
89 //-------------------------------------------setter and getters-------------------------------
90 
91 inline double Vector3D::getX() const
92 {
93  return mX;
94 }
95 
96 inline double Vector3D::getY() const
97 {
98  return mY;
99 }
100 
101 inline double Vector3D::getZ() const
102 {
103  return mZ;
104 }
105 
106 inline void Vector3D::setX( double x )
107 {
108  mX = x;
109 }
110 
111 inline void Vector3D::setY( double y )
112 {
113  mY = y;
114 }
115 
116 inline void Vector3D::setZ( double z )
117 {
118  mZ = z;
119 }
120 
121 #endif
void setX(double x)
Sets the x-component of the vector.
Definition: Vector3D.h:106
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
Class Vector3D represents a 3D-Vector, capable to store x-,y- and z-coordinates in double values...
Definition: Vector3D.h:22
void setZ(double z)
Sets the z-component of the vector.
Definition: Vector3D.h:116
double mX
X-component of the vector.
Definition: Vector3D.h:30
double mZ
Z-component of the vector.
Definition: Vector3D.h:34
~Vector3D()
Destructor.
Definition: Vector3D.h:84
double getY() const
Returns the y-component of the vector.
Definition: Vector3D.h:96
double getX() const
Returns the x-component of the vector.
Definition: Vector3D.h:91
double mY
Y-component of the vector.
Definition: Vector3D.h:32
void setY(double y)
Sets the y-component of the vector.
Definition: Vector3D.h:111
Vector3D()
Default constructor.
Definition: Vector3D.h:76
double getZ() const
Returns the z-component of the vector.
Definition: Vector3D.h:101