Live data from Hacker News

Less Weird Quaternions Using Geometric Algebra

probablydance.com

1–10 of 43 posts

Re: Less Weird Quaternions Using Geometric Algebra

#3
post #2

Quarternions aren't weird. With a 2D angle we use 2 numbers (sin and cos) to calculate vector rotations. It turns out that in 3D we use 4 numbers.

There's a lot of hand waving in that phrase, "it turns out". Sure, "it turns out" that 3D uses four numbers. Why?

Geometric algebra explains that in a succinct way that also appeals to our intuition about geometry. Start by using bivectors to represent reflections, then take the closure of your bivectors and you get the even-ordered subalgebra. This will have dimension 2^(N-1)... so 2 for 2D, 4 for 3D, and 8 for 4D.

This, to me, takes the mystery out of why quaternions can represent rotations, and it places quaternions in a coherent theory of geometry that works in any number of dimensions, not just 3D. Alternatively, we could accept that the math just happens to work out that way, or we could even show that quaternions are a double cover of SO(3), but all that does is analyze why something works, whereas the geometric algebra version is a bit less of a leap and builds quaternions from the ground up.

Re: Less Weird Quaternions Using Geometric Algebra

#4
For people trying to understand quaternions, the faster way to intuition is understanding axis-angle first. I think axis-angle is totally intuitive. First pick a direction (some 3d unit vector) and then rotate around that direction by some amount (so some scalar). Then convert those four numbers to quaternions

  qx = ax * sin(angle/2)
  qy = ay * sin(angle/2)
  qz = az * sin(angle/2)
  qw = cos(angle/2)
where (ax, ay, az) is the unit direction (ax^2 + ay^ + az^2 = 1) and angle is the amount you want to rotate.

http://www.euclideanspace.com/maths/geometry/rotations/conve...

http://www.euclideanspace.com/maths/geometry/rotations/conve...

Re: Less Weird Quaternions Using Geometric Algebra

#5
post #2

Quarternions aren't weird. With a 2D angle we use 2 numbers (sin and cos) to calculate vector rotations. It turns out that in 3D we use 4 numbers.

I think that's a good motivation why we would study quaternions, but it's kinda hiding the big difference between 2D and 3D under the rug. In 2D, we have a nice, global coordinate system for the space of all rotations: what we call the angle. (Actually, it's a coordinate system for the "universal cover" of the space of rotations since angle X and angle X + 2pi give the same rotation, which mostly doesn't really matter.) Meanwhile, in 3D, there is no global coordinate system for the space of rotations! Euler examples uniquely specify a rotation, but the problem of Gimbal lock [1] means that they break down as coordinates at some point (i.e. there's no inverse to go from rotation in 3D to its corresponding Euler angles, which there is in 2D, with the caveat already mentioned).

This is analogous to the problem of finding a coordinate system for the globe: specifying latitude and longitude tells you were you are, but there's a degeneracy at the poles. And no possible coordinate system can solve this problem entirely. Contrast this to the situation of giving a coordinate system for the circle, which we do with it's angle. This isn't quite a coordinate system, due to the problem we already encountered that X and X + 2pi are the same, but that's OK because the these two points are separated from each other. On the sphere, the latitude/longitude pair (pi/2, x) gives the north pole for any value of x, even ones that are arbitrarily close together. That maps not even locally invertible!

You suggest we think of points on the circle as point in 2D space that happen to lie on the circle (i.e. cos and sin of the angle corresponding to that point). Analogously, we can think of points on the sphere as points in 3D space that happen to lie on the sphere (like some point (x,y,z) with x^2 + y^2 + z^2 = 1). And analogously, we can think of rotations of 3D space as a point in 4D space (that happens to satisfy some conditions), and the quaternions give that 4D point. This is fantastic and convenient in both 2D and 3D! But in 2D we didn't need to do this, but could if we wanted to. For 3D rotations, we do need to, or else we have this terrible degeneracy that never rears its head in 2D. In that sense, 2D and 3D are very different!

[1] https://en.wikipedia.org/wiki/Gimbal_lock

Re: Less Weird Quaternions Using Geometric Algebra

#6
> OK so what is this Geometric Algebra? It’s an alternative to linear algebra.

No. Geometric algebra is a use case of linear algebra. How can it be an alternative?

> Before I tell you how to actually evaluate the wedge product, I first have to tell you the properties that it has:

> 1. It’s anti-commutative: a \wedge b = -b \wedge a

> 2. The wedge product of a vector with itself is 0: a \wedge a = 0

Redundant information. The latter follows from the former.

Re: Less Weird Quaternions Using Geometric Algebra

#7

> OK so what is this Geometric Algebra? It’s an alternative to linear algebra. No. Geometric algebra is a use case of linear algebra. How can it be an alternative? > Before I tell you how to actually evaluate the wedge product, I first have to tell you the properties that it has: > 1. It’s anti-commutative: a \wedge b = -b \wedge a > 2. The wedge product of a vector with itself is 0: a \wedge a = 0 Redundant informat…

It's definitely an alternative in the sense that it gives you an alternative framework for concepts that are taught under the banner of linear algebra in school. For example, it gives an alternative construction for quaternions as a subalgebra, and it gives the exterior product as an alternative to the cross product.

Re: Less Weird Quaternions Using Geometric Algebra

#8
post #5
post #2

Quarternions aren't weird. With a 2D angle we use 2 numbers (sin and cos) to calculate vector rotations. It turns out that in 3D we use 4 numbers.

I think that's a good motivation why we would study quaternions, but it's kinda hiding the big difference between 2D and 3D under the rug. In 2D, we have a nice, global coordinate system for the space of all rotations: what we call the angle. (Actually, it's a coordinate system for the "universal cover" of the space of rotations since angle X and angle X + 2pi give the same rotation, which mostly doesn't really matte…

> Meanwhile, in 3D, there is no global coordinate system for the space of rotations

There are plenty, it's just that you can't have a 3-dimensional one without singularities.

https://en.wikipedia.org/wiki/Hairy_ball_theorem

Re: Less Weird Quaternions Using Geometric Algebra

#9
Quaternions are beautiful and natural, not weird, but I'm always happy when they get some attention! This was a very interesting article, thanks. It does seem to confuse quaternions in general with (unit) quaternions as used for rotating vectors. For example:

>So don’t think of quaternions as a 4 dimensional hypersphere of radius 1

This is also a bit weird:

>But nobody would ever suggest that we should think of a rotation matrix as a 9 dimensional hyper-cube with rounded edges of radius 3.

Even weirder when they claim that the axis-angle interpretation of (unit) quaternions "breaks down".

Anyway, back in high-school when I first became fascinated with quaternions I certainly didn't expect to be working with them on a daily basis two decades later. The moral of this is that anything you learn can become crucial to your career...

Re: Less Weird Quaternions Using Geometric Algebra

#10
post #7

> OK so what is this Geometric Algebra? It’s an alternative to linear algebra. No. Geometric algebra is a use case of linear algebra. How can it be an alternative? > Before I tell you how to actually evaluate the wedge product, I first have to tell you the properties that it has: > 1. It’s anti-commutative: a \wedge b = -b \wedge a > 2. The wedge product of a vector with itself is 0: a \wedge a = 0 Redundant informat…

It's definitely an alternative in the sense that it gives you an alternative framework for concepts that are taught under the banner of linear algebra in school. For example, it gives an alternative construction for quaternions as a subalgebra, and it gives the exterior product as an alternative to the cross product.

Exterior algebras themselves are defined in terms of standard linear algebra concepts (tensor algebras, ideals, quotients). I don't see how you can claim something is an alternative to linear algebra if you need to know linear algebra to define it, nevermind use it.
Post reply on HN