Hacker News new | ask | show | jobs
by gfxgirl 1471 days ago
for general GA yes but for the GA needed to replace quaternions in 3D?

I'm far from good at math but the GA article linked above has this comparision of quaternion code vs rotor (GA) code

https://marctenbosch.com/quaternions/code.htm

1 comments

Operations in G3 have a bunch of extra work compared to operations on quaternions alone due to the presence of odd grades. However, if your values are quaternionic, these grades should always be zero, so you can safely elide the operations. The compiler just has to be smart enough to see this.

The basis of G3 is 1,x,y,z,xy,xz,yz,xyz. Quaternions only have 1,xy,xz,yz. Quaternion multiplications are closed; xyyz = xz, xyxz = -yz, xzyz = -xy. xyxy=-1. If your compiler is smart enough to figure out that x,y,z,xyz are always zero, you can save the extraneous operations.