Live data from Hacker News

Quaternions

liorsinai.github.io

111–118 of 118 posts

Re: Quaternions

#111

Earlier quoted context omitted.

GA is much slower in practice and takes more to store. In places speed and cache are important, quaternions are much better. Game engines don't need much if anything from GA (and I've written about using GA decades ago for software, and did it for some time, before realizing that trading that elegance for worse performance was not worth it). Here's [1] one example from the godfather of GA demonstrating how poorly GA…

From the paper: > The main cause for the lower performance of GA is the Gaigen’s soft typing of the geometric algebra objects at compile-time: all types of objects (scalars, vectors, bivectors, trivectors, rotors and so on) are represented by a single data type in Gaigen. When a product or operation has to be computed, Gaigen first checks the grade usage of the argument(s) and then acts accordingly. This conditional…

It's been tried, over and over. It doesn't work simply because GA representations are larger.

There's a reason that after decades GA hasn't replaced quaternions, and it's not because people don't know how to optimize code by hand.

Re: Quaternions

#112

tldr: Simply explained without demonstrations: Quaternions are hypercomplex numbers of the form w + xi + yj + zk Where w, x, y, and z are real and i^2 = j^2 = k^2 = -1 and ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. Being u = (x, y, z) = xi + yj + zk a unitary vector, it is possible rotate any vector q by an angle theta around u by doing: pqp' where p = cos(theta/2) + sin(theta/2)u and p' = cos(theta/2) - sin(…

Hypercomplex numbers are different to quaternions. They also have 4 components but the multiplication of hypercomplex numbers is commutative.

Re: Quaternions

#113

Earlier quoted context omitted.

From the paper: > The main cause for the lower performance of GA is the Gaigen’s soft typing of the geometric algebra objects at compile-time: all types of objects (scalars, vectors, bivectors, trivectors, rotors and so on) are represented by a single data type in Gaigen. When a product or operation has to be computed, Gaigen first checks the grade usage of the argument(s) and then acts accordingly. This conditional…

It's been tried, over and over. It doesn't work simply because GA representations are larger. There's a reason that after decades GA hasn't replaced quaternions, and it's not because people don't know how to optimize code by hand.

Exactly, in fact I'm always surprised so many people still claim GA is better for practical implementations after all these years.

My impression is that if you want something compact that you'll need to either give up on performance (type erasure) or separate compilation (track every type).

GA is great for pen and paper proofs though.

Re: Quaternions

#114

In my opinion, Geometric Algebra and bivectors ( https://bivector.net ) in particular is a much better (both practically and pedagogically) approach compared to quaternions and significantly more elegant. It's a real shame that people continue to focus so much on quaternions in this day and age.

GA strikes me as the monad's of physics

"Geometric Algebra is just a Clifford algebra over an Euclidean space, what's the problem?"

Re: Quaternions

#115

Earlier quoted context omitted.

It's been tried, over and over. It doesn't work simply because GA representations are larger. There's a reason that after decades GA hasn't replaced quaternions, and it's not because people don't know how to optimize code by hand.

Exactly, in fact I'm always surprised so many people still claim GA is better for practical implementations after all these years. My impression is that if you want something compact that you'll need to either give up on performance (type erasure) or separate compilation (track every type). GA is great for pen and paper proofs though.

Exactly - GA is nice for proofs, bad for code. I wrote an article in Games Programming Gems V back around 2004, showing many proofs of things one wants to do in computer graphics all derived simply using GA.

Re: Quaternions

#116
post #49

I first encountered quaternions in the concept of abstract algebra. It's interesting to think of it as part of a spectrum starting with reals and continuing to octonions (and beyond). Interestingly with each extension we lose something: Complex numbers (2-dimensional): No more ordering Quaternions (4-dimensional): No more commutative multiplication Octonions (8-dimensional): No more associative multiplication Sedenio…

Here's a short article that gave me some insight into the matter: https://nautil.us/blog/the-strange-numbers-that-birthed-mode... "Place your phone face-up on a flat surface, for example. Spin it 90 degrees to the left, and then flip it away from you. Note which way the camera points. Returning to the original position, flip it away from you first and then turn it to the left second. See how the camera points to the…

It's worth noting that one of the early finite groups that is taught in abstract algebra are the dihedral groups which model exactly this sort of behavior (For your phone example this would be D₄. Knowing that mattress flipping is modeled with D₂ makes it trivial to prove that that there is no combination of flip and rotate that will allow you to always do the same move to your mattress to get it into the four possible positions for optimal wear.

Re: Quaternions

#117
post #78
post #49

I first encountered quaternions in the concept of abstract algebra. It's interesting to think of it as part of a spectrum starting with reals and continuing to octonions (and beyond). Interestingly with each extension we lose something: Complex numbers (2-dimensional): No more ordering Quaternions (4-dimensional): No more commutative multiplication Octonions (8-dimensional): No more associative multiplication Sedenio…

Interestingly, if we go in the opposite direction we also loose something: Real numbers (1-dimensional): No more algebraic closure [1] though as you suggest we do gain a nice ordering where "nice" means "compatible with operations". BTW, you can always impose some ordering on all of these sets. It is the orderings' compatibility with arithmetic that we lose going from real numbers to complex numbers. This can be gene…

I used to teach the expansion of the concept of numbers from ℕ to ℂ via a fictionalized history of the numbers (most notably, expanding ℕ to ℤ before introducing ℚ, but historically, rational and even irrational numbers preceded zero and negative numbers in mathematical understanding. It also elides over the various subdivisions of all the different kinds of irrational numbers that exist in ℝ\ℚ which could be a whole class in itself, but this was a math for liberal arts majors class and I had to make sure not to have their eyes glaze over too much.

Re: Quaternions

#118
post #116

Earlier quoted context omitted.

Here's a short article that gave me some insight into the matter: https://nautil.us/blog/the-strange-numbers-that-birthed-mode... "Place your phone face-up on a flat surface, for example. Spin it 90 degrees to the left, and then flip it away from you. Note which way the camera points. Returning to the original position, flip it away from you first and then turn it to the left second. See how the camera points to the…

It's worth noting that one of the early finite groups that is taught in abstract algebra are the dihedral groups which model exactly this sort of behavior (For your phone example this would be D ₄. Knowing that mattress flipping is modeled with D ₂ makes it trivial to prove that that there is no combination of flip and rotate that will allow you to always do the same move to your mattress to get it into the four poss…

Interesting Applied Mathematics
Post reply on HN