![]() |
RoboidControl for Arduino
|
A quaternion. More...
#include <Quaternion.h>
Public Member Functions | |
| Quaternion () | |
| Create a new identity quaternion. | |
| Quaternion (float _x, float _y, float _z, float _w) | |
| create a new quaternion with the given values | |
| Quaternion (Quat q) | |
| Create a quaternion from C-style Quat. | |
| ~Quaternion () | |
| void | Normalize () |
| Convert to unit quaternion. | |
| Vector3 | operator* (const Vector3 &vector) const |
| Rotate a vector using this quaterion. | |
| Quaternion | operator* (const Quaternion &rotation) const |
| Multiply this quaternion with another quaternion. | |
| bool | operator== (const Quaternion &quaternion) |
| Check the equality of two quaternions. | |
| void | ToAngleAxis (float *angle, Vector3 *axis) |
| Convert this quaternion to angle/axis representation. | |
Static Public Member Functions | |
| static Quaternion | Normalize (const Quaternion &q) |
| Convert to unity quaternion. | |
| static Vector3 | ToAngles (const Quaternion &q) |
| Convert to euler angles. | |
| static Quaternion | Inverse (Quaternion quaternion) |
| The inverse of quaterion. | |
| static Quaternion | LookRotation (const Vector3 &forward, const Vector3 &upwards) |
| A rotation which looks in the given direction. | |
| static Quaternion | LookRotation (const Vector3 &forward) |
| Creates a quaternion with the given forward direction with up = Vector3::up. | |
| static Quaternion | FromToRotation (Vector3 fromDirection, Vector3 toDirection) |
| Calculat the rotation from on vector to another. | |
| static Quaternion | RotateTowards (const Quaternion &from, const Quaternion &to, float maxDegreesDelta) |
| Rotate form one orientation to anther with a maximum amount of degrees. | |
| static Quaternion | AngleAxis (float angle, const Vector3 &axis) |
| Convert an angle/axis representation to a quaternion. | |
| static float | Angle (Quaternion orientation1, Quaternion orientation2) |
| Get the angle between two orientations. | |
| static Quaternion | Slerp (const Quaternion &rotation1, const Quaternion &rotation2, float factor) |
| Sherical lerp between two rotations. | |
| static Quaternion | SlerpUnclamped (const Quaternion &rotation1, const Quaternion &rotation2, float factor) |
| Unclamped sherical lerp between two rotations. | |
| static Quaternion | Euler (float x, float y, float z) |
| Create a rotation from euler angles. | |
| static Quaternion | Euler (Vector3 eulerAngles) |
| Create a rotation from a vector containing euler angles. | |
| static Quaternion | EulerXYZ (float x, float y, float z) |
| Create a rotation from euler angles. | |
| static Quaternion | EulerXYZ (Vector3 eulerAngles) |
| Create a rotation from a vector containing euler angles. | |
| static float | GetAngleAround (Vector3 axis, Quaternion rotation) |
| Returns the angle of around the give axis for a rotation. | |
| static Quaternion | GetRotationAround (Vector3 axis, Quaternion rotation) |
| Returns the rotation limited around the given axis. | |
| static void | GetSwingTwist (Vector3 axis, Quaternion rotation, Quaternion *swing, Quaternion *twist) |
| Swing-twist decomposition of a rotation. | |
| static float | Dot (Quaternion rotation1, Quaternion rotation2) |
| Calculate the dot product of two quaternions. | |
Public Attributes | |
| float | x |
| The x component. | |
| float | y |
| The y component. | |
| float | z |
| The z component. | |
| float | w |
| The w component. | |
Static Public Attributes | |
| static const Quaternion | identity = Quaternion(0, 0, 0, 1) |
| An identity quaternion. | |
A quaternion.
| Quaternion::Quaternion | ( | ) |
Create a new identity quaternion.
| Quaternion::Quaternion | ( | float | _x, |
| float | _y, | ||
| float | _z, | ||
| float | _w | ||
| ) |
create a new quaternion with the given values
| _x | x component |
| _y | y component |
| _z | z component |
| _w | w component |
| Quaternion::~Quaternion | ( | ) |
| void Quaternion::Normalize | ( | ) |
Convert to unit quaternion.
This will preserve the orientation, but ensures that it is a unit quaternion.
|
static |
Convert to unity quaternion.
| q | The quaternion to convert |
This will preserve the orientation, but ensures that it is a unit quaternion.
|
static |
Convert to euler angles.
| q | The quaternion to convert |
The euler angles performed in the order: Z, X, Y
Rotate a vector using this quaterion.
| vector | The vector to rotate |
| Quaternion Quaternion::operator* | ( | const Quaternion & | rotation | ) | const |
Multiply this quaternion with another quaternion.
| rotation | The quaternion to multiply with |
The result will be this quaternion rotated according to the give rotation.
| bool Quaternion::operator== | ( | const Quaternion & | quaternion | ) |
Check the equality of two quaternions.
| quaternion | The quaternion to compare to |
Note that this does not compare the rotations themselves. Two quaternions with the same rotational effect may have different components. Use Quaternion::Angle to check if the rotations are the same.
|
static |
The inverse of quaterion.
| quaternion | The quaternion for which the inverse is needed |
|
static |
A rotation which looks in the given direction.
| forward | The look direction |
| upwards | The up direction |
|
static |
Creates a quaternion with the given forward direction with up = Vector3::up.
| forward | The look direction |
For the rotation, Vector::up is used for the up direction. Note: if the forward direction == Vector3::up, the result is Quaternion::identity
|
static |
Calculat the rotation from on vector to another.
| fromDirection | The from direction |
| toDirection | The to direction |
|
static |
Rotate form one orientation to anther with a maximum amount of degrees.
| from | The from rotation |
| to | The destination rotation |
| maxDegreesDelta | The maximum amount of degrees to rotate |
|
static |
Convert an angle/axis representation to a quaternion.
| angle | The angle |
| axis | The axis |
| void Quaternion::ToAngleAxis | ( | float * | angle, |
| Vector3 * | axis | ||
| ) |
Convert this quaternion to angle/axis representation.
| angle | A pointer to the angle for the result |
| axis | A pointer to the axis for the result |
|
static |
Get the angle between two orientations.
| orientation1 | The first orientation |
| orientation2 | The second orientation |
|
static |
Sherical lerp between two rotations.
| rotation1 | The first rotation |
| rotation2 | The second rotation |
| factor | The factor between 0 and 1. |
A factor 0 returns rotation1, factor1 returns rotation2.
|
static |
Unclamped sherical lerp between two rotations.
| rotation1 | The first rotation |
| rotation2 | The second rotation |
| factor | The factor |
A factor 0 returns rotation1, factor1 returns rotation2. Values outside the 0..1 range will result in extrapolated rotations
|
static |
Create a rotation from euler angles.
| x | The angle around the right axis |
| y | The angle around the upward axis |
| z | The angle around the forward axis |
Rotation are appied in the order Z, X, Y.
|
static |
Create a rotation from a vector containing euler angles.
| eulerAngles | Vector with the euler angles |
Rotation are appied in the order Z, X, Y.
|
static |
Create a rotation from euler angles.
| x | The angle around the right axis |
| y | The angle around the upward axis |
| z | The angle around the forward axis |
Rotation are appied in the order X, Y, Z.
|
static |
Create a rotation from a vector containing euler angles.
| eulerAngles | Vector with the euler angles |
Rotation are appied in the order X, Y, Z.
|
static |
Returns the angle of around the give axis for a rotation.
| axis | The axis around which the angle should be computed |
| rotation | The source rotation |
|
static |
Returns the rotation limited around the given axis.
| axis | The axis which which the rotation should be limited |
| rotation | The source rotation |
|
static |
Swing-twist decomposition of a rotation.
| axis | The base direction for the decomposition |
| rotation | The source rotation |
| swing | A pointer to the quaternion for the swing result |
| twist | A pointer to the quaternion for the twist result |
|
static |
Calculate the dot product of two quaternions.
| rotation1 | The first rotation |
| rotation2 | The second rotation |
|
static |
An identity quaternion.
|
inherited |
The x component.
|
inherited |
The y component.
|
inherited |
The z component.
|
inherited |
The w component.