How Quaternions encode rotations: derivation and sample code
Anyone interested in such topics should check out geometric algebra, a.k.a. Clifford algebra. Start with <a href="http://geocalc.clas.asu.edu/pdf/OerstedMedalLecture.pdf" rel="nofollow">http://geocalc.clas.asu.edu/pdf/OerstedMedalLecture.pdf</a><p>Matrices and trigonometry are in my opinion a pedagogically, conceptually, and practically poor way of understanding and using quaternions; furthermore, cross products (and the associated confusion about a right hand rule and polar vs. axial vectors and so on, not to mention a total failure to generalize to higher dimensions) need to vanish from the earth.<p>More generally, this is a topic that should be explained first using pictures, ideally interactive ones. The algebraic manipulations to formally prove what the pictures explain visually should just fill in the bookkeeping details.<p>Finally, perhaps the most important reason geometric (Clifford) algebras should be used for pedagogy, even if you plan to write code which only uses quaternions per se, is that they make the “sandwich” multiplication of versors as operators on vectors completely obvious as composition of reflections.