AHHHHHH I finally understand quaternions!! XDD :DD

I always thought they were neat fun thing in abstract algebra and a neat but arbitrary way of representing rotations with unnecessarily extra numbers.

If someone had just said to me this sentence I would have seen how insanely perfect they are!! :D

As rotations, the i/j/k coefficients are the x/y/z components of the axis-of-rotation vector, and the fourth lone number is the amount of the rotation in radians!

@dannyboy :D!

Well it's actually a little bit different than I said there; I corrected myself a few posts down ^^'

But you know how in a given coordinate system, a 3D vector is basically just 3 numbers?

Well in a coordinate system, a quaternion is basically a group of four numbers! Usually called a,b,c,d



Now a bit of background: all rotations can be thought of as rotations around an axis and an amount/angle of rotation around it, right? :>

You can even take *as many rotations as you like* about *different* axes and combine them together into one probably-bizarre rotation about a single very particular axis and a single very particular angle!

That's en.wikipedia.org/wiki/Euler%27 :>



To store a 3D axis and an angle, that would take four numbers, right? Three for the axis vector and one for the degrees/radians :>

Quaternions are simply a way of storing those four numbers in a way that's very nice because in quaternion form, the expensive trig functions are precomputed/cached!

And all you need to do to rotate a vector by a quaternion is just multiplication and addition! :D

(A lot like a rotation matrix! But a quaternion only takes 4 numbers not 9!)



So here are the formulas for that!

For quaternion = (a,b,c,d)

a = cos(θ/2)
b = x * sin(θ/2)
c = y * sin(θ/2)
d = z * sin(θ/2)

Where x/y/z are the coordinates of the axis of rotation vector and θ is the amount/angle of rotation in radians :D



The other important formulas are how to multiply quaternions, which like for matrices, corresponds to composing transforms (a * b = rotation by b then by a), and the formula for actually transforming a vector given its x/y/z, but I'll let you look those up on your own since they're a lot to put here XD'
(I might add them later though, for reference ^^' )







The important interpretation/applications of quaternions for us here is that:

A quaternion represents a single rotation in 3D space out of all possible rotations!

Yaw/pitch/roll and Euler x/y/z angles and Axis-and-Amount and Quaternions are all just ways of representing the exact same thing: any possible rotation of an object (or point or set of points) in 3D space :>



But there are other cool things about quaternions, like how they can also be thought of as a *division* of vectors, like how dot and cross products can be thought of as multiplications! And how they can be thought of as an extension of complex numbers (which is why you might see them as a + b*i + c*j + d*k where if c and d = 0 it *is* a typical everyday complex number! :D )

I think this is where that i/j/k notation for unit vectors (as opposed to x/y/z) comes from too!




But like in anything in math, these are all interpretations/applications of the thing; the only objectively correct/real thing is the connections between them :>


· · Web · 1 · 0 · 1


If any of that wasn't clear or you've got any questions about that or the background stuff, feel free to ask! :D

@codepuppy I'm still parsing things, but the Wikipedia page en.m.wikipedia.org/wiki/Quater contains a lot of the useful applied properties you covered here. It's doing a lot more to help me understand than the main quaternions page.

@dannyboy *I know right!* X'D

The main page has been overrun with abstract algebra and ignores the other connections to quaternions! (Including this spatial one, which is *how/why quaternions were discovered in the first place!!* XD )

Sign in to participate in the conversation

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!