by jiggawatts · 6y ago · 0 comments
In game engines the vector algebra method is slightly faster, so the elegant programming model is often sacrificed in the name of performance.
That, I can understand.
Why physicists use at least 4 separate formulations of the EM equations I can't understand, especially considering the vector version is the worst yet the most popular.
http://home.lu.lv/~sd20008/papers/essays/Maxwell's%20equatio...
Geometric Algebra may be superior, but it's "one more thing" to learn/teach. It might catch on, but that might take another century of preaching.
I'm not sure though where exactly the idea that GA is slower comes from. It's all down to the application and implementation. Perhaps it's because GA generalizes so well to higher dimensions that many libraries are overly generalized and thus slower than vector algebra libraries that need special cases anyway.
Of course, there are all sorts of optimisations. Most GA libraries are actually based on code-generation and support various "subsets" of the full GA to efficiently represent things like vectors only. From what I've seen, even a well-tuned library has approximately a 25% overhead for hot paths and 50-100% is typical.
This is a bit like representing a simple rotation like the hand of a clock, with either just one angle, or a two-element unit vector pointing in the direction of the rotation. The one-element angle has a bunch of special cases, like have to be checked to see if it goes past 360 degrees and then reset back to the 0..360 range. Representing this with two numbers just requires multiplication with a matrix, which involves no conditionals or modulo arithmetic.
This is analogous to the vector vs geometric algebra. Typically, GA has no special cases and "just works", but it does so by "uncompressing" the compact vector representation. It's going to be slower.