Live data from Hacker News

Let's remove Quaternions from every 3D Engine

marctenbosch.com

71–80 of 184 posts

Re: Let's remove Quaternions from every 3D Engine

#71
post #39

Texts on GA seem to start out saying "we're going to replace vector analysis with something intuitive and natural and eloquent and..." and then immediately introduce the "geometric product", which is neither intuitive, eloquent, or, as far as I can tell, natural. Its properties are found via formula-wrangling, and the results you get from it seem to just magically work, rather than being intuitive. Bivectors in gener…

> As far as I can tell 95% of the usefulness of geometric algebra is the usefulness of the wedge product ∧, which is absolutely under-appreciated and appears in loads of places in disguise (for instance, the determinant of a matrix is the wedge product of all of its rows or columns together).

Also, it's really intuitive. At least I found it really intuitive when it was first explained to me.

Re: Let's remove Quaternions from every 3D Engine

#72

Hmm, the word "interpolate" does not appear in the article. One of the main applications of quaternions in games is interpolating rotations. Does this representation interpolate well? Also, I've seen several articles trying to convince me that alternative transformation representations like these are better, but I haven't seen much code. Has anyone written a library using these concepts that could replace a tradition…

Yes, anything you can do on quaternions you can do on rotors. (Updated the article) I have not seen a clean version of the code online but it is almost the same as for a quaternion.

Great post although it made me hungry for explanation what are the actual implementation differences between rotors and quaternions because I got the impression that we use exactly same real numbers to do exactly same things. We just imagine basis of this transformation space not as some 4 orthogonal vectors, just 3 orthogonal unit planes plus one real number for scaling.

Those bivectors just explain (incredibly, amazingly well) what quaternions are and why they have properties they have. It doesn't seem to change how you crunch the numbers to get what you want.

...

It's really great that you wrote that post. I feel like for the first time I truly understand rotations in 3D and know why I felt something fishy was going on with results of vector product and expressing rotations with them.

Re: Let's remove Quaternions from every 3D Engine

#73

When just implementing a first person type control/viewport I found it way easier to just use euler angles and the gimbal lock didn't really feel unnatural to me. So I think there is something to the idea that maybe you don't even need the complexity of quaternions at all dependent on the usecase.

First person views typically only use two axes of rotation, so of course gimbal lock will not be a problem. You are not dealing with general 3D rotations.

However, as soon as you want a 3D rotation (eg. in a flight sim) then you really need a way to represent them that doesn't suffer from gimbal lock or have any singularities.

Note: even with an FPS, you do typically want some more complex camera movement (for certain actions or animations that tilt the camera) or need to orient something relative to the camera (like the gun). Euler angles do not allow you to compose rotations, and so for this you'll need to go via an intermediate representation such as quaternions or matrices. Probably this is handled by whatever engine you are using though.

Re: Let's remove Quaternions from every 3D Engine

#74

Earlier quoted context omitted.

> On the other hand, find a problem where geometric algebra gets you to a useful insight in a quicker or more natural way and few will object to treating it in that language. I would argue that E&M and anything involving rotations (or Lorenzt boosts!) are two great examples where GA is miles ahead of anything other than differential forms but still has modest advantages of differential forms as well. The main advanta…

I think that last point really needs to start with a thorough reform of basic mathematical education (starting from undergrad calculus) to have any chance of real success. The present mish-mash of notations, however disjointed, lends itself very well to teaching people who don't know much beyond basic real analysis and differential equations. You can't just throw them in a GA-based E&M class without completely changi…

I should be clear here that my longing for a physics community that embraces GA should not be confused with any level of optimism that it'll actually happen. I agree its a monstrously difficult task and our current formalisms are more or less good enough. A man can dream though!

One advantage I see in the GA treatment of E&M is in radiation. If one takes the Faraday bivector for a stationary charge (ie. the Coulumb field) and then just 'rotates' it into a moving frame using the GA rotors you can find the standard radiation fields of E&M quite easily. This is cool because it's not only a neat proceedure mathematically, but its computationally quite efficient, say if you need to find the fields produced by N moving charged particles.

I'm sure there are more examples of things like this but it's been a while since I last looked at E&M in GA so none are coming to mind right now.

Re: Let's remove Quaternions from every 3D Engine

#76

Earlier quoted context omitted.

I think that last point really needs to start with a thorough reform of basic mathematical education (starting from undergrad calculus) to have any chance of real success. The present mish-mash of notations, however disjointed, lends itself very well to teaching people who don't know much beyond basic real analysis and differential equations. You can't just throw them in a GA-based E&M class without completely changi…

I should be clear here that my longing for a physics community that embraces GA should not be confused with any level of optimism that it'll actually happen. I agree its a monstrously difficult task and our current formalisms are more or less good enough. A man can dream though! One advantage I see in the GA treatment of E&M is in radiation. If one takes the Faraday bivector for a stationary charge (ie. the Coulumb f…

That's a neat example, thanks!

Re: Let's remove Quaternions from every 3D Engine

#77

It's completely unnecessary to understand what the individual components of quaternions represent. All that is necessary is to build an understanding of what the operations do for you. Do you need to understand Russell's proof that 1+1=2 to compute the tip on your bar bill, or do you just need to know what to expect when you apply the addition operation to two numbers? Treat quaternions as indivisible whole values as…

Russell's proof that 1+1=2 is more complicated than the existing intuition of adding up numbers.

GA is less complicated and more intuitive than the maths of quaternions.

So your comparison does not really hold up.

Re: Let's remove Quaternions from every 3D Engine

#78

So I have a layman's question: 3blue1brown and Ben Eater did a quaternion visualization set of videos. And they said it was good because it avoided an an axis lock thing that happens when x y z rotate. He said there were maybe some errors with other models as well. So I guess the question is "does this also not have the locking axis problem?" I think it's called gimbal lock?

Just in case it's not obvious to all, this "axis lock thing" you speak of is so important it could cause a plane to crash! :) (it has implications beyond computer graphics).

https://en.wikipedia.org/wiki/Gimbal_lock#On_Apollo_11

Re: Let's remove Quaternions from every 3D Engine

#79
post #31

Earlier quoted context omitted.

You can take the logarithm of a rotor in order to do interpolation. If you want a transformation represented by a rotor R to happen in N steps, you can apply R ^ (1/N) N times. The Nth root of R is exp(log(R)/N)

The same is true (with lower performance, I suspect) with the 3x3 matrix representation.

Matrices for rotation have the problem that you are using a 9-dimensional representation for a 3-dimensional quantity, so it is easy to make matrices that are not rotations (indeed the vast majority of the possible space of matrices consists of transformations that are not anywhere close to a pure rotation). Composing matrices leads to rounding errors. It is more complicated to invert matrices. As you say the matrix logarithm is more complicated. Etc.

If you use a scalar + bivector “rotor” representation, that is only a 4-dimensional representation, which is easy to normalize to unit magnitude.

Re: Let's remove Quaternions from every 3D Engine

#80
post #39

Texts on GA seem to start out saying "we're going to replace vector analysis with something intuitive and natural and eloquent and..." and then immediately introduce the "geometric product", which is neither intuitive, eloquent, or, as far as I can tell, natural. Its properties are found via formula-wrangling, and the results you get from it seem to just magically work, rather than being intuitive. Bivectors in gener…

From the sounds of it, I think you'd be much more happy working with differential forms! Differential forms use only the wedge product and a duality mapping known as the hodge dual (It's the GA equivalent of multiplying by the psuedoscalar). Differnetial forms easily supply 90% of the nice things in GA, so if you're unhappy with the geomtric product, I'd say that differnetial forms are perfect.

Geometric algebra will be here waiting for when you get tired of resorting to the hodge dual to take an inner product ;)

Post reply on HN