Live data from Hacker News

Quaternions

liorsinai.github.io

91–100 of 118 posts

Re: Quaternions

#91
post #76

Earlier quoted context omitted.

GA is much slower in practice and takes more to store. In places speed and cache are important, quaternions are much better. Game engines don't need much if anything from GA (and I've written about using GA decades ago for software, and did it for some time, before realizing that trading that elegance for worse performance was not worth it). Here's [1] one example from the godfather of GA demonstrating how poorly GA…

I have done some experiments with type-directed static optimization of geometric algebra, but I didn’t get far enough to find out if it would scale up to real applications. The idea was to represent in the type system which components are known to be zero, so that (for instance) the GA representation of a vector or a rotation is the same size as it would be as a traditional matrix-based linear algebra. And the type s…

>the same size as it would be as a traditional matrix-based linear algebra

You can get it that small, it's all been done, but that's far larger than a quat, which can be stored in 3 components when normalized, and in 4 for quick and easy computation.

For large models and more importantly scarce GPU memory, increasing model size results in less complex models and slower computation.

There really is no benefit for 3D engines I can tell (and I was early on the GA bandwagon 20ish years ago... It just has not and I suspect will never pan out due to the inefficiencies not being worth it).

Re: Quaternions

#92
post #83
post #49

I first encountered quaternions in the concept of abstract algebra. It's interesting to think of it as part of a spectrum starting with reals and continuing to octonions (and beyond). Interestingly with each extension we lose something: Complex numbers (2-dimensional): No more ordering Quaternions (4-dimensional): No more commutative multiplication Octonions (8-dimensional): No more associative multiplication Sedenio…

Why do you think the dimensions are in powers of two?

Because the construction generating this sequence of algebras doubles the dimension every time.

https://en.m.wikipedia.org/wiki/Cayley%E2%80%93Dickson_const...

Re: Quaternions

#93

Earlier quoted context omitted.

Came here to say this! I always felt like quaternions weren't a perfect fit for 3d rotation, and when I finally learned about bivectors my faith in the elegance of mathematics was restored :D I liked this article: https://marctenbosch.com/quaternions/

> Why does i2=j2=k2=−1 and ij=k? Why do we take a vector and upgrade it to an "imaginary" vector in order to transform it, like q(xi+yj+zk)q∗? Who cares as long as it rotates vectors the right way, right? Yikes! This is the sort of thing that scares people away from complex numbers from a young age.

Aren't you doing a bit of an injustice to that article by cherry-picking that line? It's obviously written humorously; the very next words are:

> Personally, I have always found it important to actually understand the things I am using. I remember learning about Cross Products and Quaternions and being confused about why they worked this way, but nobody talked about it. Later on I learned about Geometric Algebra and suddenly I could see that the questions I had were legitimate, and everything became so much clearer.

Clearly, "who cares as long as" is not the true belief of the author, but rather a mocking call-out of teachers who do think that way.

Re: Quaternions

#94

Earlier quoted context omitted.

It seems to me that i, j, and k are three things that have the same property, not three identical things.

TIL that not every imaginary number is just "i" with optional scaling applied. Was taught "the square root of negative one is i".

That's a heck of a great observation.

In the complex numbers, every imaginary number is, indeed, just "i" scaled. But the quaternions are like three copies of the complex numbers glued together; you have multiple kinds of "imaginary", each with their own unit -- like "i", but now also copies of it, "j" and "k".

To bring this somewhere more familiar, you can probably imagine the real number line as a physical line stretching off to infinity. This line has a point called "1". Now if we take two more copies of this line, they each have their own point called "1" -- a different one for each line. And if you stick all three of these lines together as a three-dimensional set of axes, you get a world in which you have three 1s coexisting. We just say "in the X direction" to be clear about which we're talking about, or group them together in (x, y, z) triples -- in which case X's 1 is called (1, 0, 0).

The situation is the same for quaternions -- we glue one real line together with three copies of the imaginary line. So we get three different i's, and we give them different names to distinguish them.

Re: Quaternions

#95

In my opinion, Geometric Algebra and bivectors ( https://bivector.net ) in particular is a much better (both practically and pedagogically) approach compared to quaternions and significantly more elegant. It's a real shame that people continue to focus so much on quaternions in this day and age.

GA strikes me as the monad's of physics

Re: Quaternions

#96

In my opinion, Geometric Algebra and bivectors ( https://bivector.net ) in particular is a much better (both practically and pedagogically) approach compared to quaternions and significantly more elegant. It's a real shame that people continue to focus so much on quaternions in this day and age.

Quaternions are the even part of the Clifford (aka Geometric) algebra associated to a three-dimensional space, so the connection is quite close. This case is also quite special because the quaternions form a division algebra over the real numbers, meaning that each nonzero quaternion has an inverse. Finite-dimensional real division algebras are quite rare: indeed the only ones up to isomorphism are the real numbers, complex numbers, and quaternions.

Geometric algebra is great if you want to extend things to higher dimensions, or spaces with different metric signatures (the 4-dimensional spacetime for example). But quaternions should not be discounted just because they fit into a generalisation - they have many quite special properties all of their own.

Re: Quaternions

#97
The absolute best instruction on quaternions I've seen is the 3Blue1Brown series on your tube and their incredible live quaternion viewer: https://www.youtube.com/watch?v=zjMuIxRvygQ&t=24s

I was able to learn enough from this to then use quaternion matrix transformations extensively in my startup to incredible effect.

Re: Quaternions

#98
post #96

In my opinion, Geometric Algebra and bivectors ( https://bivector.net ) in particular is a much better (both practically and pedagogically) approach compared to quaternions and significantly more elegant. It's a real shame that people continue to focus so much on quaternions in this day and age.

Quaternions are the even part of the Clifford (aka Geometric) algebra associated to a three-dimensional space, so the connection is quite close. This case is also quite special because the quaternions form a division algebra over the real numbers, meaning that each nonzero quaternion has an inverse. Finite-dimensional real division algebras are quite rare: indeed the only ones up to isomorphism are the real numbers,…

To be pedantic, "each nonzero quaternion has a multiplicative inverse"

Re: Quaternions

#99
I've seen dozen of tutorials trying to explain quaternions in multiple analogies and methods. But finally after this tutorial I can finally conclude that I'm dumb.

Re: Quaternions

#100

Earlier quoted context omitted.

It seems to me that i, j, and k are three things that have the same property, not three identical things.

TIL that not every imaginary number is just "i" with optional scaling applied. Was taught "the square root of negative one is i".

Unfortunately that's not even correct for complex numbers: i is a square root of -1, and -i is the other. Complex numbers are really nice in that every non-zero complex number has two square roots, three cube roots, four fourth roots, etc.

A better definitional statement is the other way around: i has the property that i^2 = -1.

Post reply on HN