Would someone who understands 3d graphics give me a rundown of the API in Quaternion.h? In particular, I don’t understand what rotateUnit{X,Y,Z} do.
My understanding of a Quaternion is that it represents a rotation - three of the numbers represent a vector, while the fourth number represents the angle we rotate around that vector. Is that accurate? Is there anything else they’re used for? Couldn’t we also represent any rotation with just three angles, representing rotation around the x/y/z axes?
Rotation quaternion represents the axis and angle of rotation. Just by defining the multiplication operator on quaternions, you can create any type of rotation:
Q' = U * Q * conjugate(U)
where Q -- your interest quaternion; U -- rotation quaternion. Moreover, you can combine this rotation by adding rotation quaternions:
Q' = U1 * U2 * Q * conjugate(U1) * conjugate(U2)
Quaternions and rotation matrices are quite equivalent if you use separate rotation along the axis. For the matrices combining rotation would be just multiplication. But there exists gimbal lock
Quaternion rotation is not so interesting. Here an example with vectors, but insides have done with quaternion:
3
u/lord_braleigh Nov 26 '20
Would someone who understands 3d graphics give me a rundown of the API in Quaternion.h? In particular, I don’t understand what
rotateUnit{X,Y,Z}do.My understanding of a Quaternion is that it represents a rotation - three of the numbers represent a vector, while the fourth number represents the angle we rotate around that vector. Is that accurate? Is there anything else they’re used for? Couldn’t we also represent any rotation with just three angles, representing rotation around the x/y/z axes?