OMG. I don’t even know what I was writing. I think I was trying to redefine stuff to be easier to understand and logic failed.
I’m not very strong with the math part of quaternions, but I am very strong with other stuff, and I stand by everything I said after [quote]and where multiplication with i is component-wise.[/quote].
However, minus the stupid component wise shit I tried to do, the construction I provided IS very valid, though I see now it’s not what I said it was.
qw = a dot b
qx, qy, qz = a cross b
Anyway, to make this a good post, here’s a useful way to construct quaternion.
qw = a dot b
qx, qy, qz = a cross b
That generates a quaternion twice rotated from a to b, so if we slerp a vector half way from a to b, we can use this to construct a quaternion which is rotated from a to b once.
Instead of slerping, we can just do c = (a+b)/||a+b||, which is just:
Btw, been wanting to get into quaternions for a while because of interpolation on matrices natively doesn’t yield very good results, but my math book doesn’t go into quaternions, so I never took the step (also, tbh, a little frightened by them, and the strange voodoo talk people give when talking about them), I’d love for you to write a tutorial on them :D[/quote]
I attempted the same thing once. It’s easy to interpolate between two vectors of course, using addition and scalar multiplication. It’s not quite so easy with rotations however because they are fundamentally different from the real numbers.
In the familiar setting of Euclidean space, we know that the shortest path between two points is the line segment connecting them. But in “rotation matrix space”, the shortest path between two points is a geodesic–an arc along the great circle passing through them. So already we see that we cannot treat rotations like ordinary numbers.
The quaternions are the number system which harbor 3-dimensional (and 4 dimensional) rotations in their most “natural” form, in a similar fashion to how the complex numbers are the most natural setting for 2-dimensional rotation problems.
For plain, constant-speed spherical interpolation, quaternions are not necessary–they actually are sub-optimal in this particular case. Trey demonstrated quaternion-free SLerping a while back using the axis-angle parameterization. But if you want more control over the interpolation process, then quaternions are nice because they obey most of the common rules of arithmetic, save for the commutative law of multiplication. You can actually define analogous, “quaternionic” counterparts for the complex exponential & logarithm over the quaternions, which make applying calculus more straightforward.
I’m very very late to this, but thank you
You should write more articles, something about the way you explain things lets me grasp concepts much more easily than I could in the past with other resources