News for hackers. Stuff that matters.
Re:How Quaternions encode rotations: derivation and sample code by logfromblammo on Wednesday September 07, 2016 @10:26AM (#12443632)
The subalgebra of 3D Clifford using the scalar and the 2-blades represents quaternions.

The subalgebra using the pseudoscalar and the 1-blades can also represent quaternions.

You have to be careful using other people's implementations, because certain operations are anticommutative, so sign conventions and operand ordering matters a lot more. For instance, choosing whether K is defined as e3 * e1 rather than e1 * e3 depends on whether your base vectors square to 1 or -1.

Geometric Algebra is cool. It lets you say things like "the intersection of two spheres that don't touch is a circle with negative radius." You can't even represent a circle with negative radius in regular geometry.

Re:How Quaternions encode rotations: derivation and sample code by grondilu on Wednesday September 07, 2016 @10:47AM (#12443821)
> You have to be careful using other people's implementations, because certain operations are anticommutative, so sign conventions and operand ordering matters a lot more. For instance, choosing whether K is defined as e3 * e1 rather than e1 * e3 depends on whether your base vectors square to 1 or -1.

Sure. For my implementation I thought a lot about how to deal with signatures and stuff. It's technically easy but making it simple and elegant is not obvious. I first thought about defining a @signature array, but then it occurred to me that it's much simpler to create two infinite spaces : one euclidean and one anti-euclidean. Later I've learned that Hestenes and others have considered this as well, they called it the mother of all geometric algebras, or universal geometric algebra[1]. Conveniently, Perl 6 deals with infinite lists very well, so it was very appropriate.

So in my implementation, @e[$i]² is +1 for all $i. If you want vectors with negative squares, use the @ē basis.

With geometric algebra, there are indeed several ways to represent quaternions. In fact there are several ways to represent complex numbers as well. I don't think it's a pitfall. As long as notations are clear and simple, it should be fine, I think.

1. https://en.wikipedia.org/wiki/Universal_geometric_algebra

Re:How Quaternions encode rotations: derivation and sample code by logfromblammo on Wednesday September 07, 2016 @11:50AM (#12444369)
No, not a pitfall. it is more like a small pothole in the road: the problem is easily avoided if you already know that it exists.
Re:How Quaternions encode rotations: derivation and sample code by stephencanon on Wednesday September 07, 2016 @11:27AM (#12444169)
> Geometric Algebra is cool. It lets you say things like "the intersection of two spheres that don't touch is a circle with negative radius." You can't even represent a circle with negative radius in regular geometry.

For some notion of "regular geometry". Desargues could produce this result in the early 17th century by lifting the circles into right cones in three dimensions, though he would probably tell you that the circle with negative radius was meaningless.

Re:How Quaternions encode rotations: derivation and sample code by jacobolus on Wednesday September 07, 2016 @08:47PM (#12449337)