fixed it. mea culpa.
HN user
enkimute
Mathematical Experimentalist
Thank you, appreciate that!
Apologies. Had that joke sitting around for waaaay to long. Not that great in retrospect :D
don't foget the fantastic Sudgy 'A swift introduction to projective geometric algebra' : https://www.youtube.com/watch?v=0i3ocLhbxJ4
and ofcourse the go-to reference https://bivector.net
or join 1000+ profs, researchers and enthusiasts on the bivector discord here https://discord.gg/vGY6pPk
For specifying animations, you should work in the quaternion lie algebra, not in the group as you suggest. There you can represent 1620 degrees without any problem. Furthermore, in the quaternion Lie algebra (pure imaginary quaternions), and only in that space, you can take an arbitrary rotation key, multiply all 3 of its values with 10 and get 10 times that rotation without change in axis.
If you rotate around just one axis, the Lie algebra feels just like Euler angles .. in fact its exactly the same thing, but if you rotate around more than one .. it keeps working intuitively and usably - Euler angles absolutely do not.
done. mea maxima culpa.
There's no smoke. But there surely are mirrors. (Group theory joke)
These are also called the planar quaternions and are the even subalgebra of 2D PGA. I use and explain these (and their nD generalisations) in my SIBGRAPI 2021 talk on kinematics and dynamics in PGA.
There is also a writeup called 'may the forque be with you' available on bivector.net
Not the same concrete example, but one where I do find the Geometric Algebra version substantially more insightful, is the treatment of rigid body mechanics in the geometric algebra of the Euclidean group (R_{n,0,1}).
It has the dual quaternions as even subalgebra (in 3D), and unifies all linear and angular aspects. It leads to remarkable new insights, as removing the need for force-couples (pure angular acceleration is caused by pushing along a line at infinity), while pure linear acceleration is caused by forces along lines through the center of mass.
These geometric ideas are independent of dimension - forces, both angular and linear are always lines. The treatment of inertia becomes a duality map, and things like Steiners theorem are not needed at all.
On top of this, the separation of the metric that sets GA apart means that this formulation of rigid body dynamics works not only in flat Euclidean space, but unmodified in the Spherical and Hyperbolic geometries. (by a simple change of metric of the projective dimension).
For a (graphics/game programmer oriented) tutorial on this see https://www.youtube.com/watch?v=pq9YfdPHhIo&ab_channel=Bivec...
Every Lie algebra is a bivector algebra (see 'Lie groups as Spin groups' http://geocalc.clas.asu.edu/pdf/LGasSG.pdf).
Additionally the GA formalism enables closed form solutions for the exponential map for all bivector algebras. (see 'Graded symmetry Groups' https://www.researchgate.net/publication/353116859_Graded_Sy...).
They were designed with touchscreens in mind - I agree tho that it didn't work out exactly as I wanted. Someone did make a playthrough video of it :
https://www.youtube.com/watch?v=UzEytSmwEpk&ab_channel=probi...
Thanks for this background info. I also agree with your assessment - so far its just gotten some giggles and maybe even some extra attention from students who are not always easy to motivate when it comes to math. Its also racked up quite a few references in scientific publications (as its the only library offering these types of easy visualizations) - so it does appear most can appreciate it for the silly joke it was meant to be.
You're generating code that relates to a certain algebra, likely for providing API for doing calculations based on that algebra (so an algebra library). Why would you call that 'algebra generated by ganja.js'?
The 'generated by' in that sentence is referring to the code generation - not the mathematical generators. I'll change 'algebra' to 'algebra implementation' to make that more clear. (I figured the very sentence 'an algebra generated by ganja.js' disambiguates the interpretation, but I'm happy to stand corrected.)
Ganja can create numerical implementations for a wide range of algebras (not just 'a certain algebra'), including any associative algebra (you can give it a Cayley table), although the focus is on Clifford Algebras, and providing the ability to stay close to the mathematical syntax. In order to do that it provides operator overloading, algebraic literals, etc .. (all features that do not natively exist in javascript). Because it is not 'a certain algebra', but a wide range, for which the code is only generated at runtime - it seemed a reasonable way of describing what is going on.
Thanks for letting me know it confused you - will fix it right away!
A bias towards 'vectors must be points' crops in as an unwritten legacy axiom, leading to a broken correspondence with Group theory (which again cannot be turned around, discrete symmetries compose into continuous ones, but not the other way around). A further restriction to the unfortunately very symmetric 3D Euclidean space hides many of the problems with that approach. (for example only in this space the even subalgebra is shared, and bivectors are self-dual).
Consider for example R_(2,0,1) in both scenarios.
Using Geometric Product as Group Composition
e1 = reflection w.r.t. x=0 axis
e2 = reflection w.r.t. y=0 axis
e12 = reflection w.r.t. y=0 axis followed by reflection w.r.t. x=0 axis
= 180 rotation around origin.
Using Anti-Geometric Product as Group Composition e1 = not a group element, because anti-norm is zero.
e2 = not a group element, because anti-norm is zero.
e12 = not a group element, because anti-norm is zero.
So to get the same behavior you need the following elements when using the Anti-Geometric product as composition e02 = reflection w.r.t. x=0 axis
e01 = reflection w.r.t. y=0 axis
e0 = reflection w.r.t. y=0 axis followed by reflection w.r.t. x=0 axis
= 180 rotation around origin.
So choosing the geometric anti-product as group composition operator is possible, but imho breaks the readability of your transformations completely.All I can say is that I hope that those linked articles do not give people an excuse to not consider the model in which vectors, grade-1 elements, are reflections. This is the true half of the picture that is new and being missed.
The grade 1 element is not the normal vector of the plane, it is the plane itself (as a homogeneous linear form, it includes the distance from the origin as an extra coefficient, which the normal vector does not).
Linear equations form a linear space, you can add them and multiply them with scalars. (creating things called line-pencils, plane-bundles etc .. classic projective geometry). Hence you call the grade-1 elements of the graded version of such a linear space 'vectors'. (just like you can make vector spaces with functions or all other sorts of objects).
So the reflection formula from GA in general, which is to reflect an arbitrary element X w.r.t. a grade-1 element a :
-aXa
is simply to be read as reflecting the object 'X' in the plane (3D) or line (2D) or sphere (3D CGA) or circle (2D CGA) 'a'.
Such a reflection should modify all other reflections, except for itself (where it should only flip orientation) :
-aaa = -a
It is easy to verify that this holds for general Euclidean planes written as homogeneous linear equations in their grade-1 element form. And from that everything else follows. (composition of reflections gives you rotations/translations (leaving points invariant in 2D), etc).
Planes being grade 1 elements in no way implies characterizing them by a normal vector.
Chris Doran, while not officially in academia, is still very much actively researching these topics and regularly publishes. (he is also a member of the bivector community, very approachable and happy to help out with questions).
Anthony Lasenby, professor astrophysics and cosmology at Cambridge, is also absolutely still actively researching and publishing, all in the mindset of the GA4Physicists book. (See a recent (feb 2020) lecture of him here : https://www.youtube.com/watch?v=x7eLEtmq6PY&t=7s )
(GA4P is considered one of the few comprehensive and up to date treatments of geometric algebra, not just in physics).
Geometric Algebra for Physicists : https://www.amazon.com/Geometric-Algebra-Physicists-Chris-Do...
Absolutely :
Algebraically we can always use the Hodge dual and its inverse to move to/from k-vectors from/to n-k vectors.
Geometrically we can always say two points define a line or two lines define a point.
Group Theory - here we can't swap. Two reflections make a rotation but two rotations do not make a reflection. So reflections are 'naturally' grade 1.
If you want everything to fit intuitively together, you want reflections to be grade 1, and by consequence hyperplanes (lines in 2D, planes in 3D, etc) to be grade 1 (i.e. vectors).
Doing it the other way around is possible but will be more verbose and less intuitive. (also with 'reflections' as natural grade 1 elements, the move from Euclidean to Conformal becomes trivial, simply reflect in (hyper)spheres instead, in this space it is also easier to see that the two approaches are not equivalent, it is natural to say that (in 2D) the 'meet' of two circles is a point pair, but not that the 'join' of two points is a point pair. (why would it not be a line just like in PGA?)).
Imho, one should learn to appreciate both halves of the picture, as for each specific problem one of them might be more natural. (for the popular Euclidean group and its associated geometry this view we're not used to may very well be more intuitive one, imho).
That is correct - matrices are the natural companion of the general linear group. The GA representation exists, and is called 'the mother algebra', for general 4x4 matrices the GA equivalent is R4,4. (where general linear transformations are versors).
For other subgroups GA reps will also exist. (like e.g. if one wants to include projective transformations as versors, that would be the projective group (which preserves the cross ratio of 4 points), and has a GA representation in R3,3).
These spaces quickly become so big that efficient numerical implementations (while not impossible with enough symbolic work at compilation time, see e.g. https://www.jeremyong.com/gal/) are difficult. Other advantages of GA do of course remain.
But to really make it popular and understandable, a "simple" version of GA that handles translation, rotation & non-uniform scaling would really help, without the group theory concepts, even better, make it in the context of a scene graph hiearchy, with a unified operator like "multiply".
The rich structure of GA (that ultimately follows from just one axiom extra) unifies a wide range of concepts and theories. Considering just one application, or one link, puts one at risk of arriving at a model that breaks these connections to other parts of mathematics. It seems unfair to expect to understand the why without considering the connections to Lie Groups, their associated geometries, differential forms, etc.
That said, I have some unpublished examples displaying and processing bvh (mocap) files that I'll try to cleanup and put online.
Also is it possible to collapse a series of such transforms in a single versor like you can do with matrices without going into dual quaternion stuff? In generic game developemnt, translation, rotation, and non-uniform scaling are all extremely basic things that cannot be handwaved away or "too big".
Versors combine just like matrices (using just the ordinary product). (doing this for translations/rotations _are_ the dual quaternions, but you don't have to (and imho shouldn't) call them that.). Non-uniform scaling along your scenegraph (as opposed to in the beginning (object space) or at the end (view space)) is usually frowned upon in professional game development. (it makes it impossible to correct matrices using Gramm-Shmidt, and adds a lot of complexity to things like tracing hit rays etc).
Also, why the need o a dual(e12, e02, e01) to represent a point when in vector it's just a (e0, e1, e2). This is just counterinuitive. This is what I mean by "quickly gets complicated" and it feels nearly as opaque as cross product in vector math.
This is because geometry and group theory are intricately connected. When you use matrices, you represent elements with vectors and transformations with matrices - they're separate things. In Geometric Algebra, every element also _is_ a transformation. (a plane represents a reflection in that plane, a line represents a 180 degree rotation around that line, a point represents a point reflection in that point). So now there is a strong link. Whatever you use to represent reflections should also represent planes, same for rotations/translations and lines, or point reflections and points.
It is in fact very intuitive and simple, its just different from what you're used to. For example, in 2D, given a point at euclidean position (3,4), here are the two mindsets:
* classic : it is a sum of three times the 'x' vector and 4 times the 'y' vector. (and actually than add in '1' homogeneous vector). '3x + 4y + w' (in memory : 3,4,1 )
* GA : (3,4) is a system of equations. Namely 'x=3' and 'y=4', or homogeneously : 'x-3=0' and 'y-4=0'. Such homogeneous linear equations are lines (in 2D), and represented by vectors : 'e1-3e0' and 'e2-4e0', solving such a system of equations is just the outer product: '(e1-3e0) ^ (e2 - 4e0) = 3e20 + 4e01 + e12'. (in memory : 3,4,1)
so because it is on the bivector basis, this element (3e20 + 4e01 + e12) now represents both the point at (3,4) as well as a rotation of 180 degrees around that point. Just like the line (e1-3*e0) represents both the line `x=3` as well as a reflection w.r.t. that line. For the same reason the product of two lines will give you the rotation or translation between them and the product of two points will always give you the translation.
So I'd argue its a lot more intuitive, don't factor out the time it took you to find the linear algebra approach intuitive.
Take a look at Klein : https://www.jeremyong.com/klein/ (arm implementation is coming)
Its geometric product between motors is the equivalent of the 4x4 matrix product.
Although the basic computational complexity tells the story :
4x4 matrix product : 16 floats storage, 64 multiplies, 48 additions.
3D PGA versor product : 8 floats storage, 48 multiplies, 40 additions.
a selection:
- no closed form exponential/logarithm (i.e. cant interpolate)
- no numerical stability for subgroups (i.e. need Gramm-Shmidt, SVD)
- no covariant transformations (i.e. need adjugate to transform axial vectors)
- no geometric construction. (e.g. in GA product of two elements is (square of) versor between them)
- costly inverses (just some sign swaps in GA)
I fully agree, for practical examples (no-install, web-browsable, interactive), check out the dozens of examples in the ganja.js coffeeshop:
https://enkimute.github.io/ganja.js/examples/coffeeshop.html
Ok, standard 4x4 matrices also implement a projective (aka d+1) model. (the 'w' coordinate is just the projective coordinate). So no difference with GA in that respect.
Setting up a unified transformation hierarchy is actually very easy, and again not really different from how you would approach it with matrices. (plus, its more performant). Simply swap the matrix with the appropriate versor.
Which (versors or matrices) are appropriate depends on the symmetry group you are interested in :
Orthogonal Group (just rotations : distance + origin preserving) in d dimensions -> use the geometric algebra R_d. (classically : complex numbers, quaternions)
Lorentz Group (rotations + boosts : spacetime distance + origin preserving) in d space dimensions and 1 time dimension -> use the geometric algebra R_{d,1}. (classically : Lorentz transformations)
Euclidean Group (translations + rotations : distance preserving) in d dimensions -> use the geometric algebra R_{d,0,1}. (classically : planar quaternions, dual quaternions)
Conformal Group (translations + rotations + dilations : angle preserving) -> use the geometric algebra R_{d+1,1}. (classically : linear fractional transformations)
General Linear Group (translations + rotations + sheering + ... : preserves parallelism/incidence) : use d+1 x d+1 matrices.
Working in a symmetry group that is 'to big' comes at a cost - both in algorithmic complexity as well as numerical precision. If you only want translations/rotations, but are using matrices you'll have to resort to things like Gramm-Shmidt or SVD to re-orthogonalize your matrices after doing numerical calculations. (you have to project it back to the solution manifold in math terms - this is almost never trivial and often impossible).
(for those interested, I explain this in-depth in my GAME2020 talk : https://www.youtube.com/watch?v=ichOiuBoBoQ&ab_channel=Bivec... )
The GAME2020 event (Geometric Algebra Mini Event) showcased applications in graphics, physics, robotics, neural networks, mathematics. The lectures (from Cambridge, UVA, UPEM, TU Delft, ..) are all available here : https://www.youtube.com/playlist?list=PLsSPBzvBkYjzcQ4eCVAnt...
This is one of the ideas presented in this Chapter. (i.e. to identify the geometry with the invariant of the transformation). In 3D if x represents a reflection, it also represents the plane left invariant by that reflection. If x represents a rotation/translation it also represents the euclidean/infinite line left invariant by that rotation/translation. And if it represents a point reflection, it also represents the 1 point left invariant by that point reflection.
Framing it in terms of vectors/bivectors is what allows us to quantify these ideas. (i.e. have to write down your planes/lines/points with numbers at some point).
But you got the essence! The abstract/coordinate free/geometric/group theory ways of thinking about this are most insightful.
So in PGA, vectors are reflections, other isometries are combinations of reflections, and the geometry are the associated invariants. (including planes, lines, points and screw axi).
A fun extension is to replace the reflection by an inversion (reflection in a sphere). Vectors now become inversions (leaving spheres invariant), the rotors become the conformal group (composition of two inversions), leaving circles invariant, etc .. the corresponding Clifford Algebra is CGA (R(4,1), with a proper parametrisation).
Right. uhm. glad to get the blood flowing ;)
Ganja.js is a personal project that got quite out of hand. Its primary goal was to lower the threshold for people to discover Geometric Algebra through examples and see its coordinate-free approach to geometry in action on the web. (since there was, and is, literally nothing else out there.)
Javascript is not the ideal language for that. Without operator overloading, much of the charm is lost - because of this, ganja contains a minimal transpiler (which is what all the regular expressions are for). This is purely out of necessity, as in practice I feel one needs a language with operator overloading for a GA implementation to be useful.
Furthermore, to be able to provide demo's in a wide range of Algebras, ganja contains three different algebra generators. (each of which produces the code that actually implements the algebra). This is another choice that typically does not exist for any specific use case (one would pick an approach and stick to it - like e.g. the Klein library) - and that adds a lot of complexity.
To visualize results, it also contains a range of different visualizers (2D, 3D, projective, conformal, SVG, GL, implicit, ..), none of which would be needed in a generic implementation. This again adds complexity that has no place in a 'reference' implementation. (which ganja was never intended to be).
In short, a lot of trickery was needed for ganja to reach its primary goal: clean examples that showcase how GA can simplify a wide range of applications. It certainly is not intended as a 'how-to' or reference for an Algebra generator, and when preparing for the Siggraph course, I saw no opportunity to use it as such. Instead, I opted to create separate reference implementations that are available at https://bivector.net/tools.html. (for c++, rust, python, c#)
With the increased interest, I did start a rewrite of ganja.js, and one that is not for my brain only.
Cheers.
Just a heads up - @ninepoints let me know he got rate limited and will answer as soon as allowed again ;)
In the short version, the representations are isomorphic, that is you can take all formulas from our Siggraph cheat sheets and replace all operators by Eric's 'anti-operators'.
You can review the discussion with Eric here :
https://discourse.bivector.net/t/why-use-dual-space-in-pga-r...
(its a long discussion, the link points to my last summary). There are still some unanswered questions on Eric's method (most notably how to define his duality mathematically - or how to arrive at the metric for the dual algebra - I'm looking forward to his views on this.)
The 26th of February I'm giving a new talk at the GAME2020 workshop that is all about the reason the view nobody is used to might in fact be a natural choice.