ALBA
albaVect3d.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: ALBA (Agile Library for Biomedical Applications)
4 Module: albaVect3d
5 Authors: Gianluigi Crimi
6
7 Copyright (c) BIC
8 All rights reserved. See Copyright.txt or
9
10
11 This software is distributed WITHOUT ANY WARRANTY; without even
12 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13 PURPOSE. See the above copyright notice for more information.
14
15=========================================================================*/
16
17#ifndef __albaVect3d_H__
18#define __albaVect3d_H__
19
20//----------------------------------------------------------------------------
21// includes :
22//----------------------------------------------------------------------------
23#include "albaDefines.h"
24#include "albaVect3d.h"
25
26//----------------------------------------------------------------------------
27// forward reference
28//----------------------------------------------------------------------------
29
34class ALBA_EXPORT albaVect3d
35{
36public:
37
40
42 albaVect3d(double x, double y, double z);
43
45 albaVect3d(double *values);
46
49
51 void Setzero(void);
52
54 void SetValues(double *values);
55
57 void SetValues(double x, double y, double z);
58
60 double Magnitude(void);
61
63 void Normalize(void);
64
67
69 double Distance(albaVect3d &vector);
70
72 double Distance2(albaVect3d &vector);
73
75 double Dot(albaVect3d &vector);
76
79
81 inline double GetX(){return m_X;};
82
84 inline double GetY(){return m_Y;};
85
87 inline double GetZ(){return m_Z;};
88
90 inline void SetX(double x){m_X=x;};
91
93 inline void SetY(double y){m_Y=y;};
94
96 inline void SetZ(double z){m_Z=z;};
97
99 inline double* GetVect(){return (double*)this;};
100
102 inline void GetVect(double *vect) { vect[0] = m_X; vect[1] = m_Y; vect[2] = m_Z; };
103
106
108 int operator==(double *vect);
109
112
114 albaVect3d operator+(double *vect);
115
118
120 albaVect3d operator-(double *vect);
121
124
127
130
132 albaVect3d &operator+=(double *vect);
133
136
138 albaVect3d &operator-=(double *vect);
139
141 albaVect3d &operator*=(double val);
142
144 albaVect3d &operator/=(double val);
145
148 double& operator[](int pos);
149
151 double AngleBetweenVectors( albaVect3d &vect, bool getMinAngle=true );
152
154 static albaVect3d Slerp(albaVect3d start, albaVect3d end, double percent);
155
156private:
157
158 double m_X, m_Y, m_Z;
159};
160#endif
Class Name: albaVect3d.
Definition: albaVect3d.h:35
void SetY(double y)
the Value of the Y-element
Definition: albaVect3d.h:93
albaVect3d operator+(albaVect3d &vect)
Operator: Return the sum of the vectors.
albaVect3d operator-(albaVect3d &vect)
Operator: Return the difference of the vectors.
albaVect3d & operator+=(albaVect3d &vect)
Operator: Sets the values to the sum between the vectors.
albaVect3d Cross(albaVect3d &vector)
Return the cross product between the vectors.
void GetVect(double *vect)
Return a pointer to the vector of double.
Definition: albaVect3d.h:102
double GetX()
Return the Value of the X-element.
Definition: albaVect3d.h:81
static albaVect3d Slerp(albaVect3d start, albaVect3d end, double percent)
Do a spherical linear interpolation of two vectors.
void Normalize(void)
Normalize the components of the vector.
albaVect3d operator-(double *vect)
Operator: Return the difference of the vectors.
void Setzero(void)
Sets the vector to zero.
albaVect3d & operator-=(double *vect)
Operator: Sets the values to the difference between the vectors.
albaVect3d(double x, double y, double z)
Constructor, sets the vector values.
albaVect3d & operator+=(double *vect)
Operator: Sets the values to the sum between the vectors.
int operator==(double *vect)
Operator: Return true if the vectors are equals.
albaVect3d Normal(void)
Return the normal of the vector (the original vector is not modified()
albaVect3d & operator/=(double val)
Operator: Sets the values to the division with the scalar.
double GetY()
Return the Value of the Y-element.
Definition: albaVect3d.h:84
void SetValues(double x, double y, double z)
Sets the vector values.
albaVect3d Abs(void)
Return a vector whit the abs of each element.
double Magnitude(void)
Returns the magnitude of the vector.
double & operator[](int pos)
Operator: Gets the vect values with *double style ie: vect[0]==vect.GetX()
double AngleBetweenVectors(albaVect3d &vect, bool getMinAngle=true)
Returns the angle between two vectors.
int operator==(albaVect3d &vect)
Operator: Return true if the vectors are equals.
double GetZ()
Return the Value of the Z-element.
Definition: albaVect3d.h:87
albaVect3d operator+(double *vect)
Operator: Return the sum of the vectors.
void SetZ(double z)
the Value of the Z-element
Definition: albaVect3d.h:96
double Distance(albaVect3d &vector)
Return the distance between the vectors.
double Distance2(albaVect3d &vector)
Return the distance2 (quadratic distance) between the vectors.
albaVect3d & operator-=(albaVect3d &vect)
Operator: Sets the values to the difference between the vectors.
double Dot(albaVect3d &vector)
Return the dot product between the vectors.
double * GetVect()
Return a pointer to the vector of double.
Definition: albaVect3d.h:99
void SetValues(double *values)
Sets the vector values.
albaVect3d & operator*=(double val)
Operator: Sets the values to the product with the scalar.
albaVect3d()
Default constructor, init to zero.
albaVect3d operator*(double num)
Operator: Return the scalar multiply.
albaVect3d(double *values)
Constructor, sets the vector values.
albaVect3d operator/(double num)
Operator: Return the scalar division.
void SetX(double x)
the Value of the X-element
Definition: albaVect3d.h:90