5 ms·
I got sucked down a Geometric Algebra rabbit hole a few months ago, which seems like a remarkably concise and intuitive way to work in a very wide variety of ge
by infogulch 3y ago
I got sucked down a Geometric Algebra rabbit hole a few months ago, which seems like a remarkably concise and intuitive way to work in a very wide variety of geometries, including 2D, 3D, 4D+, non-euclidean etc. I've wondered if GA would make a good foundation for a physics engine...
There are a few small rust libraries that look interesting [1][2], but none with a lot of traction.
Has anyone looked into this?
[1]: https://crates.io/keywords/geometric-algebra https://crates.io/keywords/geometric-algebra
[2]: https://github.com/Lichtso/geometric_algebra https://github.com/Lichtso/geometric_algebra
If you dare, a good place to jump in might be Freya Holmér's Why can't you multiply vectors? - https://www.youtube.com/watch?v=htYh-Tq7ZBI https://www.youtube.com/watch?v=htYh-Tq7ZBI - Then https://bivector.net/index.html https://bivector.net/index.html
- xixixao 3y agoFun fact: I used GA in Excalidraw, and it's still powering some of the interactions! https://github.com/excalidraw/excalidraw/blob/master/packages/excalidraw/galines.ts https://github.com/excalidraw/excalidraw/blob/master/package...
- falcor84 3y agoWhy "still"? Have you intentionally decided to move away from GA? If so, why?
- xixixao 3y agoBecause it was a while ago and I wouldn’t be surprised if someone ripped it out. It’s a bit of an overkill for what it’s used for / the fact that it is not used widely in the app.
- chrisjj 3y agoInteresting. What advantage did this gain?
- msvan 3y agoThis one has some more traction: https://github.com/fu5ha/ultraviolet https://github.com/fu5ha/ultraviolet
- meindnoch 3y agoA physics engine's least interesting part is the vector representation. Geometric Algebra is isomorphic to "classical" (i.e. Heaviside) vector algebra. Collision handling, energy conservation, stability, etc. are the hard problems.
- infogulch 3y agoFair. I guess the promise of a GA-based physics engine is in the implementation as development velocity and how much work it takes to get decent performance, but that wouldn't necessarily translate to users.
- meindnoch 3y agoActually, performance of GA-based approaches tend to be worse than classical vector algebra. The general multivector in a geometric algebra over an n-dimensional space has 2^n components. The general geometric product is a 2^(2n) components! In theory a sufficiently smart GA library can optimize away the zero components, but this is yet to be demonstrated in practice. And if you do it by hand, you'll end up with something very similar to classical vector algebra anyway... What GA excels at is conciseness of notation. Although, once you consider all the different product types (inner product, exterior product, dot product, scalar product, left contraction, right contraction, regressive product - did I miss anything?), it can be a bit intimidating. Some of it feels a bit like APL to me.
- kame3d 3y agoRelevant tutorial: https://www.youtube.com/watch?v=5R2sv9GCwz0 https://www.youtube.com/watch?v=5R2sv9GCwz0
- justincredible 3y agoMy layman understanding would be that you're not gaining anything other than a more abstract model. If you want performance, the code is going to boil down to the equivalent linear algebra + quaternion operations.
- jordibc 3y agoWell, I got sucked down the same Geometric Algebra rabbit hole, plus another "remarkably concise and intuitive way" one too, which is Clojure. So I wrote a library that can generate any GA and do all kind of fun operations (which could be used in particular as a basis for a physics engine). Just in case any of this is of your interest too: https://cljdoc.org/d/net.clojars.jordibc/geometric-algebra/ https://cljdoc.org/d/net.clojars.jordibc/geometric-algebra/