News for hackers. Stuff that matters.
Re:Let's remove quaternions from every 3D engine (2018) by xg15 on Friday January 31, 2020 @07:36AM (#22201112)
Your opinionated summary implies that both concepts are equally hard to understand, but the whole point of the author is that rotors are potentially a lot easier to understand and reason about than quaternions.

He also gives a concrete reason: For 3D objects, rotors operate fully in 3D, whereas quaternions are in 4D. This means you can visualize rotors and imagine "how they work" whereas with quaternions, you have to more or less blindly trust the formulas.

Re:Let's remove quaternions from every 3D engine (2018) by ptero on Friday January 31, 2020 @08:31AM (#22201484)
> rotors operate fully in 3D, whereas quaternions are in 4D. This means you can visualize rotors ... whereas with quaternions, you have to ... trust the formulas.

This is a bit of a stretch -- by the same logic any operation on more than three numbers means I have to trust the formulas. We have many methods to understand, visualize, develop intuition, etc. in such cases, such as "fix a, look at what happens when you vary b, c and d". When I am working to understand dynamics of an object with three variables in MATLAB or similar, I seldom (probably never) plot it in 3D (which gets projected on the surface of a flat monitor anyway). Instead I usually play with numerous 2D and even 1D plots. My 2c.

Re:Let's remove quaternions from every 3D engine (2018) by mlatu on Friday January 31, 2020 @10:01AM (#22202162)
> rotors operate fully in 3D

By this, the author means: you can visualize a rotor FULLY in 3D, no extra dimension neccessary.

I suspect you never have tried to think about how quaternions work mechanically, I suggest this neat video:

https://www.youtube.com/watch?v=d4EgbgTm0Bg

Re:Let's remove quaternions from every 3D engine (2018) by ptero on Friday January 31, 2020 @11:42AM (#22203077)
Thank you for the link, very cool video!

I do get the theory part -- I know how quaternions and rotors work (and have a PhD in "pure" math). My objection (and a pretty firm one) is with the "if a phenomenon has more than three variables we cannot visualize it" logic. While lower dimensions make things a little easier to understand and develop an intuition for, a convenient abstraction or a model is much more important. Most engineers work with things described by multiple variables all the time and "reduce dimension to three" is seldom the main goal.

If the claim is that rotor is a better model, more convenient for software engineering, we can examine (and debate) that. But we should not recommend switching just because it has one less variable. For someone with an algebraic rather than geometric view, the ability to multiply quaternions on a piece of paper may be a strong benefit. Double-checking, say the result (1+i)*(j-k) by hand takes 10 seconds and a piece of paper; try mentally computing the rotor composition -- you would probably fall back on algebra (I certainly would).

Re:Let's remove quaternions from every 3D engine (2018) by Gene_Parmesan on Friday January 31, 2020 @04:55PM (#22206254)
No math degree here, but personally I think the author's main point was not purely that they could be visualized without resorting to 4D. Instead I think it was that the concept of rotors can be explained from first principles, whereas he feels that currently, programmers look at quaternions as black boxes for which they have no intuition. Here's the relevant quote from the video:

> But instead of defining Quaternions out of nowhere and trying to explain how they work retroactively, it is possible to explain Rotors almost entirely from scratch. This obviously takes more time, but I find it is very much worth it because it makes them much easier to understand!

I can't speak to his argument really as, when it comes to 3D game dev, I'm purely a hobbyist. I do believe though that in the end, programmers want to program. They want to be handed a library with an API that makes sense. The ones who care deeply about the whys and hows of the math will always take the time to learn it; others just want to know how to write the code. For those people, I'm not sure the rotor equations I saw are any more intuitive at first blush than the quaternion equations.

In short, I feel like by the time you're at the point where you're explaining the details of a topic like geometric algebra, you've likely already lost the people who just want to code, even if the description you provide is more intuitive.

Having said that, I still found the video fascinating.

Re:Let's remove quaternions from every 3D engine (2018) by xg15 on Friday January 31, 2020 @10:21AM (#22202357)
I think different people have different approaches. I can only say that, for me, I usually need some kind of visual understanding of what an object represents - which may be 2D, 3D, a graph structure or whatever else, depending on the task at hand.

In this case, a 3D visualisation is the right tool because the problem is all about objects in 3D space. So rotors let you mentally work with the same objects you're thinking about anyway instead of switching to some other concept or representation.

I don't see that "it's technically 2D anyway because it's projected to the surface of my monitor" is a valid argument. My visual system knows pretty well how to deal with pseudo-3D objects, thank you very much.

Re:Let's remove quaternions from every 3D engine (2018) by kybernetikos on Friday January 31, 2020 @05:07PM (#22206380)
> When I am working to understand dynamics of an object with three variables in MATLAB or similar, I seldom (probably never) plot it in 3D (which gets projected on the surface of a flat monitor anyway). Instead I usually play with numerous 2D and even 1D plots. My 2c.

This is a very interesting point. Have you tried VR? Do you think this preference for 2d and 1d is just because 3d display technology is still inconvenient or is it something deeper than that?

Re:Let's remove quaternions from every 3D engine (2018) by omaranto on Friday January 31, 2020 @08:35AM (#22201510)
I don't understand the phrase "rotors operate fully in 3D". What does operating in 3D mean?

If it means rotors can be used to give a simple formula for rotations in 3D space, then it also applies to quaternions.

If it means the space of rotors is three-dimensional, then it's false: rotors have 4 coordinates, a + b x^y + c y^z + d x^z, just like quaternions.

Does it mean something else? Something that applies only to rotors and not to quaternions?

Re:Let's remove quaternions from every 3D engine (2018) by wbhart on Friday January 31, 2020 @09:02AM (#22201698)
It means the things in the basis, x^y, y^z and x^z have an easy to understand interpretation in ordinary 3D space, namely the parallelogram between x and y (in the case of x^y), for example.

It's also easy (after reading the article) to understand the operations that can be performed on these things.

It's not as obvious what i, j and k in the quaternions correspond to, or why they have the multiplication table that they do. It's an algebraic construction, not a geometric one and hence more difficult to visualise.

Re:Let's remove quaternions from every 3D engine (2018) by omaranto on Friday January 31, 2020 @10:10AM (#22202245)
You're probably right, that's probably what was meant. I guess I'm so used to thinking geometrically about quaternions, I don't see much advantage to geometric algebra for 3D rotations (but geometric algebra does have other advantages, like working in any number of dimensions!).
Re:Let's remove quaternions from every 3D engine (2018) by aratakareigen on Friday January 31, 2020 @09:02AM (#22201701)
The space of rotors and rotation quaternions are both three dimensional because the coordinates are restricted to unit magnitude.

Quaternions and rotors are exactly the same in practice, but the intuitions are very different. The intuition behind rotors involves planes and lines in 3D, whereas the intuition behind quaternions typically involves a unit hypersphere; there's a 3B1B video on quaternions where you can learn more about them.

Re:Let's remove quaternions from every 3D engine (2018) by omaranto on Friday January 31, 2020 @10:18AM (#22202322)
You're right that the space of rotations is 3-dimensional. When I said 4, I meant without restricting to the unit hypersphere. This causes no problem for rotations because replacing q by a multiple tq leaves the formula x --> qxq^(-1) unchanged --although of course q^(-1) invloves dividing by the square of the norm so it's nice if the norm is 1.

Note that even if you do restrict q to have unit norm, q and -q still denote the same rotation! (In other words, the space of rotations isn't really S^3, but projective space RP^3.)

I'll be sure to check out the 3B1B video, I keep seeing them recommended and I think they might a good resource to recommend to my students.

Re:Let's remove quaternions from every 3D engine (2018) by ChrisLomont on Friday January 31, 2020 @04:35PM (#22206042)
>rotors are potentially a lot easier to understand and reason about than quaternions

Quats are quite easy to reason about: a unit quat holds a rotation about an axis: rotation about angle theta an axis given by direction (x,y,z) is quat q = sin(t/2) + cos(t/2)(xi+yj+zk).

Composing quats q1 * q2 is the rotation you get by applying q2 then q1 to an item.

So think of the scalar as holding info about the angle rotated, and the vector part as the direction of the axis.

I don't see how with rotors or quats you can easily visualize composition or more complex actions (and I've used both extensively). "Blindly" trusting the formulas can be replaced by working through a proof enough times until you feel how they work, just like linear algebra, algebra, quadratic formula, etc.

Re:Let's remove quaternions from every 3D engine (2018) by lonelappde on Friday January 31, 2020 @09:03AM (#22201707)
That's not true. Rotations in 3D space are 4D objects: a 3D orientation and a 1D magnitude.

Rotors use a.b with aXb, and quaternions use magnitude and 3D direction vector.

Re:Let's remove quaternions from every 3D engine (2018) by aratakareigen on Friday January 31, 2020 @09:07AM (#22201728)
SO(3) is definitely three-dimensional, and rotations don't involve magnitudes.
Re:Let's remove quaternions from every 3D engine (2018) by papln on Friday January 31, 2020 @03:40PM (#22205448)
I miswrote. Rotation calculations are represented (in quaternions and in geometric algebra calculations) as a 3D subspace of R^4, with the "extra" dimension accounted for by constraining quaternions to the unit hypersphere.

Rotations do involve magnitudes when interpreted as an axis (2 dimensional manifold embedded in R^3) and a magnitide (0 to 2pi)

https://en.wikipedia.org/wiki/Axis%E2%80%93angle_representat...

SO(3) is a coordinate-free abstraction that isn't relevant to the topic of GA vs Quaternions for calculating concrete values in computer graphics