Clutter Engine 0.0.1
|
Represents a quaternion for 3D rotations. More...
#include <Quaternion.h>
Public Member Functions | |
Quaternion () | |
Default constructor. Initializes to identity quaternion. | |
Quaternion (float inX, float inY, float inZ, float inW) | |
Directly sets the quaternion components. | |
Quaternion (const Vector3 &axis, float angle) | |
Constructs the quaternion from an axis and angle. | |
Quaternion (float inAll) | |
Sets all components to the same value. | |
void | Set (float inX, float inY, float inZ, float inW) |
Sets the quaternion components. | |
void | Conjugate () |
Conjugates the quaternion. | |
void | Normalize () |
Normalizes the quaternion in place. | |
float | LengthSqr () const |
Returns the squared length of the quaternion. | |
float | Length () const |
Returns the length (magnitude) of the quaternion. | |
Quaternion | Normalized () const |
Returns a normalized copy of the quaternion. | |
Quaternion | Inverse () const |
Returns the inverse of the quaternion. | |
Vector3 | QuaternionToEuler () const |
Converts the quaternion to Euler angles (in radians). | |
std::string | ToString () |
Returns a string representation of the quaternion. | |
class Matrix4 | AsMatrix () const |
Converts the quaternion to a 4x4 matrix. | |
class Matrix4Row | AsMatrixRow () const |
Converts the quaternion to a row-major 4x4 matrix. | |
Static Public Member Functions | |
static Quaternion | Normalize (const Quaternion &q) |
Returns a normalized copy of the provided quaternion. | |
static Quaternion | Lerp (const Quaternion &a, const Quaternion &b, float f) |
Linearly interpolates between two quaternions. | |
static float | Dot (const Quaternion &a, const Quaternion &b) |
Computes the dot product of two quaternions. | |
static Quaternion | Slerp (const Quaternion &a, const Quaternion &b, float f) |
Spherical linear interpolation between two quaternions. | |
static Quaternion | Concatenate (const Quaternion &q, const Quaternion &p) |
Concatenates two quaternions (applies q, then p). | |
static Quaternion | FromEuler (const Vector3 &axis) |
Creates a quaternion from Euler angles (in degrees). | |
static Quaternion | LookAt (const Vector3 &sourcePoint, const Vector3 &targetPoint, const Vector3 &up=Vector3::Up) |
Creates a quaternion that rotates from sourcePoint to targetPoint. | |
Public Attributes | |
float | x |
X component. | |
float | y |
Y component. | |
float | z |
Z component. | |
float | w |
W (scalar) component. | |
Static Public Attributes | |
static const Quaternion | Identity |
The identity quaternion (no rotation). | |
Represents a quaternion for 3D rotations.
Quaternion::Quaternion | ( | float | inX, |
float | inY, | ||
float | inZ, | ||
float | inW ) |
Directly sets the quaternion components.
inX | X component |
inY | Y component |
inZ | Z component |
inW | W (scalar) component |
Quaternion::Quaternion | ( | const Vector3 & | axis, |
float | angle ) |
Constructs the quaternion from an axis and angle.
axis | Normalized axis of rotation |
angle | Angle in radians |
Quaternion::Quaternion | ( | float | inAll | ) |
Sets all components to the same value.
inAll | Value for all components |
Matrix4 Quaternion::AsMatrix | ( | ) | const |
Converts the quaternion to a 4x4 matrix.
Matrix4Row Quaternion::AsMatrixRow | ( | ) | const |
Converts the quaternion to a row-major 4x4 matrix.
|
inlinestatic |
Concatenates two quaternions (applies q, then p).
q | First quaternion |
p | Second quaternion |
|
inlinestatic |
Computes the dot product of two quaternions.
a | First quaternion |
b | Second quaternion |
|
inlinestatic |
Creates a quaternion from Euler angles (in degrees).
axis | Euler angles (degrees) for x, y, z |
|
inline |
Returns the inverse of the quaternion.
|
inline |
Returns the length (magnitude) of the quaternion.
|
inline |
Returns the squared length of the quaternion.
|
inlinestatic |
Linearly interpolates between two quaternions.
a | Start quaternion |
b | End quaternion |
f | Interpolation factor [0, 1] |
|
inlinestatic |
Creates a quaternion that rotates from sourcePoint to targetPoint.
sourcePoint | Source position |
targetPoint | Target position |
up | Up direction (default: Vector3::Up) |
|
inlinestatic |
Returns a normalized copy of the provided quaternion.
q | Quaternion to normalize |
|
inline |
Returns a normalized copy of the quaternion.
|
inline |
Converts the quaternion to Euler angles (in radians).
void Quaternion::Set | ( | float | inX, |
float | inY, | ||
float | inZ, | ||
float | inW ) |
Sets the quaternion components.
inX | X component |
inY | Y component |
inZ | Z component |
inW | W (scalar) component |
|
inlinestatic |
Spherical linear interpolation between two quaternions.
a | Start quaternion |
b | End quaternion |
f | Interpolation factor [0, 1] |
|
inline |
Returns a string representation of the quaternion.