GA Sandbox

The GA Sandbox is two things: a starting point to use geometric algebra in your C++ programs, and a set of programming examples. The programming examples are discussed in detail in the book, at the end of each chapter (in Chapters 1 through 16).

The GA Sandbox contains the following geometric algebra implementations:

These implementations were generated using Gaigen 2. The algebra specifications are included in the package, so you can use Gaigen 2 to re-generate the source files, if you would have the need to do so.

The GA Sandbox is hosted on To download it, you may go directly to the file download page. We also have a set of screenshots of the programming examples in action.

Online Viewing of Source Code

You may also browse the example source code online using the list below. Most links jump directly to the interesting part of the file. For some examples there are multiple source files of interest. At the bottom of the page, you can also find links to two geometric algebra implementations (e2ga and c2ga), and the Gaigen 2 specifications and profiles from which these implementations were generated.





1.1An Example in Geometric Algebrachap1ex1.cpp3-D Conformal

Basic Theory

2.13.1Drawing Bivectorschap2ex1.cpp2-D Vector Space
2.13.2Hidden Surface Removalchap2ex2.cpp3-D Vector Space
2.13.3Singularities in Vector Fieldshpindex.cpp3-D Vector Space
3.11.1Orthonormalizationchap3ex1.cpp3-D Vector Space
3.11.2Implementing the Cross Productchap3ex2.cpp3-D Vector Space
3.11.3Reciprocal Frameschap3ex3.cpp3-D Vector Space
3.11.4Color Space Conversionchap3ex4.cpp3-D Vector Space
4.9.1Orthogonal Projectionchap4ex1.cpp3-D Vector Space
4.9.2Orth. Proj, Matrix Representationchap4ex2.cpp3-D Vector Space
4.9.3Transforming Normal Vectorschap4ex3.cpp3-D Vector Space
5.11.1The Meet and Joinchap5ex1.cpp3-D Vector Space
5.11.2Efficiencychap5ex2.cpp3-D Vector Space
5.11.3Floating Point Issueschap5ex3.cpp3-D Vector Space
6.7.1Subspace Products Retrievedchap6ex1.cpp3-D Vector Space
6.7.2Gram-Schmidt Orthogonalizationchap6ex2.cpp3-D Vector Space
7.10.1Reflecting in Vectorschap7ex1.cpp3-D Vector Space
7.10.2Two Reflections Equal One Rotationchap7ex2.cpp3-D Vector Space
7.10.3Matrix-Rotor Conversion 1chap7ex3.cpp3-D Vector Space
7.10.4Matrix-Rotor Conversion 2chap7ex4.cpp3-D Vector Space
7.10.5Julia Fractalschap7ex5.cpp2-D Vector Space

Vector Space Model

10.7.1Interpolating Rotationschap10ex1.cpp3-D Vector Space
10.7.2Crystallographychap10ex2.cpp3-D Vector Space
10.7.3External Camera Calibrationchap10ex3.cpp3-D Vector Space

Homogeneous Model

11.13.1Working with Pointschap11ex1.cpp3-D Homogeneous
11.13.2Intersecting Primitiveschap11ex2.cpp3-D Homogeneous
11.13.3Don't Add Lineschap11ex3.cpp3-D Homogeneous
11.13.4Perspective Projectionchap11ex4.cpp3-D Homogeneous
12.5.1Loading Transformationschap12ex1.cpp3-D Homogeneous
into OpenGL
12.5.2Transforming Primitives chap12ex2.cpp3-D Homogeneous
with OpenGL Matrices
12.5.3Marker Reconstructionchap12ex3.cpp3-D Homogeneous
in Optical Motion Capturereconstruct.cpp

Conformal Model

13.10.1Metric Matterschap13ex1.cpp3-D Conformal
13.10.2The Distance Between Pointschap13ex2.cpp3-D Conformal
13.10.3Loading Transformationschap13ex3.cpp3-D Conformal
into OpenGL, Again
13.10.4Interpolation ofchap13ex4.cpp3-D Conformal
Rigid Body Motions
14.9.1Voronoi Diagrams and chap14ex1.cpp3-D Conformal
Delaunay Triangulations
14.9.2Drawing Euclid's Elementschap14ex2.cpp3-D Conformal
14.9.3Conformal Primitives and chap14ex3.cpp3-D Conformal
14.9.4Fitting a Sphere to chap14ex4.cpp3-D Conformal
a Set of Points
15.8.1The Plungechap15ex1.cpp3-D Conformal
15.8.2Affine Combinations of Pointschap15ex2.cpp3-D Conformal
15.8.3Euclidean Projectionschap15ex3.cpp3-D Conformal
16.10.1Homogeneous 4x4 Matrices tochap16ex1.cpp3-D Conformal
Conformal Versorsc3ga_util.cpp
16.10.2Logarithm ofchap16ex2.cpp3-D Conformal
Scaled Rigid Body Motionc3ga_util.cpp
16.10.3Interpolation ofchap16ex3.cpp3-D Conformal
Scaled Rigid Body Motions
16.10.4The Sea Shellchap16ex4.cpp3-D Conformal


---------------E2GA implementatione2ga.cpp2-D Vector Space
---------------E2GA implementatione2ga.h2-D Vector Space
---------------C2GA implementationc2ga.cpp2-D Conformal
---------------C2GA implementationc2ga.h2-D Conformal
---------------E3GA utilitiese3ga_util.cpp3-D Vector Space
---------------H3GA utilitiesh3ga_util.cpp3-D Homogeneous
---------------C3GA utilitiesc3ga_util.cpp3-D Conformal


---------------E2GA specificatione2ga.gs22-D Vector Space
---------------E2GA profilee2ga.gp22-D Vector Space
---------------E3GA specificatione3ga.gs23-D Vector Space
---------------E3GA profilee3ga.gp23-D Vector Space
---------------H3GA specificationh3ga.gs23-D Homogeneous
---------------H3GA profileh3ga.gp23-D Homogeneous
---------------C2GA specificationc2ga.gs22-D Conformal
---------------C2GA profilec2ga.gp22-D Conformal
---------------C3GA specificationc3ga.gs23-D Conformal
---------------C3GA profilec3ga.gp23-D Conformal