Skip to content

Quaternion

Jesusemora edited this page Mar 15, 2023 · 1 revision

Vector4

Variables

Variable Description
float pos[4] naked array containing the values of Quaternion
float &x reference to the first element of pos[]. can be used as myQuaternion.x.
float &y reference to the second element of pos[]. can be used as myQuaternion.y.
float &z reference to the third element of pos[]. can be used as myQuaternion.z.
float &w reference to the fourth element of pos[]. can be used as myQuaternion.w.

public methods

Function Description
float Magnitude() returns non sqr magnitude of current Quaternion
float sqrMagnitude() returns sqr magnitude of current Quaternion
void QNormalize() normalizes current Quaternion
Quaternion inverse returns the inverse of the current quaternion

static methods

Function Description
float Dot(IVector4 a, IVector4 b) returns the dot product of a and b. IVector4 can be Vector4 or Quaternion
Quaternion Slerp(Quaternion a, Quaternion b, double c) returns correct quaternion spherical interpolation between a and b given c

constructors

Quaternion(float i, float j, float k, float l) generates a Quaternion containing the values i, j, k and l.
Quaternion(Vector3 eulerAxes) generates a Quaternion given the euler axes eulerAxes. values are in degrees
Quaternion(float x, float y, float z) generates a Quaternion given the euler axes x, y and z. values are in degrees
Quaternion generates a Quaternion filled with (0, 0, 0, 1) without parameters

operators

operator* returns a rotation between Quaternion by another Quaternion

operator*= rotates current Quaternion by another Quaternion

operator== returns true if both Quaternion are pointing in the same direction and false if they are not

operator= assigns a Quaternion to the current Quaternion

Clone this wiki locally