Overview
The following functions manipulate quaternions.
Summary
Functions
rsQuaternionAdd
: Add two quaternions
Parameters
| q | Destination quaternion to add to. |
| rhs | Quaternion to add. |
Adds two quaternions, i.e. *q += *rhs;
rsQuaternionConjugate
: Conjugate a quaternion
Conjugates the quaternion.
rsQuaternionDot
: Dot product of two quaternions
Parameters
| q0 | First quaternion. |
| q1 | Second quaternion. |
Returns the dot product of two quaternions.
rsQuaternionGetMatrixUnit
: Get a rotation matrix from a quaternion
Parameters
| m | Resulting matrix. |
| q | Normalized quaternion. |
Computes a rotation matrix from the normalized quaternion.
rsQuaternionLoadRotate
: Create a rotation quaternion
| void rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z);
|
|
Parameters
| q | Destination quaternion. |
| rot | Angle to rotate by. |
| x | X component of a vector. |
| y | Y component of a vector. |
| z | Z component of a vector. |
Loads a quaternion that represents a rotation about an arbitrary vector
(doesn't have to be unit)
rsQuaternionLoadRotateUnit
: Quaternion that represents a rotation about an arbitrary unit vector
| void rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z);
|
|
Parameters
| q | Destination quaternion. |
| rot | Angle to rotate by, in radians. |
| x | X component of the vector. |
| y | Y component of the vector. |
| z | Z component of the vector. |
Loads a quaternion that represents a rotation about an arbitrary unit vector.
rsQuaternionMultiply
: Multiply a quaternion by a scalar or another quaternion
Parameters
| q | Destination quaternion. |
| scalar | Scalar to multiply the quaternion by. |
| rhs | Quaternion to multiply the destination quaternion by. |
Multiplies a quaternion by a scalar or by another quaternion, e.g
*q = *q * scalar; or *q = *q * *rhs;.
rsQuaternionNormalize
: Normalize a quaternion
Parameters
| q | Quaternion to normalize. |
Normalizes the quaternion.
rsQuaternionSet
: Create a quaternion
Parameters
| q | Destination quaternion. |
| w | W component. |
| x | X component. |
| y | Y component. |
| z | Z component. |
| rhs | Source quaternion. |
Creates a quaternion from its four components or from another quaternion.
rsQuaternionSlerp
: Spherical linear interpolation between two quaternions
Parameters
| q | Result quaternion from the interpolation. |
| q0 | First input quaternion. |
| q1 | Second input quaternion. |
| t | How much to interpolate by. |
Performs spherical linear interpolation between two quaternions.