67 const double*
getPt()
const {
return n; }
82 double x()
const {
return n[
VX]; }
84 double y()
const {
return n[
VY]; }
86 double z()
const {
return n[
VZ]; }
89 void x(
double v) {
n[
VX] = v; }
91 void y(
double v) {
n[
VY] = v; }
93 void z(
double v) {
n[
VZ] = v; }
100 bool equals (
const FaVec3& otherVec,
double tolerance = 0.0)
const;
104 bool isZero (
double tolerance = 1.0e-10)
const;
168 for (
int i = 0; i < 3; i++)
176 #ifdef FFA_INDEXCHECK
178 std::cerr <<
"FaVec3::operator[]: index i="<< i <<
" is out of range [0,2]"
186 #ifdef FFA_INDEXCHECK
188 std::cerr <<
"FaVec3::operator[]: index i="<< i <<
" is out of range [0,2]"
196 #ifdef FFA_INDEXCHECK
198 std::cerr <<
"FaVec3::operator(): index i="<< i <<
" is out of range [1,3]"
206 #ifdef FFA_INDEXCHECK
208 std::cerr <<
"FaVec3::operator(): index i="<< i <<
" is out of range [1,3]"
FFaVec3IdxEnum
Enums representing vector and matrix indices.
Definition: FFaVec3.H:24
@ VX
The X-component.
Definition: FFaVec3.H:25
@ VY
The Y-component.
Definition: FFaVec3.H:26
@ VZ
The Z-component.
Definition: FFaVec3.H:27
@ VW
Translation part of a FaMat34 object.
Definition: FFaVec3.H:28
Class for point vectors in 3D space.
Definition: FFaVec3.H:40
double * getPt()
Access to internal array (for manipulation).
Definition: FFaVec3.H:69
double n[3]
The actual vector components.
Definition: FFaVec3.H:159
friend FaVec3 operator*(const FaVec3 &a, double d)
Scaling by scalar.
Definition: FFaVec3.C:329
bool isZero(double tolerance=1.0e-10) const
Checks if this vector is zero.
Definition: FFaVec3.C:140
friend FaVec3 operator^(const FaVec3 &a, const FaVec3 &b)
Cross product.
Definition: FFaVec3.C:359
bool equals(const FaVec3 &otherVec, double tolerance=0.0) const
Checks if this vector is equal to otherVec.
Definition: FFaVec3.C:121
friend bool operator!=(const FaVec3 &a, const FaVec3 &b)
Unequality operator.
Definition: FFaVec3.C:374
FaVec3 & operator=(const FaVec3 &v)
Assignment operator.
Definition: FFaVec3.H:165
int isParallell(const FaVec3 &otherVec, double tolerance=1.0e-10) const
Checks if this vector is parallel to otherVec.
Definition: FFaVec3.C:80
FaVec3 & operator/=(double d)
Scaling operator (division by a scalar).
Definition: FFaVec3.C:52
friend FaVec3 operator/(const FaVec3 &a, double d)
Division by scalar.
Definition: FFaVec3.C:339
FaVec3 & setByCylCoords(const FaVec3 &cylCoords, FFaVec3IdxEnum axis=VZ)
Sets this vector to the Cartesian equivalent of the cylindrical coordinates cylCoords.
Definition: FFaVec3.C:223
const double & operator[](int i) const
Zero-based indexing operator (read only).
Definition: FFaVec3.H:174
friend std::ostream & operator<<(std::ostream &s, const FaVec3 &v)
Printing operator.
Definition: FFaVec3.C:382
FaVec3()
Default constructor.
Definition: FFaVec3.H:43
void clear()
Sets the vector to zero.
Definition: FFaVec3.H:95
FaVec3 getAsCylCoords(FFaVec3IdxEnum axis=VZ) const
Returns the cylindrical coordinates corresponding to the Cartesian position of this vector.
Definition: FFaVec3.C:245
FaVec3 & operator*=(double d)
Scaling operator (multiplication by a scalar).
Definition: FFaVec3.C:43
FaVec3 & operator-=(const FaVec3 &v)
Subtraction operator.
Definition: FFaVec3.C:34
friend FaVec3 operator-(const FaVec3 &v)
Unary negation operator.
Definition: FFaVec3.C:313
friend FaVec3 operator+(const FaVec3 &a, const FaVec3 &b)
Global addition operator.
Definition: FFaVec3.C:318
void x(double v)
Assigns the X-component of the vector.
Definition: FFaVec3.H:89
FaVec3 & truncate(double tolerance=1.0e-10)
Truncates small components of this vector to zero.
Definition: FFaVec3.C:153
friend bool operator==(const FaVec3 &a, const FaVec3 &b)
Equality operator.
Definition: FFaVec3.C:367
FaVec3 & round(int precision)
Rounds off the components down to precision significant digits.
Definition: FFaVec3.C:203
FaVec3 & normalize(double truncTol=0.0)
Normalizes this vector to unit length.
Definition: FFaVec3.C:173
FaVec3 & operator+=(const FaVec3 &v)
Addition operator.
Definition: FFaVec3.C:25
FaVec3 & setBySphCoords(const FaVec3 &sphCoords, FFaVec3IdxEnum axis=VZ)
Sets this vector to the Cartesian equivalent of the spherical coordinates sphCoords.
Definition: FFaVec3.C:266
double angle(const FaVec3 &otherVec) const
Calculates angle between this vector and otherVec.
Definition: FFaVec3.C:97
FaVec3(const FaVec3 &v)
Copy constructor.
Definition: FFaVec3.H:51
double z() const
Returns the Z-component of the vector.
Definition: FFaVec3.H:86
FaVec3(const float *v)
Constructor creating a vector from a float array.
Definition: FFaVec3.H:49
friend std::istream & operator>>(std::istream &s, FaVec3 &v)
Reading operator.
Definition: FFaVec3.C:388
FaVec3(const double *v)
Constructor creating a vector from a double array.
Definition: FFaVec3.H:47
const double * getPt() const
Access to internal array (read only).
Definition: FFaVec3.H:67
void z(double v)
Assigns the Z-component of the vector.
Definition: FFaVec3.H:93
double sqrLength() const
Returns the square of the length of this vector.
Definition: FFaVec3.H:107
virtual ~FaVec3()
Empty destructor.
Definition: FFaVec3.H:53
void y(double v)
Assigns the Y-component of the vector.
Definition: FFaVec3.H:91
const double & operator()(int i) const
One-based indexing operator (read only).
Definition: FFaVec3.H:194
double y() const
Returns the Y-component of the vector.
Definition: FFaVec3.H:84
double length() const
Returns the length of this vector.
Definition: FFaVec3.H:109
double x() const
Returns the X-component of the vector.
Definition: FFaVec3.H:82
FaVec3 getAsSphCoords(FFaVec3IdxEnum axis=VZ) const
Returns the spherical coordinates corresponding to the Cartesian position of this vector.
Definition: FFaVec3.C:288
FaVec3(double x, double y, double z)
Constructor creating a vector from three double values.
Definition: FFaVec3.H:45
real(sp), dimension(:,:,:), pointer b
Definition: diffractionModule.f90:22
real(sp), dimension(:,:,:), pointer a
Definition: diffractionModule.f90:21