|
FEDEM Solver
R8.0
Source code of the dynamics solver
|
Class for point vectors in 3D space. More...
#include <FFaVec3.H>
Public Member Functions | |
| FaVec3 () | |
| Default constructor. More... | |
| FaVec3 (double x, double y, double z) | |
| Constructor creating a vector from three double values. More... | |
| FaVec3 (const double *v) | |
| Constructor creating a vector from a double array. More... | |
| FaVec3 (const float *v) | |
| Constructor creating a vector from a float array. More... | |
| FaVec3 (const FaVec3 &v) | |
| Copy constructor. More... | |
| virtual | ~FaVec3 () |
| Empty destructor. More... | |
| FaVec3 & | operator= (const FaVec3 &v) |
| Assignment operator. More... | |
| FaVec3 & | operator+= (const FaVec3 &v) |
| Addition operator. More... | |
| FaVec3 & | operator-= (const FaVec3 &v) |
| Subtraction operator. More... | |
| FaVec3 & | operator*= (double d) |
| Scaling operator (multiplication by a scalar). More... | |
| FaVec3 & | operator/= (double d) |
| Scaling operator (division by a scalar). More... | |
| const double * | getPt () const |
| Access to internal array (read only). More... | |
| double * | getPt () |
| Access to internal array (for manipulation). More... | |
| const double & | operator[] (int i) const |
| Zero-based indexing operator (read only). More... | |
| double & | operator[] (int i) |
| Zero-based indexing operator (for manipulation). More... | |
| const double & | operator() (int i) const |
| One-based indexing operator (read only). More... | |
| double & | operator() (int i) |
| One-based indexing operator (for manipulation). More... | |
| double | x () const |
| Returns the X-component of the vector. More... | |
| double | y () const |
| Returns the Y-component of the vector. More... | |
| double | z () const |
| Returns the Z-component of the vector. More... | |
| void | x (double v) |
| Assigns the X-component of the vector. More... | |
| void | y (double v) |
| Assigns the Y-component of the vector. More... | |
| void | z (double v) |
| Assigns the Z-component of the vector. More... | |
| void | clear () |
| Sets the vector to zero. More... | |
| int | isParallell (const FaVec3 &otherVec, double tolerance=1.0e-10) const |
| Checks if this vector is parallel to otherVec. More... | |
| bool | equals (const FaVec3 &otherVec, double tolerance=0.0) const |
| Checks if this vector is equal to otherVec. More... | |
| double | angle (const FaVec3 &otherVec) const |
| Calculates angle between this vector and otherVec. More... | |
| bool | isZero (double tolerance=1.0e-10) const |
| Checks if this vector is zero. More... | |
| double | sqrLength () const |
| Returns the square of the length of this vector. More... | |
| double | length () const |
| Returns the length of this vector. More... | |
| FaVec3 & | truncate (double tolerance=1.0e-10) |
| Truncates small components of this vector to zero. More... | |
| FaVec3 & | normalize (double truncTol=0.0) |
| Normalizes this vector to unit length. More... | |
| FaVec3 & | round (int precision) |
| Rounds off the components down to precision significant digits. More... | |
| FaVec3 & | setByCylCoords (const FaVec3 &cylCoords, FFaVec3IdxEnum axis=VZ) |
| Sets this vector to the Cartesian equivalent of the cylindrical coordinates cylCoords. More... | |
| FaVec3 | getAsCylCoords (FFaVec3IdxEnum axis=VZ) const |
| Returns the cylindrical coordinates corresponding to the Cartesian position of this vector. More... | |
| FaVec3 & | setBySphCoords (const FaVec3 &sphCoords, FFaVec3IdxEnum axis=VZ) |
| Sets this vector to the Cartesian equivalent of the spherical coordinates sphCoords. More... | |
| FaVec3 | getAsSphCoords (FFaVec3IdxEnum axis=VZ) const |
| Returns the spherical coordinates corresponding to the Cartesian position of this vector. More... | |
Private Attributes | |
| double | n [3] |
| The actual vector components. More... | |
Friends | |
| FaVec3 | operator- (const FaVec3 &v) |
| Unary negation operator. More... | |
| FaVec3 | operator+ (const FaVec3 &a, const FaVec3 &b) |
| Global addition operator. More... | |
| FaVec3 | operator- (const FaVec3 &a, const FaVec3 &b) |
| Global subtraction operator. More... | |
| FaVec3 | operator* (const FaVec3 &a, double d) |
| Scaling by scalar. More... | |
| FaVec3 | operator* (double d, const FaVec3 &a) |
| Scaling by scalar. More... | |
| FaVec3 | operator/ (const FaVec3 &a, double d) |
| Division by scalar. More... | |
| double | operator* (const FaVec3 &a, const FaVec3 &b) |
| Dot product. More... | |
| FaVec3 | operator^ (const FaVec3 &a, const FaVec3 &b) |
| Cross product. More... | |
| bool | operator== (const FaVec3 &a, const FaVec3 &b) |
| Equality operator. More... | |
| bool | operator!= (const FaVec3 &a, const FaVec3 &b) |
| Unequality operator. More... | |
| std::ostream & | operator<< (std::ostream &s, const FaVec3 &v) |
| Printing operator. More... | |
| std::istream & | operator>> (std::istream &s, FaVec3 &v) |
| Reading operator. More... | |
Class for point vectors in 3D space.
This class is used to represent 3D point vectors in all type of geometry calculations. The class is equipped with a lot of convenience methods for the most common operations on such objects.
|
inline |
Default constructor.
|
inline |
Constructor creating a vector from three double values.
|
inline |
Constructor creating a vector from a double array.
|
inline |
Constructor creating a vector from a float array.
|
inline |
Copy constructor.
|
inlinevirtual |
Empty destructor.
| double FaVec3::angle | ( | const FaVec3 & | otherVec | ) | const |
Calculates angle between this vector and otherVec.
The angle is returned in radians in the range [0,π].
|
inline |
Sets the vector to zero.
| bool FaVec3::equals | ( | const FaVec3 & | otherVec, |
| double | tolerance = 0.0 |
||
| ) | const |
Checks if this vector is equal to otherVec.
Checks if the given vector is equal to this one within the given tolerance.
| FaVec3 FaVec3::getAsCylCoords | ( | FFaVec3IdxEnum | axis = VZ | ) | const |
Returns the cylindrical coordinates corresponding to the Cartesian position of this vector.
Returns v = [radius, angleAboutAxis, lengthAlongRotAxis]. The axis parameter defines which axis of rotation to use.
| FaVec3 FaVec3::getAsSphCoords | ( | FFaVec3IdxEnum | axis = VZ | ) | const |
Returns the spherical coordinates corresponding to the Cartesian position of this vector.
Returns v = [radius, angleAboutAxis, asimuthAngle]. The axis parameter defines which axis of rotation to use.
|
inline |
Access to internal array (for manipulation).
|
inline |
Access to internal array (read only).
| int FaVec3::isParallell | ( | const FaVec3 & | otherVec, |
| double | tolerance = 1.0e-10 |
||
| ) | const |
Checks if this vector is parallel to otherVec.
Returns 0 if not parallel, 1 if same direction and -1 if opposite direction. Tolerance = 1 - cos(maxAngle)
| bool FaVec3::isZero | ( | double | tolerance = 1.0e-10 | ) | const |
Checks if this vector is zero.
Checks if this vector is zero within the given tolerance.
|
inline |
Returns the length of this vector.
| FaVec3 & FaVec3::normalize | ( | double | truncTol = 0.0 | ) |
Normalizes this vector to unit length.
If the vector has zero length it will end up as [1,0,0]. If a vector component is less than truncTol in absolute value after the normalization, it is set to zero.
|
inline |
One-based indexing operator (for manipulation).
|
inline |
One-based indexing operator (read only).
| FaVec3 & FaVec3::operator*= | ( | double | d | ) |
Scaling operator (multiplication by a scalar).
| FaVec3 & FaVec3::operator/= | ( | double | d | ) |
Scaling operator (division by a scalar).
|
inline |
Zero-based indexing operator (for manipulation).
|
inline |
Zero-based indexing operator (read only).
| FaVec3 & FaVec3::round | ( | int | precision | ) |
Rounds off the components down to precision significant digits.
This method is used when parsing Nastran bulk data files, to avoid (or at least reduce the probability of) checksum issues.
| FaVec3 & FaVec3::setByCylCoords | ( | const FaVec3 & | cylCoords, |
| FFaVec3IdxEnum | axis = VZ |
||
| ) |
Sets this vector to the Cartesian equivalent of the cylindrical coordinates cylCoords.
Assuming cylCoords = [radius, angleAboutAxis, lengthAlongRotAxis]; The axis argument defines which axis of rotation to use.
| FaVec3 & FaVec3::setBySphCoords | ( | const FaVec3 & | sphCoords, |
| FFaVec3IdxEnum | axis = VZ |
||
| ) |
Sets this vector to the Cartesian equivalent of the spherical coordinates sphCoords.
Assuming sphCoords = [radius, angleAboutAxis, asimuthAngle]; The axis parameter defines which axis of rotation to use.
|
inline |
Returns the square of the length of this vector.
| FaVec3 & FaVec3::truncate | ( | double | tolerance = 1.0e-10 | ) |
Truncates small components of this vector to zero.
Truncates components of this vector to zero if less than the tolerance.
|
inline |
Returns the X-component of the vector.
|
inline |
Assigns the X-component of the vector.
|
inline |
Returns the Y-component of the vector.
|
inline |
Assigns the Y-component of the vector.
|
inline |
Returns the Z-component of the vector.
|
inline |
Assigns the Z-component of the vector.
|
friend |
Printing operator.
|
friend |
Reading operator.
|
private |
The actual vector components.