Hacker News new | ask | show | jobs
by skybrian 1 day ago
As a programmer I’m wondering how you get a decent graphics library out of it. If it’s conceptually better, shouldn’t it make writing code to do calculations easier?
3 comments

It can write some fascinating stuff, but you have to learn to think in it:

https://enkimute.github.io/ganja.js/examples/coffeeshop.html

A major problem is that its a very general theory. Most calculations turn into very large but very sparse matrix multiplications. To make them work fast requires code generation and an optimization pass.

These types of optimization problems show up all over graphics programming though:

* Representing rotations with matrices takes more space than quaternions.

* Sacrificing a dimension to projective geometry actually makes representing things like projections (duh) but also translations more efficient.

> shouldn’t it make writing code to do calculations easier?

You need an optimizing compiler that would take the high level description (in GA) and compile it to add subtract multiply divide of reals (the assembly language). I don't think we have that yet.

Till we have such a compiler it will be tempting to drop down to assembly. Assembly being a metaphor.

I gave this a go a couple of years ago. GA multivectors are a direct substitute for both vectors and matrix transformations. The challenge is efficiency: a unified type is too expensive for real time games. The typical approach is to create efficient subsets symbolically and bake those into the code so that the compiler has something it can work with. This works, but the "strong typing" of the mathematics and typical programming languages doesn't exactly mesh, so a clean typesystem/interface design is annoyingly difficult.

The main advantage is the elimination of gimbal lock which allows smooth interpolations of arbitrary rotations and translations. This dramatically simplifies certain codes relating to animation and robotics. In mathematics, it simplifies differentiation and integration over curved surfaces in 3D and higher dimensions.

Most developers working in those fields already use one of the many creatively named “impostors” of GA subsets in isolation, such as the quarternions.