Public Member Functions |
| Quat3D (void) |
| Constructor. Initialzes w, x, y, z to zero.
|
| Quat3D (const T dw, const T dx, const T dy, const T dz) |
| Constructor with specified individual values.
|
| Quat3D (const Quat3D &QuatIn) |
| Copy constructor.
|
| Quat3D (const Vec3D< T > &VecIn) |
| Constructs this quaternion from rotation vector VecIn. See FromRotationVector().
|
| Quat3D (const T angle, const Vec3D< T > &axis) |
| Constructs this quaternion from an angle in radians and a unit axis.
|
| Quat3D (const Vec3D< T > &RotateFrom, const Vec3D< T > &RotateTo) |
| Constructs this quaternion to represent the rotation from two vectors. The vectors need not be normalized and are not modified.
|
template<typename U > |
| Quat3D (const Quat3D< U > &QuatIn) |
| Copy constructor from another template type.
|
template<typename U > |
| Quat3D (const Vec3D< U > &VecIn) |
| Copies x, y, z from the specified vector and sets w to zero.
|
template<typename U > |
| operator Quat3D< U > () const |
| overload conversion operator for different template types
|
template<typename U > |
Quat3D< T > | operator= (const Quat3D< U > &s) |
| Equals operator for different template types.
|
template<typename U > |
const Quat3D< T > | operator+ (const Quat3D< U > &s) |
| Addition operator for different template types.
|
template<typename U > |
const Quat3D< T > | operator* (const U &f) const |
| Scalar multiplication operator for different template types.
|
template<typename U > |
const Quat3D< T > | operator* (const Quat3D< U > &f) const |
| Quaternion multplication operator for different template types.
|
Quat3D & | operator= (const Quat3D &s) |
| overload equals
|
const Quat3D | operator+ (const Quat3D &s) const |
| overload additoon
|
const Quat3D | operator- (const Quat3D &s) const |
| overload subtraction
|
const Quat3D | operator* (const T f) const |
| overload scalar multiplication
|
const Quat3D friend | operator* (const T f, const Quat3D v) |
| overload scalar multiplication with number first.
|
const Quat3D | operator* (const Quat3D &f) const |
| overload quaternion multiplication.
|
bool | operator== (const Quat3D &s) const |
| overload is equal.
|
bool | operator!= (const Quat3D &s) const |
| overload is not equal.
|
const Quat3D & | operator+= (const Quat3D &s) |
| overload add and set
|
const Quat3D & | operator-= (const Quat3D &s) |
| overload subtract and set
|
const Vec3D< T > | ToVec () const |
| Explicit casting to a vector. Throws away w and copies x, y, z directly.
|
const T | Length () const |
| Returns the length (magnitude) of the quaternion.
|
const T | Length2 () const |
| Returns the length (magnitude) squared of the quaternion.
|
const T | Normalize () |
| Normalizes this quaternion. Returns the previous magnitude of this quaternion before normalization. Note: function changes this quaternion.
|
void | NormalizeFast () |
| Normalizes this quaternion slightly faster than Normalize() by not returning a value. Note: function changes this quaternion.
|
const Quat3D | Inverse () const |
| Returns a quaternion that is the inverse of this quaternion. This quaternion is not modified.
|
const Quat3D | Conjugate () const |
| Returns a quaternion that is the conjugate of this quaternion. This quaternion is not modified.
|
const T | Angle () const |
| Returns the angular rotation of this quaternion in radians.
|
const T | AngleDegrees () const |
| Returns the angular rotation of this quaternion in degrees.
|
bool | IsNegligibleAngle () const |
| Returns true if the angular rotation of this quaternion is likely to be considered negligible.
|
bool | IsSmallAngle () const |
| Returns true if the angular rotation of this quaternion is small enough to be a good candidate for small angle approximations.
|
Vec3D< T > | Axis () const |
| Returns the normalized axis of rotation of this quaternion.
|
Vec3D< T > | AxisUnNormalized () const |
| Returns the un0normalized axis of rotation of this quaternion.
|
void | AngleAxis (T &angle, Vec3D< T > &axis) const |
| Returns the angle and a normalize axis that represent this quaternion's rotation.
|
void | AngleAxisUnNormalized (T &angle, Vec3D< T > &axis) const |
| Returns the angle and an un-normalized axis that represent this quaternion's rotation.
|
const Vec3D< T > | ToRotationVector () const |
| Returns a rotation vector representing this quaternion rotation. Adapted from http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToAngle/.
|
void | FromRotationVector (const Vec3D< T > &VecIn) |
| Overwrites this quaternion with values from the specified rotation vector. Adapted from http://physicsforgames.blogspot.com/2010/02/quaternions.html. Note: function changes this quaternion.
|
void | FromAngleToPosX (const Vec3D< T > &RotateFrom) |
| Overwrites this quaternion with the calculated rotation that would transform the specified RotateFrom vector to point in the positve X direction. Note: function changes this quaternion.
|
const Vec3D< T > | RotateVec3D (const Vec3D< T > &f) const |
| Returns a vector representing the specified vector "f" rotated by this quaternion.
|
template<typename U > |
const Vec3D< U > | RotateVec3D (const Vec3D< U > &f) const |
| Returns a vector representing the specified vector "f" rotated by this quaternion. Mixed template parameter version.
|
const Vec3D< T > | RotateVec3DInv (const Vec3D< T > &f) const |
| Returns a vector representing the specified vector "f" rotated by the inverse of this quaternion. This is the opposite of RotateVec3D.
|
template<typename U > |
const Vec3D< U > | RotateVec3DInv (const Vec3D< U > &f) const |
| Returns a vector representing the specified vector "f" rotated by the inverse of this quaternion. This is the opposite of RotateVec3D. Mixed template parameter version.
|
Public Attributes |
T | w |
| The current W value.
|
T | x |
| The current X value.
|
T | y |
| The current Y value.
|
T | z |
| The current Z value.
|
template<typename T = double>
class Quat3D< T >
A generic 3D quaternion template.
The template parameter is assumed to be either float or double depending on the desired numerical resolution.