Live data from Hacker News

Rediscovering Quaternions

jasonfantl.com

51–60 of 72 posts

Re: Rediscovering Quaternions

#51

Earlier quoted context omitted.

Because quaternions are awesome? :) it definitely feels like a discovery when you learn about them first.

Are they? [Let's remove Quaternions from every 3D Engine] https://marctenbosch.com/quaternions/

I feel like there should be a followup post "Dear Sir, you have reimplemented quaternions" noting how implementing GA and using it only in 3D gets you precisely right back to quaternions-but-with-a-different-name since they're isomorphic when specialized for 3D.

Re: Rediscovering Quaternions

#52
post #50
post #38

Earlier quoted context omitted.

Quaternions are automatically orthogonal, whereas matrices can shear and therefore may accumulate floating point distortions under repeated opreations.[0] Think of matrices as computational instructions, which are straightforward but lossy, while quaternions are the canonical "lossless representations". The sweet spot for using quaternions is to use them as intermediate representations of rotation operations, then "c…

I get what you mean, but it seems misleading to cite floating point issues with matrices and call quats lossless. Matrices are not inherently imprecise, they have floating point error when you use floating point numbers to represent them, and the same is absolutely true for quats too. A better word than lossless is perhaps ‘overspecified’ when referring to a 3x3 matrix being used to represent a rotation or orientatio…

1. In this application, floating point drift affect matrices far more than quats.

Drifts in quats results in a drifted value of rotation + uniform scaling, but will never introduce deformation.

Drifts in matrices may result in total mutilation of your coordinates.

The overdetermined nature of matrices with respect to orthogonal transforms means that you lose information about which values constitute the authoritative state, whereas it is by definition impossible for a quat not to be orthogonal even when perturbed with significant error.

As an analogy, think of matrices as retained-mode GUI while quats are immediate-mode.

2. Axis angle is just the logarithm of [unit]quats (non-unit quat adds an additional scalar to the axis-angle components).

If you want to compose rotations sequentially, you'll still need to take the exponential of axis-angle to turn it into quats.

You can author initial state in axis angles as an authoritative declaration of what you meant for the orientation to be, but composing them still invariably requires you to un-logarithm them back to quats, hence what I said about "intermediate representation"

3. I said compile to a matrix at the very end when transforming the final vertices, entirely sidestepping the problem of repeated operations since you're only "baking" it for the final transformation onto vertices.

Re: Rediscovering Quaternions

#53

The easiest way for me to conceptualize it is to think of it as orientation + rotation. 3 dims for the orientation vector to get the object facing/pointing the right way, then a further 1 dim/var for rotation about that axis. For a total of 4 variables/dimensions 3blue1brown and Ben Eater did a series of interactive videos on the subject that can be explored: https://eater.net/quaternions My favorite demo on this poi…

> The easiest way for me to conceptualize it is to think of it as orientation + rotation. 3 dims for the orientation vector to get the object facing/pointing the right way, then a further 1 dim/var for rotation about that axis. For a total of 4 variables/dimensions

Something's missing. Orientation in 3D space is a two-dimensional quantity; you would never need three dimensions to express it. The third dimension has to be providing some additional information, like a magnitude.

Re: Rediscovering Quaternions

#54
post #38

While they might be theoretically pleasing, I've had trouble seeing the appeal of quaternions for 3D graphics. Recently I was working on some 3D-rendering code from scratch for a project, and I looked into using quaternions for rotation, only to scratch my head at how fiddly they were to apply to vectors. (Also, many resources talking about them focus on their abstract properties at the expense of actual examples, wh…

Quaternions are automatically orthogonal, whereas matrices can shear and therefore may accumulate floating point distortions under repeated opreations.[0] Think of matrices as computational instructions, which are straightforward but lossy, while quaternions are the canonical "lossless representations". The sweet spot for using quaternions is to use them as intermediate representations of rotation operations, then "c…

[dead]

Re: Rediscovering Quaternions

#55

The easiest way for me to conceptualize it is to think of it as orientation + rotation. 3 dims for the orientation vector to get the object facing/pointing the right way, then a further 1 dim/var for rotation about that axis. For a total of 4 variables/dimensions 3blue1brown and Ben Eater did a series of interactive videos on the subject that can be explored: https://eater.net/quaternions My favorite demo on this poi…

> The easiest way for me to conceptualize it is to think of it as orientation + rotation. 3 dims for the orientation vector to get the object facing/pointing the right way, then a further 1 dim/var for rotation about that axis. For a total of 4 variables/dimensions Something's missing. Orientation in 3D space is a two-dimensional quantity; you would never need three dimensions to express it. The third dimension has t…

Only if you’re describing orientation as two orthogonal rotations. I’m saying think of it like a ‘pointing’ vector that defines the axis of rotation. And such a vector does require 3 components in 3d space

Re: Rediscovering Quaternions

#56

Earlier quoted context omitted.

If you a explaining this to the average American, you are going to have to start a bit further back than a "Plane".

I know it's a tradition to bash Americans, but I'm quite sure in any country, Ax + By + Cz + D = 0 is a plane isn't common sense.

I learned it in the mandatory part of school (I'm French) so while I'm sure lots of people have forgotten it, most did learn it at school..

Re: Rediscovering Quaternions

#57

Earlier quoted context omitted.

> The easiest way for me to conceptualize it is to think of it as orientation + rotation. 3 dims for the orientation vector to get the object facing/pointing the right way, then a further 1 dim/var for rotation about that axis. For a total of 4 variables/dimensions Something's missing. Orientation in 3D space is a two-dimensional quantity; you would never need three dimensions to express it. The third dimension has t…

Only if you’re describing orientation as two orthogonal rotations. I’m saying think of it like a ‘pointing’ vector that defines the axis of rotation. And such a vector does require 3 components in 3d space

It’s possible to point in 3D space with two rotation components. For example, the first two components of a UV texture.

But I agree it is helpful to think of quaternions as direction and spin.

Re: Rediscovering Quaternions

#58
post #33
post #31

Earlier quoted context omitted.

Because quaternions are so cool yet under-appreciated. Unfortunately not many octonion posts.

Octonions are cool! The one application I’m familiar with is in crystallography - you can represent the interface between two crystals with a unit octonion https://doi.org/10.1016/j.actamat.2018.12.034 (Open access pdf: https://par.nsf.gov/servlets/purl/10098941 ) Can you give some pointers to other interesting applications?

Fundamental physics:

https://www.quantamagazine.org/the-octonion-math-that-could-...

Also see the work of John Baez:

html https://math.ucr.edu/home/baez/octonions/octonions.html

pdf https://math.ucr.edu/home/baez/octonions/octonions.pdf

Re: Rediscovering Quaternions

#59

Earlier quoted context omitted.

> The easiest way for me to conceptualize it is to think of it as orientation + rotation. 3 dims for the orientation vector to get the object facing/pointing the right way, then a further 1 dim/var for rotation about that axis. For a total of 4 variables/dimensions Something's missing. Orientation in 3D space is a two-dimensional quantity; you would never need three dimensions to express it. The third dimension has t…

Only if you’re describing orientation as two orthogonal rotations. I’m saying think of it like a ‘pointing’ vector that defines the axis of rotation. And such a vector does require 3 components in 3d space

Yes, a three-dimensional vector is a combination of a 3D orientation and a magnitude. An orientation by itself doesn't have three dimensions. The surface of a sphere is a two-dimensional space.

> Only if you’re describing orientation as two orthogonal rotations.

No, the space has the dimensionality it has. You may choose to describe a 3D orientation with more than two numbers, but you won't stop it from being a two-dimensional quantity that way. If you use more than two numbers, those numbers will fail to be independent of each other.

Re: Rediscovering Quaternions

#60
Whenever I see a quaternion post, I wonder why the rotors aren't the default[1].

They are mathematically equivalent, easier to explain, can generalize to higher dimensions, and aren't mocked in the Alice in the Wonderland[2] (famous tea part scene).

[1]https://archive.is/20240820193111/ (mirror of https://marctenbosch.com/quaternions/ )

[2]https://gaupdate.wordpress.com/2011/07/26/quaternions-part-o...

Post reply on HN