# 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:

- e2ga: The vector space model of 2-D space.
- e3ga: The vector space model of 3-D space (mainly used in Chapters 2 through 10).
- h3ga: The homogeneous model of 3-D space (mainly used in Chapters 11 and 12).
- c2ga: The conformal model of 2-D space.
- c3ga: The conformal model of 3-D space (mainly used in Chapters 13 through 16).

The GA Sandbox is hosted on SourceForge.net. 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.

## Section | ## Name | ## File | ## Model |

1.1 | An Example in Geometric Algebra | chap1ex1.cpp | 3-D Conformal |

. | |||

## Basic Theory | |||

2.13.1 | Drawing Bivectors | chap2ex1.cpp | 2-D Vector Space |

2.13.2 | Hidden Surface Removal | chap2ex2.cpp | 3-D Vector Space |

2.13.3 | Singularities in Vector Fields | hpindex.cpp | 3-D Vector Space |

fields.cpp | |||

3.11.1 | Orthonormalization | chap3ex1.cpp | 3-D Vector Space |

3.11.2 | Implementing the Cross Product | chap3ex2.cpp | 3-D Vector Space |

3.11.3 | Reciprocal Frames | chap3ex3.cpp | 3-D Vector Space |

e3ga_util.cpp | |||

3.11.4 | Color Space Conversion | chap3ex4.cpp | 3-D Vector Space |

. | |||

4.9.1 | Orthogonal Projection | chap4ex1.cpp | 3-D Vector Space |

4.9.2 | Orth. Proj, Matrix Representation | chap4ex2.cpp | 3-D Vector Space |

4.9.3 | Transforming Normal Vectors | chap4ex3.cpp | 3-D Vector Space |

. | |||

5.11.1 | The Meet and Join | chap5ex1.cpp | 3-D Vector Space |

5.11.2 | Efficiency | chap5ex2.cpp | 3-D Vector Space |

5.11.3 | Floating Point Issues | chap5ex3.cpp | 3-D Vector Space |

. | |||

6.7.1 | Subspace Products Retrieved | chap6ex1.cpp | 3-D Vector Space |

6.7.2 | Gram-Schmidt Orthogonalization | chap6ex2.cpp | 3-D Vector Space |

. | |||

7.10.1 | Reflecting in Vectors | chap7ex1.cpp | 3-D Vector Space |

7.10.2 | Two Reflections Equal One Rotation | chap7ex2.cpp | 3-D Vector Space |

7.10.3 | Matrix-Rotor Conversion 1 | chap7ex3.cpp | 3-D Vector Space |

7.10.4 | Matrix-Rotor Conversion 2 | chap7ex4.cpp | 3-D Vector Space |

7.10.5 | Julia Fractals | chap7ex5.cpp | 2-D Vector Space |

. | |||

## Vector Space Model | |||

10.7.1 | Interpolating Rotations | chap10ex1.cpp | 3-D Vector Space |

10.7.2 | Crystallography | chap10ex2.cpp | 3-D Vector Space |

10.7.3 | External Camera Calibration | chap10ex3.cpp | 3-D Vector Space |

extcalibrefine.cpp | |||

## Homogeneous Model | |||

11.13.1 | Working with Points | chap11ex1.cpp | 3-D Homogeneous |

11.13.2 | Intersecting Primitives | chap11ex2.cpp | 3-D Homogeneous |

11.13.3 | Don't Add Lines | chap11ex3.cpp | 3-D Homogeneous |

11.13.4 | Perspective Projection | chap11ex4.cpp | 3-D Homogeneous |

. | |||

12.5.1 | Loading Transformations | chap12ex1.cpp | 3-D Homogeneous |

into OpenGL | |||

12.5.2 | Transforming Primitives | chap12ex2.cpp | 3-D Homogeneous |

with OpenGL Matrices | |||

12.5.3 | Marker Reconstruction | chap12ex3.cpp | 3-D Homogeneous |

in Optical Motion Capture | reconstruct.cpp | ||

. | |||

## Conformal Model | |||

13.10.1 | Metric Matters | chap13ex1.cpp | 3-D Conformal |

13.10.2 | The Distance Between Points | chap13ex2.cpp | 3-D Conformal |

13.10.3 | Loading Transformations | chap13ex3.cpp | 3-D Conformal |

into OpenGL, Again | |||

13.10.4 | Interpolation of | chap13ex4.cpp | 3-D Conformal |

Rigid Body Motions | |||

. | |||

14.9.1 | Voronoi Diagrams and | chap14ex1.cpp | 3-D Conformal |

Delaunay Triangulations | |||

14.9.2 | Drawing Euclid's Elements | chap14ex2.cpp | 3-D Conformal |

14.9.3 | Conformal Primitives and | chap14ex3.cpp | 3-D Conformal |

Intersections | |||

14.9.4 | Fitting a Sphere to | chap14ex4.cpp | 3-D Conformal |

a Set of Points | |||

. | |||

15.8.1 | The Plunge | chap15ex1.cpp | 3-D Conformal |

15.8.2 | Affine Combinations of Points | chap15ex2.cpp | 3-D Conformal |

15.8.3 | Euclidean Projections | chap15ex3.cpp | 3-D Conformal |

. | |||

16.10.1 | Homogeneous 4x4 Matrices to | chap16ex1.cpp | 3-D Conformal |

Conformal Versors | c3ga_util.cpp | ||

16.10.2 | Logarithm of | chap16ex2.cpp | 3-D Conformal |

Scaled Rigid Body Motion | c3ga_util.cpp | ||

16.10.3 | Interpolation of | chap16ex3.cpp | 3-D Conformal |

Scaled Rigid Body Motions | |||

16.10.4 | The Sea Shell | chap16ex4.cpp | 3-D Conformal |

. | |||

## Miscellaneous | |||

--------------- | E2GA implementation | e2ga.cpp | 2-D Vector Space |

--------------- | E2GA implementation | e2ga.h | 2-D Vector Space |

--------------- | C2GA implementation | c2ga.cpp | 2-D Conformal |

--------------- | C2GA implementation | c2ga.h | 2-D Conformal |

--------------- | E3GA utilities | e3ga_util.cpp | 3-D Vector Space |

--------------- | H3GA utilities | h3ga_util.cpp | 3-D Homogeneous |

--------------- | C3GA utilities | c3ga_util.cpp | 3-D Conformal |

. | |||

## Specifications | |||

--------------- | E2GA specification | e2ga.gs2 | 2-D Vector Space |

--------------- | E2GA profile | e2ga.gp2 | 2-D Vector Space |

--------------- | E3GA specification | e3ga.gs2 | 3-D Vector Space |

--------------- | E3GA profile | e3ga.gp2 | 3-D Vector Space |

--------------- | H3GA specification | h3ga.gs2 | 3-D Homogeneous |

--------------- | H3GA profile | h3ga.gp2 | 3-D Homogeneous |

--------------- | C2GA specification | c2ga.gs2 | 2-D Conformal |

--------------- | C2GA profile | c2ga.gp2 | 2-D Conformal |

--------------- | C3GA specification | c3ga.gs2 | 3-D Conformal |

--------------- | C3GA profile | c3ga.gp2 | 3-D Conformal |