ASDQuaternion A simple class that implements the main features of quaternion algebra.
More...
#include <ASDMath.h>
template<class T>
class XC::ASDQuaternion< T >
ASDQuaternion A simple class that implements the main features of quaternion algebra.
◆ ASDQuaternion() [1/2]
Creates a ASDQuaternion from its coefficients.
- Parameters
-
w | w coefficient |
x | x coefficient |
y | y coefficient |
z | z coefficient |
◆ ASDQuaternion() [2/2]
◆ conjugate()
◆ FromAxisAngle()
Returns a ASDQuaternion that represents a rotation of an angle 'radians' around the axis (x, y, z)
- Parameters
-
x | the x component of the rotation axis |
y | the y component of the rotation axis |
z | the z component of the rotation axis |
radians | the rotation angle in radians |
- Returns
- a ASDQuaternion that represents a rotation of an angle 'radians' around the axis (x, y, z)
◆ FromRotationMatrix()
template<class T>
template<class TMatrix3x3 >
Returns a ASDQuaternion from a Rotation Matrix.
The rotation matrix type is the template argument, no check is made on the type of this matrix. These assumptions are made: The matrix should provide an indexed access like m(i, j) where i and j are indices from 0 to 2. This means that the input matrix is a C-Style 3x3 Matrix.
- Parameters
-
m | the source rotation matrix |
- Returns
- a ASDQuaternion from a Rotation Matrix
◆ FromRotationVector() [1/2]
Returns a ASDQuaternion from a rotation vector.
- Parameters
-
rx | the x component of the source rotation vector |
ry | the y component of the source rotation vector |
rz | the z component of the source rotation vector |
- Returns
- a ASDQuaternion from a rotation vector
◆ FromRotationVector() [2/2]
template<class T>
template<class TVector3 >
Returns a ASDQuaternion from a rotation vector.
The vector type is the template parameter. No check is made on this type. The following assumptions are made: The vector type should provide indexing like vector(i) where i goes from 0 to 2. (i.e. a C-Style vector of size 3)
- Parameters
-
v | the source rotation vector |
- Returns
- a ASDQuaternion from a rotation vector
◆ Identity()
◆ norm()
Returns the norm of this quaternion.
sqrt(x*x + y*y + z*z + w*w)
- Returns
- the norm of this quaternion.
◆ normalize()
◆ operator=()
◆ rotateVector() [1/2]
template<class T>
template<class TVector3_A , class TVector3_B >
void XC::ASDQuaternion< T >::rotateVector |
( |
const TVector3_A & |
a, |
|
|
TVector3_B & |
b |
|
) |
| const |
|
inline |
Rotates a vector using this quaternion.
Note: this is faster than constructing the rotation matrix and perform the matrix multiplication for a single vector. The vector type is the template parameter. No check is made on this type. The following assumptions are made: The vector type should provide indexing like vector(i) where i goes from 0 to 2. (i.e. a C-Style vector of size 3)
- Parameters
-
a | the input source vector |
b | the output rotated vector |
◆ rotateVector() [2/2]
template<class T>
template<class TVector3 >
Rotates a vector using this quaternion.
Note: this is faster than constructing the rotation matrix and perform the matrix multiplication for a single vector. The vector type is the template parameter. No check is made on this type. The following assumptions are made: The vector type should provide indexing like vector(i) where i goes from 0 to 2. (i.e. a C-Style vector of size 3)
- Parameters
-
a | the input source vector - rotated on exit |
◆ squaredNorm()
Returns the squared norm of this quaternion.
x*x + y*y + z*z + w*w
- Returns
- the squared norm of this quaternion.
◆ toRotationMatrix()
template<class T>
template<class TMatrix3x3 >
Constructs a Rotation Matrix from this ASDQuaternion.
The rotation matrix type is the template argument, no check is made on the type of this matrix. These assumptions are made: The matrix should provide an indexed access like m(i, j) where i and j are indices from 0 to 2. This means that the input matrix is a C-Style 3x3 Matrix. All the 9 coefficients are properly set so there's no need to set the matrix to Zero before calling this function.
- Parameters
-
R | the output rotation matrix |
◆ toRotationVector() [1/2]
Extracts the Rotation Vector from this ASDQuaternion.
- Parameters
-
rx | the output x component if the rotation vector |
ry | the output y component if the rotation vector |
rz | the output z component if the rotation vector |
◆ toRotationVector() [2/2]
template<class T>
template<class TVector3 >
Extracts the Rotation Vector from this ASDQuaternion The vector type is the template parameter.
No check is made on this type. The following assumptions are made: The vector type should provide indexing like vector(i) where i goes from 0 to 2. (i.e. a C-Style vector of size 3)
- Parameters
-
v | the output rotation vector |
◆ w()
Returns the W coefficient of this quaternion.
- Returns
- the W coefficient of this quaternion.
◆ x()
Returns the X coefficient of this quaternion.
- Returns
- the X coefficient of this quaternion.
◆ y()
Returns the Y coefficient of this quaternion.
- Returns
- the Y coefficient of this quaternion.
◆ z()
Returns the Z coefficient of this quaternion.
- Returns
- the Z coefficient of this quaternion.
The documentation for this class was generated from the following file:
- src/domain/mesh/element/utils/coordTransformation/ASDMath.h