6 ms·
Ok, standard 4x4 matrices also implement a projective (aka d+1) model. (the 'w' coordinate is just the projective coordinate). So no difference with GA in that
by enkimute 6y ago
Ok, standard 4x4 matrices also implement a projective (aka d+1) model. (the 'w' coordinate is just the projective coordinate). So no difference with GA in that respect.
Setting up a unified transformation hierarchy is actually very easy, and again not really different from how you would approach it with matrices. (plus, its more performant). Simply swap the matrix with the appropriate versor.
Which (versors or matrices) are appropriate depends on the symmetry group you are interested in :
Orthogonal Group (just rotations : distance + origin preserving) in d dimensions -> use the geometric algebra R_d. (classically : complex numbers, quaternions)
Lorentz Group (rotations + boosts : spacetime distance + origin preserving) in d space dimensions and 1 time dimension -> use the geometric algebra R_{d,1}. (classically : Lorentz transformations)
Euclidean Group (translations + rotations : distance preserving) in d dimensions -> use the geometric algebra R_{d,0,1}. (classically : planar quaternions, dual quaternions)
Conformal Group (translations + rotations + dilations : angle preserving) -> use the geometric algebra R_{d+1,1}. (classically : linear fractional transformations)
General Linear Group (translations + rotations + sheering + ... : preserves parallelism/incidence) : use d+1 x d+1 matrices.
Working in a symmetry group that is 'to big' comes at a cost - both in algorithmic complexity as well as numerical precision. If you only want translations/rotations, but are using matrices you'll have to resort to things like Gramm-Shmidt or SVD to re-orthogonalize your matrices after doing numerical calculations. (you have to project it back to the solution manifold in math terms - this is almost never trivial and often impossible).
(for those interested, I explain this in-depth in my GAME2020 talk : https://www.youtube.com/watch?v=ichOiuBoBoQ&ab_channel=Bivector https://www.youtube.com/watch?v=ichOiuBoBoQ&ab_channel=Bivec... )
- hohohmm 6y agoThanks for the information. It's nice of you to point out that 4x4 matrix is projective in nature, and I understand that GA could potentially be more performant for its more compact usage of numbers. But to really make it popular and understandable, a "simple" version of GA that handles translation, rotation & non-uniform scaling would really help, without the group thoery concepts, even better, make it in the context of a scene graph hiearchy, with a unified operator like "multiply". Also is it possible to collapse a series of such transforms in a single versor like you can do with matrices without going into dual quaternion stuff? In generic game developemnt, translation, rotation, and non-uniform scaling are all extremely basic things that cannot be handwaved away or "too big". Also, why the need o a dual(e12, e02, e01) to represent a point when in vector it's just a (e0, e1, e2). This is just counterinuitive. This is what I mean by "quickly gets complicated" and it feels nearly as opaque as cross product in vector math. Just explaining my experience digging in GA for a couple of weeks.
- enkimute 6y ago> But to really make it popular and understandable, a "simple" version of GA that handles translation, rotation & non-uniform scaling would really help, without the group theory concepts, even better, make it in the context of a scene graph hiearchy, with a unified operator like "multiply". The rich structure of GA (that ultimately follows from just one axiom extra) unifies a wide range of concepts and theories. Considering just one application, or one link, puts one at risk of arriving at a model that breaks these connections to other parts of mathematics. It seems unfair to expect to understand the why without considering the connections to Lie Groups, their associated geometries, differential forms, etc. That said, I have some unpublished examples displaying and processing bvh (mocap) files that I'll try to cleanup and put online. > Also is it possible to collapse a series of such transforms in a single versor like you can do with matrices without going into dual quaternion stuff? In generic game developemnt, translation, rotation, and non-uniform scaling are all extremely basic things that cannot be handwaved away or "too big". Versors combine just like matrices (using just the ordinary product). (doing this for translations/rotations _are_ the dual quaternions, but you don't have to (and imho shouldn't) call them that.). Non-uniform scaling along your scenegraph (as opposed to in the beginning (object space) or at the end (view space)) is usually frowned upon in professional game development. (it makes it impossible to correct matrices using Gramm-Shmidt, and adds a lot of complexity to things like tracing hit rays etc). > Also, why the need o a dual(e12, e02, e01) to represent a point when in vector it's just a (e0, e1, e2). This is just counterinuitive. This is what I mean by "quickly gets complicated" and it feels nearly as opaque as cross product in vector math. This is because geometry and group theory are intricately connected. When you use matrices, you represent elements with vectors and transformations with matrices - they're separate things. In Geometric Algebra, every element also _is_ a transformation. (a plane represents a reflection in that plane, a line represents a 180 degree rotation around that line, a point represents a point reflection in that point). So now there is a strong link. Whatever you use to represent reflections should also represent planes, same for rotations/translations and lines, or point reflections and points. It is in fact very intuitive and simple, its just different from what you're used to. For example, in 2D, given a point at euclidean position (3,4), here are the two mindsets: * classic : it is a sum of three times the 'x' vector and 4 times the 'y' vector. (and actually than add in '1' homogeneous vector). '3x + 4y + w' (in memory : 3,4,1 ) * GA : (3,4) is a system of equations. Namely 'x=3' and 'y=4', or homogeneously : 'x-3=0' and 'y-4=0'. Such homogeneous linear equations are lines (in 2D), and represented by vectors : 'e1-3e0' and 'e2-4e0', solving such a system of equations is just the outer product: '(e1-3e0) ^ (e2 - 4e0) = 3e20 + 4e01 + e12'. (in memory : 3,4,1) so because it is on the bivector basis, this element (3e20 + 4e01 + e12) now represents both the point at (3,4) as well as a rotation of 180 degrees around that point. Just like the line (e1-3*e0) represents both the line `x=3` as well as a reflection w.r.t. that line. For the same reason the product of two lines will give you the rotation or translation between them and the product of two points will always give you the translation. So I'd argue its a lot more intuitive, don't factor out the time it took you to find the linear algebra approach intuitive.
- gugagore 6y agoDespite the costs of using a “too big” symmetry group (I’d say overparameterization), I bet it’s hard to beat the performance of 4*4 matrix multiplications, since the computation is so uniform, vectorizable, and perfectly sized for e.g. SIMD. Even if there are fewer math operations with another representation.
- banachtarski 6y agoIt depends. For composing multiple transforms, composing versors aka quaternions/dual quaternions is cheaper than a full 4x4 multiply. For a single application, a 4x4 will be cheaper.
- gugagore 6y agoWithout benchmarks, I do not trust you. :) have you tried? On what platform? And did you take a look at the assembly code?
- enkimute 6y agoTake a look at Klein : https://www.jeremyong.com/klein/ https://www.jeremyong.com/klein/ (arm implementation is coming) Its geometric product between motors is the equivalent of the 4x4 matrix product. Although the basic computational complexity tells the story : 4x4 matrix product : 16 floats storage, 64 multiplies, 48 additions. 3D PGA versor product : 8 floats storage, 48 multiplies, 40 additions.
- banachtarski 6y agoQuaternions are used in animation for blending and composing transforms for a reason. You don't have to trust me, but yes... tried for maybe ten years and counting from doing graphics and animation work.
- chombier 6y agoFrom the documentation of the Eigen library [0]: > If the quaternion is used to rotate several points (>1) then it is much more efficient to first convert it to a 3x3 Matrix. Comparison of the operation cost for n transformations: > - Quaternion2: 30n > - Via a Matrix3: 24 + 15n So really it depends on what you're doing (admittedly here it is 3x3 not 4x4) [0] https://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase.html#aae0b06729e20b45be97dc829f506914d https://eigen.tuxfamily.org/dox/classEigen_1_1QuaternionBase...