scsl 1.0.1
Shimmering Clarity Standard Library
|
Quaternions provide a representation of Orientation and rotations in three dimensions. More...
#include <Quaternion.h>
Public Member Functions | |
Quaternion () | |
Construct an identity Quaternion. | |
Quaternion (Vector< T, 3 > _axis, T _angle) | |
Construct a Quaternion with an Axis and Angle of rotation. | |
Quaternion (Vector< T, 4 > vector) | |
Quaternion (std::initializer_list< T > ilst) | |
An initializer list containing values for w, x, y, and z. | |
void | SetEpsilon (T epsilon) |
Set the comparison tolerance for this Quaternion. | |
Vector< T, 3 > | Axis () const |
Return the Axis of rotation of this Quaternion. | |
T | Angle () const |
Return the Angle of rotation of this Quaternion. | |
T | Dot (const Quaternion< T > &other) const |
Compute the Dot product of two quaternions. | |
T | Norm () const |
Compute the Norm of a Quaternion. | |
Quaternion | UnitQuaternion () |
Return the unit Quaternion. | |
Quaternion | Conjugate () const |
Compute the Conjugate of a Quaternion. | |
Quaternion | Inverse () const |
Compute the Inverse of a Quaternion. | |
bool | IsIdentity () const |
Determine whether this is an identity Quaternion. | |
bool | IsUnitQuaternion () const |
Determine whether this is a unit Quaternion. | |
Vector< T, 4 > | AsVector () const |
Convert to Vector form. | |
Vector< T, 3 > | Rotate (Vector< T, 3 > vr) const |
Rotate Vector vr about this Quaternion. | |
Vector< T, 3 > | Euler () const |
Return Euler angles for this Quaternion. | |
Quaternion | operator+ (const Quaternion< T > &other) const |
Quaternion addition. | |
Quaternion | operator- (const Quaternion< T > &other) const |
Quaternion subtraction. | |
Quaternion | operator* (const T k) const |
Scalar multiplication. | |
Quaternion | operator/ (const T k) const |
Scalar division. | |
Quaternion | operator* (const Vector< T, 3 > &vector) const |
Quaternion Hamilton multiplication with a three- dimensional vector. | |
Quaternion | operator* (const Quaternion< T > &other) const |
Quaternion Hamilton multiplication. | |
bool | operator== (const Quaternion< T > &other) const |
Quaternion equivalence. | |
bool | operator!= (const Quaternion< T > &other) const |
Quaternion non-equivalence. | |
Friends | |
std::ostream & | operator<< (std::ostream &outs, const Quaternion< T > &q) |
Output a Quaternion to a stream in the form a + <i, j, k> . | |
Related Symbols | |
(Note that these are not member symbols.) | |
Quaternionf | MakeQuaternion (Vector3F axis, float angle) |
Convenience Quaternion construction function. | |
Quaterniond | MakeQuaternion (Vector3D axis, double angle) |
Convience Quaternion construction function. | |
template<typename T > | |
Quaternion< T > | MakeQuaternion (Vector< T, 3 > axis, T angle) |
Convience Quaternion construction function. | |
Quaternionf | FloatQuaternionFromEuler (Vector3F euler) |
COnstruct a Quaternion from Euler angles. | |
Quaterniond | DoubleQuaternionFromEuler (Vector3D euler) |
COnstruct a Quaternion from Euler angles. | |
Quaternions provide a representation of Orientation and rotations in three dimensions.
Quaternions encode rotations in three-dimensional space. While technically a MakeQuaternion is comprised of a real element and a complex vector<3>, for the purposes of this library, it is modeled as a floating point 4D vector of the form <w, x, y, z>, where x, y, and z represent an Axis of rotation in R3 and w the Angle, in radians, of the rotation about that Axis. Where Euler angles are concerned, the ZYX (or yaw, pitch, roll) sequence is used.
For information on the underlying vector type, see the documentation for scmp::geom::Vector.
Like vectors, quaternions carry an internal tolerance value ε that is used for floating point comparisons. The math namespace contains the default values used for this; generally, a tolerance of 0.0001 is considered appropriate for the uses of this library. The tolerance can be explicitly set with the SetEpsilon method.
|
inline |
Construct an identity Quaternion.
|
inline |
Construct a Quaternion with an Axis and Angle of rotation.
A Quaternion may be initialised with a Vector<T, 3> Axis of rotation and an Angle of rotation. This doesn't do the Angle transforms to simplify internal operations.
_axis | A three-dimensional vector of the same type as the Quaternion. |
_angle | The Angle of rotation about the Axis of rotation. |
A Quaternion may be initialised with a Vector<T, 4> comprised of the Axis of rotation followed by the Angle of rotation.
vector | A vector in the form <w, x, y, z>. |
|
inline |
An initializer list containing values for w, x, y, and z.
ilst | An initial set of values in the form <w, x, y, z>. |
|
inline |
Return the Angle of rotation of this Quaternion.
Convert to Vector form.
Return the Quaternion as a Vector<T, 4>, with the Axis of rotation followed by the Angle of rotation.
Return the Axis of rotation of this Quaternion.
|
inline |
Compute the Conjugate of a Quaternion.
|
inline |
Compute the Dot product of two quaternions.
other | Another Quaternion. |
Return Euler angles for this Quaternion.
Return the Euler angles for this Quaternion as a vector of <yaw, pitch, roll>.
|
inline |
Compute the Inverse of a Quaternion.
|
inline |
Determine whether this is an identity Quaternion.
|
inline |
Determine whether this is a unit Quaternion.
|
inline |
Compute the Norm of a Quaternion.
Treating the Quaternion as a Vector<T, 4>, this is the same process as computing the Magnitude.
|
inline |
Quaternion non-equivalence.
other | The Quaternion to check inequality against. |
|
inline |
Quaternion Hamilton multiplication.
other | The other Quaternion to multiply with this one. |
|
inline |
|
inline |
Quaternion Hamilton multiplication with a three- dimensional vector.
This is done by treating the vector as a pure Quaternion (e.g. with an Angle of rotation of 0).
vector | The vector to multiply with this Quaternion. |
|
inline |
Quaternion addition.
other | The Quaternion to be added with this one. |
|
inline |
Quaternion subtraction.
other | The Quaternion to be subtracted from this one. |
|
inline |
|
inline |
Quaternion equivalence.
other | The Quaternion to check equality against. |
Rotate Vector vr about this Quaternion.
vr | The vector to be rotated. |
Set the comparison tolerance for this Quaternion.
epsilon | A tolerance value. |
|
inline |
Return the unit Quaternion.
|
related |
COnstruct a Quaternion from Euler angles.
Given a vector of Euler angles in ZYX sequence (e.g. yaw, pitch, roll), return a Quaternion.
euler | A vector Euler Angle in ZYX sequence. |
|
related |
COnstruct a Quaternion from Euler angles.
Given a vector of Euler angles in ZYX sequence (e.g. yaw, pitch, roll), return a Quaternion.
euler | A vector Euler Angle in ZYX sequence. |
|
related |
Convience Quaternion construction function.
Return a double Quaternion scaled appropriately from a vector and Angle, e.g. Angle = cos(Angle / 2), Axis.UnitVector() * sin(Angle / 2).
axis | The Axis of rotation. |
angle | The Angle of rotation. |
|
related |
Convenience Quaternion construction function.
Return a float Quaternion scaled appropriately from a vector and Angle, e.g. angle = cos(Angle / 2), Axis.UnitVector() * sin(Angle / 2).
axis | The Axis of rotation. |
angle | The Angle of rotation. |
|
related |
Convience Quaternion construction function.
Return a double Quaternion scaled appropriately from a vector and Angle, e.g. Angle = cos(Angle / 2), Axis.UnitVector() * sin(Angle / 2).
axis | The Axis of rotation. |
angle | The Angle of rotation. |
|
friend |
Output a Quaternion to a stream in the form a + <i, j, k>
.
outs | An output stream |
q | A Quaternion |