|
Momentum Scripting v1
|
#include <EulerAngles.h>
Classes | |
| class | EulerOrder |
Static Public Member Functions | |
| static EulerAngles | random (const Vec3 &min=Vec3(double(0.0)), const Vec3 &max=Vec3(2 *MOMENTUM_NAMESPACE::PI), EulerConvention::Convention c=EulerConvention::DEFAULT_CONVENTION) |
This class provides conversion services between Euler angles in any of the 24 conventions and corresponding quaternions.
There are 24 distinct Euler angles conventions which can be used to parameterize this class. Each of them has a singularity line in which only the sum of two of the angles is relevant to the final rotation matrix (or quaternion). Euler angles are defined as three successive rotations along three successive axes, no two successive ones being identical. This results in 12 different choice of axis sequence. Given that we can choose the reference axes or the rotated ones, this leads to 12 choices with co-rotated axes, 12 choices for fixed axes.
The different conventions are labeled so that it is easy to extract the Real nature of each of them. Following Shoemake, the last bit is used to indicate whether we are using the static or rotated frame for the coordinate axes. The next bit indicates whether the first axis is repeated as the last. The next bit is the parity of the axis sequence. The next 3 bits indicate the first axis which is either 0, 1 or 2. That information is then used to reduce the number of conventions to just two: repeated axes or non-repeated axes. Computations are made using permutations so only two computations are needed. The distinction between static axes and moving axes corresponds to an inversion of the permutation. Negative parities just negate all the angles. These last two operations are easily performed at the end of a computation.
When computing a transform matrix from a given EulerAngles, the resulting matrix transforms the coordinates of a given vector from the body frame to the world frame. However, in accordance to the OpenGL convention, the matrix is to be multiplied from the left which amounts to transposing.
| MOMENTUM_NAMESPACE::EulerAngles::EulerAngles | ( | EulerConvention::Convention | C = EulerConvention::DEFAULT_CONVENTION | ) |
Default constructor.
Convention is set to EulerConvention::DEFAULT_CONVENTION and angles are set to 0. Convention is set to C and angles are set to 0.
| MOMENTUM_NAMESPACE::EulerAngles::EulerAngles | ( | const EulerAngles & | e | ) |
Copy constructor.
| MOMENTUM_NAMESPACE::EulerAngles::EulerAngles | ( | double | a, |
| double | b, | ||
| double | c, | ||
| int | C | ||
| ) |
Explicit constructor.
| MOMENTUM_NAMESPACE::EulerAngles::EulerAngles | ( | double | a, |
| double | b, | ||
| double | c, | ||
| EulerConvention::Convention | C = EulerConvention::DEFAULT_CONVENTION |
||
| ) |
Explicit constructor.
|
explicit |
Explicit constructor.
| MOMENTUM_NAMESPACE::EulerAngles::EulerAngles | ( | const Matrix4x4 & | m, |
| EulerConvention::Convention | C = EulerConvention::DEFAULT_CONVENTION |
||
| ) |
Construct from affine matrix in given convention.
| MOMENTUM_NAMESPACE::EulerAngles::EulerAngles | ( | const Quat & | q, |
| EulerConvention::Convention | C = EulerConvention::DEFAULT_CONVENTION |
||
| ) |
Construct from quaternion in given convention.
| std::pair< Matrix4x4, bool > MOMENTUM_NAMESPACE::EulerAngles::getAsMatrix4x4 | ( | Matrix4x4 | matrix | ) | const |
Compute the value of matrix m that corresponds to current angles in current convention.
| std::pair< Quat, bool > MOMENTUM_NAMESPACE::EulerAngles::getAsQuat | ( | ) | const |
Compute the value of quaternion q that corresponds to current angles in current convention.
| const EulerAngles::EulerOrder & MOMENTUM_NAMESPACE::EulerAngles::getOrder | ( | ) | const |
Get or set the convention.
| EulerAngles MOMENTUM_NAMESPACE::EulerAngles::operator= | ( | const EulerAngles & | e | ) |
Assignment operator.
| double & MOMENTUM_NAMESPACE::EulerAngles::operator[] | ( | int | i | ) |
Get an element by index as a reference.
| double MOMENTUM_NAMESPACE::EulerAngles::operator[] | ( | int | i | ) | const |
Get an element by index.
|
static |
| void MOMENTUM_NAMESPACE::EulerAngles::set | ( | const Matrix4x4 & | m, |
| EulerConvention::Convention | C = EulerConvention::BAD |
||
| ) |
Set the angles to correspond to matrix m in given convention.
By default, the convention used is the value stored in the present object. If the last argument is used, the convention is changed to the given value.
| void MOMENTUM_NAMESPACE::EulerAngles::set | ( | const Quat & | q, |
| EulerConvention::Convention | C = EulerConvention::BAD |
||
| ) |
Set the angles to correspond to quaternion q in given convention.
By default, the convention used is the value stored in the present object. If the last argument is used, the convention is changed to the given value.
| void MOMENTUM_NAMESPACE::EulerAngles::set | ( | const Vec3 & | angles | ) |
Set the three angles in one call.
| angles | - Angles specified in radians. |
| void MOMENTUM_NAMESPACE::EulerAngles::set | ( | double | x, |
| double | y, | ||
| double | z | ||
| ) |
Set the three angles in one call.
| x,y,z | - Angles specified in radians. |
| const EulerAngles::EulerOrder & MOMENTUM_NAMESPACE::EulerAngles::setOrder | ( | const EulerAngles::EulerOrder & | order | ) |
Get the convention.
| double MOMENTUM_NAMESPACE::EulerAngles::setX | ( | double | val | ) |
Get or set the first angle.
| double MOMENTUM_NAMESPACE::EulerAngles::setY | ( | double | val | ) |
Get or set the second angle.
| double MOMENTUM_NAMESPACE::EulerAngles::setZ | ( | double | val | ) |
Get or set the third angle.
| double MOMENTUM_NAMESPACE::EulerAngles::x | ( | ) | const |
Get the first angle.
| double MOMENTUM_NAMESPACE::EulerAngles::y | ( | ) | const |
Get the second angle.
| double MOMENTUM_NAMESPACE::EulerAngles::z | ( | ) | const |
Get the third angle.