A quaternion, used to represent 3D rotation.
A quaternion is comprised of a scalar (w) and a vector (v). The vector is used to represent the axis of rotation, while the scalar is used to represent the amount of rotation.
Definition at line 12 of file Quat.hh.
|
constexpr | Quatf (const Quatf &q)=default |
|
constexpr | Quatf (f32 w_, const Vector3f &v_) |
|
constexpr | Quatf (f32 w_, f32 x_, f32 y_, f32 z_) |
|
Quatf & | operator= (const Quatf &q) |
|
Quatf | operator+ (const Quatf &rhs) const |
|
Quatf & | operator+= (const Quatf &rhs) |
|
Quatf | operator* (const Vector3f &vec) const |
|
Quatf | operator* (f32 scalar) const |
|
Quatf & | operator*= (f32 scalar) |
|
Quatf | operator* (const Quatf &rhs) const |
|
Quatf & | operator*= (const Quatf &q) |
|
bool | operator== (const Quatf &rhs) const |
|
bool | operator!= (const Quatf &rhs) const |
|
| operator std::string () const |
| A conversion function that allows for string representation of a quaternion.
|
|
void | setRPY (const Vector3f &rpy) |
| Sets roll, pitch, and yaw.
|
|
void | setRPY (f32 r, f32 p, f32 y) |
| Helper function to avoid unnecessary Vector3f construction.
|
|
void | normalise () |
| Scales the quaternion to a unit length.
|
|
void | makeVectorRotation (const Vector3f &from, const Vector3f &to) |
| Captures rotation between two vectors.
|
|
Quatf | conjugate () const |
| Computes \(conj(a+bi+cj+dk) = a-bi-cj-dk\).
|
|
Vector3f | rotateVector (const Vector3f &vec) const |
| Rotates a vector based on the quat.
|
|
Vector3f | rotateVectorInv (const Vector3f &vec) const |
| Rotates a vector on the inverse quat.
|
|
Quatf | slerpTo (const Quatf &q2, f32 t) const |
| Performs spherical linear interpolation.
|
|
f32 | squaredNorm () const |
| Computes \(this \cdot this = w^2 + x^2 + y^2 + z^2\).
|
|
f32 | norm () const |
|
f32 | dot (const Quatf &q) const |
| Computes \(this \cdot rhs = w \times rhs.w + x \times rhs.x + y \times rhs.y + z
\times rhs.z\).
|
|
void | setAxisRotation (f32 angle, const Vector3f &axis) |
| Set the quat given angle and axis.
|
|
Quatf | multSwap (const Vector3f &v) const |
|
Quatf | multSwap (const Quatf &q) const |
|
void | read (Stream &stream) |
|