Really quick intro to transforming vertices with quaternions
Transforming Vertices with Quaternions
Quaternions are commonly used for rotating objects in 3D. We will eventually be investigating their true nature
(as rotors in geometric algebra), but those of you itching to transform your vertices algorithmically you can use this quickstart tidbit.
The following code will take the $x$ axis vector and rotate it by $\frac{\pi}{2}$ radians about the $z$ axis:
Notice that we feed an axis of rotation and an angle to the setAxisAngle method of our Quaternion, and then call apply on
some input vector to get a new rotated vector.
Going further, below is some code for creating a sphere, using spherical coordinates $(\theta,\phi)$. We’ll go over this in depth in class on Wednesday.