Quaternions
No game developer knows how they work, we just think it's name sounds cool.
No game developer knows how they work, we just think it's name sounds cool.
A quaternion is made up of a scalar w and a vector component.
A quaternion p can be listed as [w, v] or [ w, (x, y, z) ].
It's math is based on complex numbers and makes no sense for anyone.
To negate a quaternion we negate each component in it. -q =) [-w, -n]
The identity quaternion i = [1, 0].
The magnitude of a quaternion is ||q|| = sqrt(w2 + ||v||2).
The conjugate of q is obtained by negating the vector portion of the quaternion. q* = [w, -v]
The inverse of q is the conjugate divided by its magnitude. q-1 = q* / ||q||.
If only unit vectors are used then the inverse is the same as the conjugate.
Axis Angle Pair:
With n the axis of rotation and θ the angle around it then q = [ cos(θ/2), sin(θ/2)n, ) ].
Reference
Showing the Correctness of Quaternion Rotation
Approximating slerp - 2015
On Vector Math Libraries - 2013
Understanding Quaternions - 2013
Understanding Quaternions - 2012
Nested Complex Numbers - 2012
Quaternions part 1 - 2012
Points, Vertices and Vectors - 2011
Hacking Quaternions - 2002
Using Quaterions for Animation in OpenGL Part 2, Interpolation - 1998
Rotating a single vector using a quaternion
https://fgiesen.wordpress.com/2019/02/09/rotating-a-single-vector-using-a-quaternion/