# geometric algebra notes, definitions, and references for geometric algebra (GA), including conformal geometric algebra (CGA). see also the software implementation [sph-ga](https://github.com/sph-mn/sph-ga). # overview geometric algebra unifies inner, exterior, and geometric products into a single algebraic system. it supports scalars, vectors, and higher-grade elements as first-class entities. applications: geometry, physics, computer graphics, robotics, computational algebra. # resources ## introductory * [from zero to geo](https://www.youtube.com/watch?v=2hBWCCAiCzQ\&list=PLVuwZXwFua-0Ks3rRS4tIkswgUmDLqqRy) * [geometric algebra for computer science](http://www.geometricalgebra.net/) - explanations and software considerations * [mathoma ga series](https://www.youtube.com/playlist?list=PLpzmRsG7u_gqaTo_vEseQ7U8KFvtiJY4K) * [wild linear algebra](https://www.youtube.com/watch?v=yAb12PWrhV0\&list=PLIljB45xT85BhzJ-oWNug1YtUjfWp1qAp) - background linear algebra for GA ## tools * [versor.js](https://github.com/weshoke/versor.js) - javascript port of libvsr * [gaviewer](http://www.geometricalgebra.net/gaviewer_download.html) and [gaviewer tutorial](https://geometricalgebra.org/downloads/gaviewerexercises.pdf) * [sph-ga](https://github.com/sph-mn/sph-ga) * [libvsr](https://github.com/wolftype/versor) - c++ template-based implementation (fast, fixed-metric) ## reference lists * [ga explorer resources](https://ga-explorer.netlify.com/index.php/ga-online-resources) * [bleyer.org ga resources](http://bleyer.org/dw/doku.php?id=geometric_algebra) * [clifford algebra: a visual introduction](https://slehar.wordpress.com/2014/03/18/clifford-algebra-a-visual-introduction) * [clifford/geometric algebra on euclideanspace](http://www.euclideanspace.com/maths/algebra/clifford/index.htm) * [colapinto - articulating space](http://versor.mat.ucsb.edu/ArticulatingSpace.pdf) * [lecture slides by chris doran](http://geometry.mrao.cam.ac.uk/2016/10/geometric-algebra-2016) (may be offline) * [reference implementation](http://www.geometricalgebra.net/reference_impl.html) from "geometric algebra for computer science" * [suter - geometric algebra primer](http://www.jaapsuter.com/geometric-algebra) * [pablo colapinto talk from c++ now 2014](https://youtu.be/W4p-e-g37tg) # terminology * scalars: grade-0 elements (real numbers) * vectors: grade-1 elements (basis: e₁, e₂, ...) * basis vectors: linearly independent set spanning the space * null vectors: vectors with self-inner product zero * blades: simple multivectors from exterior product of independent vectors * bivectors: grade-2 blades (oriented planes) * trivectors: grade-3 blades (oriented volumes) * multivectors: general linear combination of grades * pseudoscalar: highest-grade blade * spinors: multivectors representing transformations (rotations, reflections, dilations) * dual: multivector's complement w.r.t. pseudoscalar * grades: homogeneous components by dimension * conformal points: null vectors embedding Euclidean points * directions: null vectors for points at infinity * rounds: spheres/circles in CGA * flats: lines/hyperplanes in CGA * tangent vectors: null vectors tangent to rounds # products * geometric product: associative combination of inner and exterior products * exterior product (wedge): antisymmetric, raises grade * inner product (dot): reduces grade, encodes projections * commutator product: `[A, B] = AB - BA` * anticommutator product: `{A, B} = AB + BA` # main operations * reversion: reverse vector order in product * grade involution: negate odd-grade parts * dualization: multiply by pseudoscalar * grade projection: extract specified grade(s) * norm: magnitude from geometric product * sandwich product: `A -> R A R⁻¹` * meet: intersection via dualization * join: union via exterior product * reflection: `v -> -R v R⁻¹` * rotation: spinor from bivector exponentials * inversion: inversion in sphere/plane * translation: spinor with e∞ * dilation: spinor scaling transformation * exponential map: bivector -> rotation/dilation * logarithm map: spinor -> bivector * orthogonal complement: dual subspace * null decomposition: split null and non-null components # conformal geometric algebra (cga) ## metric split-signature metric with two off-diagonal negatives: ``` [1, 1, 1, 0, 0] ``` basis products: ``` no * no = 0 ni * ni = 0 no * ni = -1 eᵢ * eᵢ = 1 eᵢ * eⱼ = 0 (i ≠ j) ``` ## point embedding for euclidean n-space: ``` p = x₁ e₁ + x₂ e₂ + ... + xₙ eₙ + e₀ + 0.5(x₁² + ... + xₙ²) e∞ ``` null condition: ``` dot(p, p) = 0 ``` ## common rotors rotation: ``` R = cos(angle / 2) + B sin(angle / 2) # B is unit bivector ``` translation: ``` T = 1 + 0.5 * t * e∞ ``` rotation + translation: ``` R * T ``` ## rotor application ``` p' = R * p * reverse(R) ``` ## perspective projection see: [computing perspective projections in 3-dimensions using rotors in the homogeneous and conformal models of clifford algebra](https://www.researchgate.net/publication/266979004_Computing_Perspective_Projections_in_3-Dimensions_Using_Rotors_in_the_Homogeneous_and_Conformal_Models_of_Clifford_Algebra) # implementation notes * pseudoscalar scaling factors vary; some use -1/2. * geometric product of pseudoscalar with itself = 1 in conformal metric (without scaling). * sign conventions differ between libraries; may flip all results. * product of pseudoscalar with itself can reveal null vector handling bugs.