Back to class index

Class Quat

Summary

Represents a rotation or an orientation of a 3D object.

Member Reference

QuatRepresents a rotation or an orientation of a 3D object.
xThe factor of i.
yThe factor of j.
zThe factor of k.
wThe scalar part. Sometimes also referred to as 'r'.
identity[static][const]The identity quaternion performs no rotation when applied to a vector.
nan[static][const]A compile-time constant Quat with value (NaN, NaN, NaN, NaN).
ctor (+7 overloads)
WorldX()[const]Returns the local +X axis in the post-transformed coordinate space. This is the same as transforming the vector (1,0,0) by this quaternion.
WorldY()[const]Returns the local +Y axis in the post-transformed coordinate space. This is the same as transforming the vector (0,1,0) by this quaternion.
WorldZ()[const]Returns the local +Z axis in the post-transformed coordinate space. This is the same as transforming the vector (0,0,1) by this quaternion.
Axis()[const]Returns the axis of rotation for this quaternion.
Angle()[const]Returns the angle of rotation for this quaternion, in radians.
Dot(rhs)[const]Computes the dot product of this and the given quaternion.
LengthSq()[const]
Length()[const]
Normalize()Normalizes this quaternion in-place.
Normalized()[const]Returns a normalized copy of this quaternion.
IsNormalized(epsilon)[const]Returns true if the length of this quaternion is one.
IsInvertible(epsilon)[const]
IsFinite()[const]Returns true if the entries of this quaternion are all finite.
Equals(rhs,epsilon)[const]Returns true if this quaternion equals rhs, up to the given epsilon.
BitEquals(other)[const]Compares whether this Quat and the given Quat are identical bit-by-bit in the underlying representation.
ptr() (+1 overload)Returns a pointer to the first element (x). The data is contiguous in memory. ptr[0] gives x, ptr[1] is y, ptr[2] is z and ptr[3] is w.
Inverse()Inverses this quaternion in-place.
Inverted()[const]Returns an inverted copy of this quaternion.
InverseAndNormalize()Inverses this quaternion in-place.
Conjugate()Computes the conjugate of this quaternion in-place.
Conjugated()[const]Returns a conjugated copy of this quaternion.
Transform(x,y,z)[const] (+2 overloads)Rotates the given vector by this quaternion.
Lerp(target,t)[const]
Slerp(target,t)[const]Implementation based on the math in the book Watt, Policarpo.
AngleBetween(target)[const]Returns the angle between this and the target orientation (the shortest route) in radians.
AxisFromTo(target)[const]Returns the axis of rotation to get from this orientation to target orientation (the shortest route).
ToAxisAngle(...)[const] (+1 overload)Returns the rotation axis and angle of this quaternion.
SetFromAxisAngle(...) (+1 overload)Sets this quaternion by specifying the axis about which the rotation is performed, and the angle of rotation.
Set(matrix) (+3 overloads)Sets this quaternion to represent the same rotation as the given matrix.
ToEulerXYX()[const]Extracts the rotation part of this quaternion into Euler rotation angles (in radians).
ToFloat3x3()[const]
ToFloat3x4()[const]
ToFloat4x4()[const] (+2 overloads)
ToString()[const]Returns "(x,y,z,w)".
ToString2()[const]Returns "Quat(axis:(x,y,z) angle:degrees)".
SerializeToString()[const]Returns "x,y,z,w". This is the preferred format for the quaternion if it has to be serialized to a string for machine transfer.
SerializeToCodeString()[const]Returns a string of C++ code that can be used to construct this object. Useful for generating test cases from badly behaving objects.
operator*(rhs)[const] (+2 overloads)Multiplies two quaternions together.
operator/(rhs)[const]Divides a quaternion by another. Division "a / b" results in a quaternion that rotates the orientation b to coincide with the orientation a.
operator+()[const]Unary operator + allows this structure to be used in an expression '+x'.
Mul(rhs)[const] (+3 overloads)Multiplies two quaternions in the order 'this * rhs'.
Neg()[const]Negates the quaternion.
Lerp(source,target,t)[static]
Slerp(source,target,t)[static]
SlerpVector(from,to,t)[static]Returns the 'from' vector rotated towards the 'to' vector by the given normalized time parameter.
SlerpVectorAbs(...)[static]Returns the 'from' vector rotated towards the 'to' vector by the given absolute angle, in radians.
LookAt(...)[static]Creates a LookAt quaternion.
RotateX(angleRadians)[static]Creates a new quaternion that rotates about the positive X axis by the given angle.
RotateY(angleRadians)[static]Creates a new quaternion that rotates about the positive Y axis by the given angle.
RotateZ(angleRadians)[static]Creates a new quaternion that rotates about the positive Z axis by the given angle.
RotateAxisAngle(...)[static]Creates a new Quat that rotates about the given axis by the given angle.
RotateFromTo(...)[static] (+2 overloads)Creates a new quaternion that rotates sourceDirection vector (in world space) to coincide with the targetDirection vector (in world space).
FromEuler***(x2,y,x)[static]Creates a new Quat from the given sequence of Euler rotation angles (in radians).
RandomRotation(lcg)[static]Returns a uniformly random unitary quaternion.
FromString(str,outEndStr)[static] (+1 overload)Parses a string that is of form "x,y,z,w" or "(x,y,z,w)" or "(x;y;z;w)" or "x y z w" to a new quaternion.
Back to class index