29 Quaternion(
float w,
float x,
float y,
float z) : w(w), x(x), y(y), z(z) {}
38 Quaternion(
int w,
int x,
int y,
int z) : w((float)w), x((float)x), y((float)y), z((float)z) {}
46 return (
float)sqrt((w*w) + (x*x) + (y*y) + (z*z));
57 float dp = Qa.
x*Qb.
x + Qa.
y*Qb.
y + Qa.
z*Qb.
z + Qa.
w * Qb.
w;
69 normalised.
w = w / length;
70 normalised.
x = x / length;
71 normalised.
y = y / length;
72 normalised.
z = z / length;
102 q3.
w = (q1.
w * q2.
w) - (q1.
x * q2.
x) - (q1.
y * q2.
y) - (q1.
z * q2.
z);
103 q3.
x = (q1.
w * q2.
x) + (q1.
x * q2.
w) + (q1.
y * q2.
z) - (q1.
z * q2.
y);
104 q3.
y = (q1.
w * q2.
y) - (q1.
x * q2.
z) + (q1.
y * q2.
w) + (q1.
z * q2.
x);
105 q3.
z = (q1.
w * q2.
z) + (q1.
x * q2.
y) - (q1.
y * q2.
x) + (q1.
z * q2.
w);
float y
Definition: Quaternion.h:14
float x
Definition: Quaternion.h:13
Quaternion operator*(Quaternion q1, Quaternion q2)
Overloads the * operator allowing a Quaternion to be multiplied by another Quaternion. IMPORTANT: (Quaternion1 * Quaternion2) != (Quaternion2 * Quaternion1)
Definition: Quaternion.h:99
float w
the variables for the Quaternions
Definition: Quaternion.h:12
float getDotProduct(Quaternion Qa, Quaternion Qb)
Returns the dot product of two Quaternions.
Definition: Quaternion.h:55
void rotate(Quaternion &quat, Vec3 axis, float angle)
Rotates a Quaternion.
Definition: Quaternion.cpp:5
Quaternion(int w, int x, int y, int z)
Constructs the Quaternion setting the values to the input coordinates.
Definition: Quaternion.h:38
Quaternion(float w, float x, float y, float z)
Constructs the Quaternion setting the values to the input coordinates.
Definition: Quaternion.h:29
Contains the Vec3 structure with functions and overloaded operators.
Definition: Vec3.h:8
float z
Definition: Quaternion.h:15
Mat4 getMatrix()
Gets a Mat4 from the Quaternion.
Definition: Quaternion.cpp:13
Quaternion()
Constructs the Quaternion setting the values to 1,0,0,0.
Definition: Quaternion.h:20
Contains the Quaternion structure with functions and overloaded operators.
Definition: Quaternion.h:9
Quaternion getNormalised()
Returns the normalised version of the Quaternion.
Definition: Quaternion.h:65
Contains the Mat4 structure with functions and overloaded operators. This is row major.
Definition: Mat4.h:9
float getLength()
Returns the length of the Quaternion.
Definition: Quaternion.h:44