by the__alchemist · 3y ago · 0 comments
#2: Quaternions as a powerful tool for representing orientations and rotations. Applicable whenever you're programming something that uses these concepts. Most common are computer graphics and robotics, but you can imagine other uses like biometrics, scientific models of molecules etc.
The visualizations you might use for type 2 are standard 2D and 3D space operations. You don't need to directly map the 4 quaternion parameters. You need these building blocks; find from a library, article, first-principles etc.
- Rotate a vector using a quaternion
- Find the quaternion that specifies the shortest rotation from one vector to another
- Find the quaternion that rotates around a given axis a given amount
- Rotate an orientation and/or composing rotations
- Find the quaternion that rotates one orientation to another
Using these building blocks (And maybe one or 2 I left out), you can do any sort of work with rotations and orientations. If you can visualize the rotations, either in your head, or with physical objects or a computer render, you won't forget the principles.Warning: There are 2 types of quaternions (JPL and Hamilton). Every article/lib etc uses one, but they rarely annotate which! Mixing the 2 will produce incorrect results.
The fascinating thing, to me, is that for so many geometrical objects, you can start with a short list of straightforward properties, and show that they exactly correspond to the collection-of-numbers concept over an arbitrary basis. Oftentimes, if you want to do something to the stuff on your screen, if you can describe it in terms of the abstract objects with no reference to the basis, you can then transliterate that to operations on a bunch of floats in a way that is simpler and more robust than working with the floats from the beginning.
(although you can assign whichever axis to whichever quaternion you want, and you can arbitrarily swap i<>-i, j<>-j, k<>-k. From googling it looks like the JPL convention is to swap k<>-k, such that ij = -k instead of ij = k).
But once you get into something more sophisticated like using rotations in a dynamical system, statistical filtering, optimizing a rotation, etc., the abstractions begin to leak.