CONFIG LIB 1.5
Configuration Files Library (by TGG 2020)
Loading...
Searching...
No Matches
VECTOR_3D Class Reference

Vector 3D class - vector manipulation. More...

#include <vector3d.h>

Public Member Functions

 VECTOR_3D (void)
 deafult constructor
 
 VECTOR_3D (const VECTOR_3D &v)
 constructor that copies coordiantes from another vector
 
 VECTOR_3D (double xp, double yp, double zp)
 constructor that copies coordiantes from three variables
 
 VECTOR_3D (double a[])
 constructor that copies coordiantes from the array
 
VECTOR_3Doperator= (const VECTOR_3D &v)
 assignment operator
 
double Len (void) const
 the value of the vector
 
double LenXY (void) const
 the value of the 2D vector in XY plane
 
double LenXZ (void) const
 the value of the 2D vector in XZ plane
 
double LenYZ (void) const
 the value of the 2D vector in YZ plane
 
double Square (void) const
 the square of the vector value
 
double Normalize (void)
 normalizes the vector to unit - coordiantes are divided by the vector value, returnes the vector value (length)
 
void GetFrom (double xp, double yp, double zp)
 sets coordinates from three variables

 
void GetFrom (double a[])
 sets coordinates from the aray
 
void PutTo (double &xp, double &yp, double &zp)
 copies coordinates to three variables

 
void PutTo (double a[])
 copies coordinates to the array

 
void AddTo (double &xp, double &yp, double &zp)
 adds coordinates to three variables

 
void AddTo (double a[])
 adds coordinates to the array
 
void Set0 (void)
 resets coordinates to zero
 
bool Isnan (void)
 determines if any coordinate of given vector is a not-a-number (NaN) value.
 
void rotX (double alpha)
 Rotating functions rotates the vector relative to the X axis by an alpha[rad] angle

 
void rotY (double alpha)
 rotates the vector relative to the Y axis by an alpha[rad] angle
 
void rotZ (double alpha)
 rotates the vector relative to the Z axis by an alpha[rad] angle
 
void rotdX (double alfa)
 rotates the vector relative to the X axis by an alpha[deg] angle (precise values for 0,90,180,270 deg)
 
void rotdY (double alfa, double dX=0.)
 rotates the vector relative to the Y axis (shifted by dX longwise X) by an alpha[deg] angle (precise values for 0,90,180,270 deg)
 
void rotdZ (double alfa)
 rotates the vector relative to the Z axis by an alpha[deg] angle (precise values for 0,90,180,270 deg)
 

Public Attributes

double x
 x coordinate
 
double y
 y coordinate
 
double z
 z coordinate
 

Detailed Description

Vector 3D class - vector manipulation.

Definition at line 33 of file vector3d.h.

Constructor & Destructor Documentation

◆ VECTOR_3D() [1/4]

VECTOR_3D::VECTOR_3D ( void )
inline

deafult constructor

Definition at line 40 of file vector3d.h.

40{ x = 0.0; y = 0.0; z = 0.0; };
double x
x coordinate
Definition vector3d.h:38
double z
z coordinate
Definition vector3d.h:38
double y
y coordinate
Definition vector3d.h:38

◆ VECTOR_3D() [2/4]

VECTOR_3D::VECTOR_3D ( const VECTOR_3D & v)
inline

constructor that copies coordiantes from another vector

Definition at line 42 of file vector3d.h.

42{ x = v.x; y = v.y; z = v.z; };

◆ VECTOR_3D() [3/4]

VECTOR_3D::VECTOR_3D ( double xp,
double yp,
double zp )
inline

constructor that copies coordiantes from three variables

Definition at line 44 of file vector3d.h.

44{ x = xp; y = yp; z = zp; };

◆ VECTOR_3D() [4/4]

VECTOR_3D::VECTOR_3D ( double a[])
inline

constructor that copies coordiantes from the array

Definition at line 46 of file vector3d.h.

46{ x = a[0]; y = a[1]; z = a[2];};

Member Function Documentation

◆ AddTo() [1/2]

void VECTOR_3D::AddTo ( double & xp,
double & yp,
double & zp )
inline

adds coordinates to three variables

Definition at line 75 of file vector3d.h.

75{ xp += x; yp += y; zp += z; };

◆ AddTo() [2/2]

void VECTOR_3D::AddTo ( double a[])
inline

adds coordinates to the array

Definition at line 77 of file vector3d.h.

77{ a[0] += x; a[1] += y; a[2] += z;};

◆ GetFrom() [1/2]

void VECTOR_3D::GetFrom ( double a[])
inline

sets coordinates from the aray

Definition at line 67 of file vector3d.h.

67{ x = a[0]; y = a[1]; z = a[2];};

◆ GetFrom() [2/2]

void VECTOR_3D::GetFrom ( double xp,
double yp,
double zp )
inline

sets coordinates from three variables

Definition at line 65 of file vector3d.h.

65{ x = xp; y = yp; z = zp; };

Referenced by MASS_OBJECT_DATA::Clean(), MASS_OBJECT_DATA::CoordinateSystems(), and IOFUN::ReadVect3().

◆ Isnan()

bool VECTOR_3D::Isnan ( void )
inline

determines if any coordinate of given vector is a not-a-number (NaN) value.

Definition at line 83 of file vector3d.h.

83{ return std::isnan( x ) || std::isnan( y ) || std::isnan( z ); };

◆ Len()

double VECTOR_3D::Len ( void ) const
inline

the value of the vector

Definition at line 52 of file vector3d.h.

52{ return sqrt( x*x + y*y + z*z ); };

Referenced by Normalize().

◆ LenXY()

double VECTOR_3D::LenXY ( void ) const
inline

the value of the 2D vector in XY plane

Definition at line 54 of file vector3d.h.

54{ return sqrt( x*x + y*y ); };

◆ LenXZ()

double VECTOR_3D::LenXZ ( void ) const
inline

the value of the 2D vector in XZ plane

Definition at line 56 of file vector3d.h.

56{ return sqrt( x*x + z*z ); };

◆ LenYZ()

double VECTOR_3D::LenYZ ( void ) const
inline

the value of the 2D vector in YZ plane

Definition at line 58 of file vector3d.h.

58{ return sqrt( y*y + z*z ); };

◆ Normalize()

double VECTOR_3D::Normalize ( void )

normalizes the vector to unit - coordiantes are divided by the vector value, returnes the vector value (length)

Definition at line 38 of file vector3d.cpp.

39{
40 double dlg = this->Len();
41
42 if( dlg > 0.0 )
43 {
44 x /= dlg;
45 y /= dlg;
46 z /= dlg;
47 }
48
49 return dlg;
50}
double Len(void) const
the value of the vector
Definition vector3d.h:52

Referenced by MASS_OBJECT_DATA::CheckData(), and MASS_OBJECT_DATA::CoordinateSystems().

◆ operator=()

VECTOR_3D & VECTOR_3D::operator= ( const VECTOR_3D & v)

assignment operator

Definition at line 26 of file vector3d.cpp.

27{
28 if( this != &a )
29 {
30 x = a.x;
31 y = a.y;
32 z = a.z;
33 }
34
35 return *this;
36}

◆ PutTo() [1/2]

void VECTOR_3D::PutTo ( double & xp,
double & yp,
double & zp )
inline

copies coordinates to three variables

Definition at line 70 of file vector3d.h.

70{ xp = x; yp = y; zp = z; };

◆ PutTo() [2/2]

void VECTOR_3D::PutTo ( double a[])
inline

copies coordinates to the array

Definition at line 72 of file vector3d.h.

72{ a[0] = x; a[1] = y; a[2] = z;};

◆ rotdX()

void VECTOR_3D::rotdX ( double alfa)

rotates the vector relative to the X axis by an alpha[deg] angle (precise values for 0,90,180,270 deg)

Definition at line 78 of file vector3d.cpp.

79{
80 double yy = y;
81 double zz = z;
82
83 if (alfa==0.)
84 {
85 }
86 else
87 {
88 if (alfa==90.)
89 {
90 y = -zz;
91 z = yy;
92 }
93 else
94 {
95 if (alfa==180.)
96 {
97 y = -yy;
98 z = -zz;
99 }
100 else
101 {
102 if (alfa==270.)
103 {
104 y = zz;
105 z = -yy;
106 }
107 else
108 {
109 alfa *= M_PI/180.0;
110 y = yy*cos(alfa) - zz*sin(alfa);
111 z = yy*sin(alfa) + zz*cos(alfa);
112 }
113 }
114 }
115 }
116}

◆ rotdY()

void VECTOR_3D::rotdY ( double alfa,
double dX = 0. )

rotates the vector relative to the Y axis (shifted by dX longwise X) by an alpha[deg] angle (precise values for 0,90,180,270 deg)

Definition at line 118 of file vector3d.cpp.

119{
120 double xx = x;
121 double zz = z;
122
123 if (alfa==0.)
124 {
125 }
126 else
127 {
128 if (alfa==90.)
129 {
130 x = zz + dX;
131 z = -xx + dX;
132 }
133 else
134 {
135 if (alfa==180.)
136 {
137 x = -xx + 2.*dX;
138 z = -zz;
139 }
140 else
141 {
142 if (alfa==270.)
143 {
144 x = -zz + dX;
145 z = xx - dX;
146 }
147 else
148 {
149 alfa *= M_PI/180.0;
150 x = zz*sin(alfa) + (xx-dX)*cos(alfa) + dX;
151 z = zz*cos(alfa) - (xx-dX)*sin(alfa);
152 }
153 }
154 }
155 }
156}

◆ rotdZ()

void VECTOR_3D::rotdZ ( double alfa)

rotates the vector relative to the Z axis by an alpha[deg] angle (precise values for 0,90,180,270 deg)

Definition at line 158 of file vector3d.cpp.

159{
160 double xx = x;
161 double yy = y;
162
163 if (alfa==0.)
164 {
165 }
166 else
167 {
168 if (alfa==90.)
169 {
170 x = -yy;
171 y = xx;
172 }
173 else
174 {
175 if (alfa==180.)
176 {
177 x = -xx;
178 y = -yy;
179 }
180 else
181 {
182 if (alfa==270.)
183 {
184 x = yy;
185 y = -xx;
186 }
187 else
188 {
189 alfa *= M_PI/180.0;
190 x = xx*cos(alfa) - yy*sin(alfa);
191 y = xx*sin(alfa) + yy*cos(alfa);
192 }
193 }
194 }
195 }
196}

◆ rotX()

void VECTOR_3D::rotX ( double alpha)

Rotating functions rotates the vector relative to the X axis by an alpha[rad] angle

Definition at line 54 of file vector3d.cpp.

55{
56 double yy=y;
57 double zz=z;
58 y = yy*cos(alfa) - zz*sin(alfa);
59 z = yy*sin(alfa) + zz*cos(alfa);
60}

◆ rotY()

void VECTOR_3D::rotY ( double alpha)

rotates the vector relative to the Y axis by an alpha[rad] angle

Definition at line 62 of file vector3d.cpp.

63{
64 double xx=x;
65 double zz=z;
66 x = zz*sin(alfa) + xx*cos(alfa);
67 z = zz*cos(alfa) - xx*sin(alfa);
68}

◆ rotZ()

void VECTOR_3D::rotZ ( double alpha)

rotates the vector relative to the Z axis by an alpha[rad] angle

Definition at line 70 of file vector3d.cpp.

71{
72 double xx=x;
73 double yy=y;
74 x = xx*cos(alfa) - yy*sin(alfa);
75 y = xx*sin(alfa) + yy*cos(alfa);
76}

◆ Set0()

void VECTOR_3D::Set0 ( void )
inline

resets coordinates to zero

Definition at line 80 of file vector3d.h.

80{ x = 0.0; y = 0.0; z = 0.0; };

◆ Square()

double VECTOR_3D::Square ( void ) const
inline

the square of the vector value

Definition at line 60 of file vector3d.h.

60{ return x*x + y*y + z*z; };

Member Data Documentation

◆ x

◆ y

◆ z


The documentation for this class was generated from the following files: