Visualizing Conformal Geometric Algebra
Visualizing Conformal Geometric Algebra
Visualizing Conformal Geometric Algebra
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>Visualizing</strong><br />
<strong>Conformal</strong> <strong>Geometric</strong> <strong>Algebra</strong><br />
Bas Fagginger Auer<br />
June 30, 2006
Contents<br />
Abstract<br />
i<br />
Introduction<br />
iii<br />
0.1 About the image on the cover . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii<br />
0.2 Used programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii<br />
0.3 Welcome . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii<br />
1 <strong>Geometric</strong> <strong>Algebra</strong> 1<br />
1.1 Rationale . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1<br />
1.1.1 Our goal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1<br />
1.1.2 Current model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1<br />
1.1.3 Extending R n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2<br />
1.1.4 Operations on our extended space . . . . . . . . . . . . . . . . . . . . . . . . . . . 5<br />
1.1.5 Use of our extended space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8<br />
1.1.6 Embedding R n in our extended space . . . . . . . . . . . . . . . . . . . . . . . . . 9<br />
1.2 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10<br />
1.3 Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
1.3.1 Data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
1.3.2 Extended signature . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11<br />
1.3.3 Order sign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12<br />
1.3.4 Kronecker delta . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13<br />
1.3.5 Multivector addition and scalar multiplication . . . . . . . . . . . . . . . . . . . . 13<br />
1.3.6 ·, ∧ and • products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13<br />
1.3.7 Multivector division . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14<br />
2 Extended <strong>Geometric</strong> <strong>Algebra</strong> 17<br />
2.1 Homogeneous geometric algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17<br />
2.2 <strong>Conformal</strong> geometric algebra . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18<br />
2.3 Object classification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20<br />
2.4 <strong>Visualizing</strong> Euclidian 3-space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23<br />
3
2.5 <strong>Visualizing</strong> Hyperbolic 3-space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26<br />
3 Conclusion 31<br />
3.1 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31<br />
Appendices 33<br />
3.2 Binary numbers and operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33<br />
3.3 Notes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34<br />
4
Abstract<br />
This document is intended as an introduction to implementing a geometric algebra interpreter on a<br />
computer and visualizing elements of 3-dimensional conformal geometric algebras with both Euclidian<br />
and Hyperbolic signatures. It provides implementations of the outer, inner and geometric products as<br />
well as inverting a geometric product in arbitrary dimension.<br />
i
Introduction<br />
0.1 About the image on the cover<br />
The image is a so-called xor pattern. It is made by plotting the value ‘x xor y’ at each pixel (x, y) on<br />
the computer screen in 320x200 standard VGA mode using the standard palette (screen 10011). What<br />
this image (or actually, the ‘xor’ operation itself) has to do with geometric algebra shall become clear in<br />
the first chapter of this paper.<br />
0.2 Used programs<br />
The typesetting of this document was done using L A TEXand (almost all) figures were made with the<br />
program Xfig.<br />
0.3 Welcome<br />
The writing of the program CGAview and this document was supervised by Dr. F.M.C. Witte of the<br />
department of physics and astronomy of the university of Utrecht (Holland). This paper was written as<br />
part of my (third year) Bachelor project which concerned visualization of conformal geometric algebra.<br />
Chapter one<br />
I will start this chapter with a rationale, explaining the reason and use of geometric algebra. Following up<br />
to this rationale I shall give definitions for the geometric, outer and inner products and what it actually<br />
means to represent an object in this algebra. After the definitions there shall be a more technical section<br />
concerned with actually implementing all these operations on a computer. This concludes the first<br />
chapter and with all the necessary algebraic tools at our disposal we can continue to the second part of<br />
the paper.<br />
Chapter two<br />
In the first section of the second chapter we will increase the dimensionality of our model to be able<br />
to represent a greater class of objects. After this we shall consider methods to classify and visualize<br />
represented objects in 3 dimensional space with both Euclidian (+ + +) and Hyperbolic (+ - -) signatures.<br />
This concludes the paper and the reader should now be able to implement a program far prettier than<br />
CGAview without too much trouble.<br />
Appendices<br />
The first appendix deals with binary numbers and associated (bitwise) operations, anyone who is unfamiliar<br />
with binary numbers should first leaf through this before reading the paper.<br />
The program<br />
This paper was written during the development the aforementioned program with which CGA could be<br />
visualized: CGAview. CGAview is very similar to (and much inspired by) the program ‘GA viewer’ (see<br />
iii
[4] in particular), but with the additional capability of visualizing Hyperbolic CGA. It was written pretty<br />
much from scratch, I made no use of the source of GA viewer/Gaigen, because I felt that to understand<br />
CGA, I had to write all routines myself. Nevertheless GA viewer was a great inspiration and I very much<br />
encourage everyone who likes playing around with CGAview to take a look at it.<br />
Bas Fagginger Auer<br />
iv
Chapter 1<br />
<strong>Geometric</strong> <strong>Algebra</strong><br />
1.1 Rationale<br />
1.1.1 Our goal<br />
Our aim is to create a model of space that is as complete as possible (in terms of what aspects of space<br />
it can describe), but can still be readily applied to simple problems, such as arise in physics.<br />
We assume space to be described uniquely by its dimension n ∈ N (the number of independent directions<br />
in which we can move) and the signature function σ : {1, 2, . . . , n} → {−1, +1} describing distance.<br />
The signature can be seen as an indication of how your distance to the origin changes if you travel<br />
along one of the independent directions from the origin. For example, suppose n = 2 with σ(1) = 1<br />
and σ(2) = −1, then if we take a step in direction 1, our distance to the origin increases, while if we<br />
take a step in direction 2 (which is independent of direction 1, meaning that we do not at all move in<br />
direction 1), our distance to the origin decreases. Clearly for ‘usual’ (Euclidian) space, we must have<br />
that σ(k) = 1 for all 1 ≤ k ≤ n, as we always move away from the origin if we take a step, no matter<br />
our direction. Spaces where some directions have a negative signature are particularly useful in physics,<br />
where they are used as a model for relativistic space-time.<br />
1.1.2 Current model<br />
Usually space with these parameters is modelled as the vectorspace R n (the elements of which are called<br />
vectors) together with a pseudo-Euclidian inner product (as we want to include the possibility of negative<br />
signatures):<br />
n∑<br />
< ., . >: R n × R n → R : ((a 1 , a 2 , . . . , a n ), (b 1 , b 2 , . . . , b n )) ↦→ σ(i)a i b i<br />
Apart from the inner product we also have two other operations, vector addition:<br />
+ : R n × R n → R : ((a 1 , a 2 , . . . , a n ), (b 1 , b 2 , . . . , b n )) ↦→ (a 1 + b 1 , a 2 + b 2 , . . . , a n + b n )<br />
and scalar multiplication (elements α ∈ R are called scalars):<br />
i=1<br />
· : R × R n → R n : (α, (b 1 , b 2 , . . . , b n )) ↦→ (αb 1 , αb 2 , . . . , αb n )<br />
All these operations have a very clear geometrical interpretation if we interpret elements a = (a 1 , a 2 , . . . , a n ) ∈<br />
R n as taking a 1 steps in direction 1, a 2 steps in direction 2, . . . , and a n steps in direction n. The sum<br />
c = a + b of two vectors is simply the amount of steps we need to move if we want to go where we would<br />
end up after first moving along a and then along b. Similarly scalar multiplication b = αa is simply<br />
moving along a, but doing so α times. The inner product of a vector with itself < a, a > measures<br />
1
a<br />
a+b<br />
a<br />
2a<br />
b<br />
Figure 1.1: Vector addition and scalar multiplication<br />
the (square of the) distance from the origin we would be if we moved along a and the inner product<br />
of two different vectors < a, b > gives us a measure for their lengths and (in)dependence. Note that<br />
(using vector addition and scalar multiplication) we can write all vectors a = (a 1 , a 2 , . . . , a n ) as a linear<br />
combination of the base vectors e 1 = (1, 0, 0, . . . , 0), e 2 = (0, 1, 0, . . . , 0), . . . , e n = (0, 0, . . . , 0, 1), being<br />
a = ∑ n<br />
i=1 a ie i (the e i are in fact nothing but the n independent directions in which we can move). We<br />
call the collection B := {e i |1 ≤ i ≤ n} the basis of R n and this collection has the property that any<br />
element a ∈ R n can be written as a unique linear combination of elements from B using vector addition<br />
and scalar multiplication (as it is an orthogonal basis with respect to < ., . >).<br />
This description is very simple and easily applied to physical problems (Newtonian dynamics for instance),<br />
but also quite limited in terms of what it can describe. The elements of R n only describe<br />
‘movements’ or 1-dimensional linear subspaces with a certain magnitude (think of movements as the<br />
direction or line along which we move and the magnitude as how far we move). Extended objects as<br />
planes or spheres (which are prevalent in the 3-dimensional space we are familiar with) are not at all<br />
included.<br />
1.1.3 Extending R n<br />
Therefore we seek to extend this model (given its success, R n is not a bad model to start out with) to<br />
encompass as much classes of objects as possible. The first thing we will try is to include k-dimensional<br />
linear subspaces for all 0 ≤ k ≤ n since in R n only 1-dimensional linear subspaces are represented<br />
(vectors), but not planes and their higher dimensional extensions. To do so, we introduce the wedge, ∧,<br />
operator. For now we define it only in a pictorial way, a more precise definition can be found in the next<br />
section.<br />
a<br />
a<br />
a^b<br />
c<br />
a<br />
a^b^c<br />
b<br />
b<br />
Figure 1.2: The wedge operator<br />
For any two linear subspaces a and b, a ∧ b can be seen as being the span of a and b with an associated<br />
size depending on a and b (although we must be careful, just like vectors these linear subspaces only have<br />
a certain orientation and size, but no finite shape). From the pictorial definition, it is easily seen that<br />
we must demand the ∧ operator to have the following properties for all vectors a, b and c and scalars α:<br />
a ∧ b = −b ∧ a<br />
(αa) ∧ b = a ∧ (αb) = α(a ∧ b)<br />
(a ∧ b) ∧ c = a ∧ (b ∧ c)<br />
a ∧ (b + c) = a ∧ b + a ∧ c<br />
Note that because of the first property a ∧ a = −a ∧ a so a ∧ a = 0 for all vectors a.<br />
2
a<br />
a^b<br />
a<br />
b^a<br />
b<br />
b<br />
a<br />
b<br />
a^b<br />
2a<br />
b<br />
(2a)^b<br />
a<br />
2b<br />
a^(2b)<br />
c<br />
a<br />
a^b<br />
c<br />
a<br />
(a^b)^c<br />
b<br />
b<br />
c<br />
a<br />
b^c<br />
c<br />
a<br />
a^(b^c)<br />
b<br />
b<br />
a<br />
c<br />
a^b<br />
a<br />
a^c<br />
+ c<br />
=<br />
a<br />
c<br />
a^(b+c)<br />
b<br />
b<br />
b<br />
b+c<br />
Figure 1.3: Wedge operator properties<br />
3
Let us try to write out a general form of the ∧ product for a collection of vectors using the properties<br />
mentioned above:<br />
a 1 ∧ a 2 ∧ . . . ∧ a k =<br />
=<br />
=<br />
( n ∑<br />
i 1=1<br />
n∑<br />
i 1 =1 i 2 =1<br />
) ( ∑<br />
n<br />
a 1i1 e i1 ∧<br />
n∑<br />
. . .<br />
∑<br />
i 2=1<br />
) ( ∑<br />
n<br />
a 2i2 e i2 ∧ . . . ∧<br />
i k =1<br />
a kik e ik<br />
)<br />
n∑<br />
( )<br />
a 1i1 a 2i2 . . . a kik ei1 ∧ e i2 ∧ . . . ∧ e ik<br />
i k =1<br />
1≤i 1
multiplication and in that sense, nothing at all new. Right now, this is quite correct (the only difference<br />
is the interpretation of the base vectors, but this is not yet of any practical use), but if we manage to<br />
find operations on this space with which we can illustrate the geometrical interpretations of the base<br />
vectors, the model G n may become a lot more appealing.<br />
1.1.4 Operations on our extended space<br />
The first operations we can define on G n are the ∧ product, which we already have, and an extension<br />
of the inner product (currently only defined for vectors). First note that both operations (applied to<br />
vectors) are bilinear and associative. These are properties we would like to have the extensions of these<br />
operations to the entire G n to have as well (as we have seen that they make sense geometrically for<br />
vectors). Because of this, we can use a small trick to make it easier to find out how the operations work<br />
on the entire space.<br />
Let us consider some bilinear, associative operation □ on G n and two arbitrary elements (not necessarily<br />
one-dimensional linear subspaces, just anything in the span of the base elements γ i ) a, b ∈ G n . We will<br />
call such arbitrary elements multivectors to distinguish them from vectors. Because of our basis B ′ of<br />
G n and the bilinearity and associativity of □:<br />
a□b =<br />
=<br />
( 2∑<br />
n −1<br />
i=0<br />
2∑<br />
n −1<br />
i=0<br />
a i γ i<br />
)□<br />
2∑<br />
n −1<br />
j=0<br />
( 2 n −1<br />
∑ )<br />
b j γ j<br />
j=0<br />
a i b j<br />
(<br />
γi □γ j<br />
)<br />
So □ is completely defined in terms of how it operates on the base vectors γ i . Therefore we only need<br />
to consider base vectors if we want to know how a bilinear, associative operator works on the entire G n .<br />
The wedge product<br />
Let’s start with examining the ∧ operator of two arbitrary base vectors γ i and γ j . To do so, decompose<br />
both i and j in binary as usual: i = 2 i 1−1 + 2 i 2−1 + . . . + 2 i k−1 , j = 2 j 1−1 + 2 j 2−1 + . . . + 2 j l−1 with<br />
1 ≤ i 1 < i 2 < . . . < i k ≤ n and 1 ≤ j 1 < j 2 < . . . < j l ≤ n and use the definition of the basis B ′ and<br />
associativity of ∧:<br />
γ i ∧ γ j = ( e i1 ∧ e i2 ∧ . . . ∧ e ik<br />
)<br />
∧<br />
(<br />
ej1 ∧ e j2 ∧ . . . ∧ e jl<br />
)<br />
= e i1 ∧ e i2 ∧ . . . ∧ e ik ∧ e j1 ∧ e j2 ∧ . . . ∧ e jl<br />
We know that the ∧ operator is antisymmetric, so we can order this expression such that i 1 ≤ i 2 ≤ . . . ≤<br />
i k ≤ j 1 ≤ j 2 ≤ . . . ≤ j l by swapping any two adjacent base vectors which have an out of order index.<br />
This induces a sign which depends only on the numers i 1 , i 2 , . . . , i k , j 1 , j 2 , . . . , j l . Since these uniquely<br />
define i and j we can define a new function sgn(i, j) which is precisely the sign change because of the<br />
ordering of the base vectors in the expression. With this new function we can write:<br />
γ i ∧ γ j = e i1 ∧ e i2 ∧ . . . ∧ e ik ∧ e j1 ∧ e j2 ∧ . . . ∧ e jl<br />
= sgn(i, j)e i ′<br />
1<br />
∧ e i ′<br />
2<br />
∧ . . . ∧ e i ′<br />
k+l<br />
Where i ′ 1 ≤ i ′ 2 ≤ . . . ≤ i ′ k+l are simply the original i 1, . . . , i k , j 1 , . . . , j l in a different order.<br />
Now suppose there exists a 1 ≤ m ≤ k + l such that i ′ m = i ′ m+1. Then the same vector occurs twice in<br />
the expression and since the ∧ is antisymmetric the wedge product has to be zero. But this can occur<br />
if and only if there exist 1 ≤ k ′ ≤ k and 1 ≤ l ′ ≤ l such that i k ′ = j l ′ since i 1 < i 2 < . . . < i k and<br />
j 1 < j 2 < . . . < j l . If we now write i and j in binary, then the bits on position i k ′ = j l ′ are set in both<br />
binary forms and therefore the bit on position i k ′ = j l ′ in the number i and j is set as well. Because of<br />
this i and j ≠ 0 (see Appendix A for a definition of the binary ‘and’ operator).<br />
Conversely, if no m can be found such that i ′ m = i ′ m+1, then there cannot be k ′ and l ′ such that i k ′ = j l ′<br />
and therefore all the bits set in the binary form of i are not set in the binary form of j and vice versa.<br />
Therefore i and j = 0.<br />
5
So there are two possibilities: either i and j ≠ 0 and the same vector occurs twice in the wedge expression,<br />
resulting in it being equal to 0 or i and j = 0 and all the vectors in the wedge expression are different,<br />
resulting in i ′ 1 < i ′ 2 < . . . < i ′ k+l . In the latter case this wedge e i 1 ′ ∧ e i ′ ∧ . . . ∧ e 2 i ′ = γ<br />
k+l i ′ for i ′ =<br />
2 i′ 1 −1 + 2 i′ 2 −1 + . . . + 2 i′ k+l −1 , because 1 ≤ i ′ 1 < i ′ 2 < . . . < i ′ k+l<br />
≤ n. But we know that the numbers<br />
i ′ 1, i ′ 2, . . . , i ′ k+l are precisely i 1, . . . , i k , j 1 , . . . , j l , only in a different order, so the set bits of i ′ are precisely<br />
the set bits of i and the set bits of j, therefore i ′ = i or j (if some base vector occurs in either γ i or in<br />
γ j , then it has to occur in γ i ∧ γ j if this expression is nonzero).<br />
With this observation the final expression becomes:<br />
γ i ∧ γ j = sgn(i, j)e i ′<br />
1<br />
∧ e i ′<br />
2<br />
∧ . . . ∧ e i ′<br />
k+l<br />
= sgn(i, j)δ i and j<br />
0 γ i or j<br />
Where δj i is the Kronecker delta, defined as being equal to 1 if i = j and equal to 0 otherwise. The above<br />
expression defines the ∧ operator on the entire G n through bilinearity.<br />
The inner product<br />
Now we will generalize the inner product. We define the inner product a • b to be the orthoplement<br />
of the orthogonal projection of a onto b, linear in both its arguments and coinciding with the inner<br />
product < ., . > for vectors we already were provided with. This definition is called the left-contraction<br />
inner product and leads to the following properties (see [2] and [3]) for scalars α, β, vectors a, b and<br />
multivectors A, B, C:<br />
α • β = αβ<br />
a • α = 0<br />
α • a = αa<br />
a • b = < a, b ><br />
a • (b ∧ C) = (a • b) ∧ C − b ∧ (a • C)<br />
(A ∧ B) • C = A • (B • C)<br />
Now we want to derive a closed expression for γ i • γ j , let us first consider a more simple case:<br />
Consider (using the beforelast rule of •):<br />
( )<br />
• ej1 ∧ e j2 ∧ . . . ∧ e jl<br />
e i<br />
e i • e j =< e i , e j >= δ i jσ(i)<br />
= (e i • e j1 ) ∧ (e j2 ∧ . . . ∧ e jl ) − e j1 ∧ (e i • (e j2 ∧ . . . ∧ e jl ))<br />
= (e i • e j1 ) ∧ (e j2 ∧ . . . ∧ e jl ) −<br />
(<br />
)<br />
e j1 ∧ (e i • e j2 ) ∧ (e j3 ∧ . . . ∧ e jl ) − e j2 ∧ (e i • (e j3 ∧ . . . ∧ e jl ))<br />
= (e i • e j1 ) ∧ (e j2 ∧ . . . ∧ e jl ) + (e i • e j2 ) ∧ (e j1 ∧ e j3 ∧ . . . ∧ e jl ) +<br />
e j1 ∧ e j2 ∧ (e i • (e j3 ∧ . . . ∧ e jl ))<br />
= (e i • e j1 ) ∧ (ê j1 ) + (e i • e j2 ) ∧ (ê j2 ) +<br />
. . .<br />
e j1 ∧ e j2 ∧ (e i • (e j3 ∧ . . . ∧ e jl ))<br />
= (e i • e j1 ) ∧ (ê j1 ) + (e i • e j2 ) ∧ (ê j2 ) + . . . + (e i • e jl ) ∧ (ê jl )<br />
Here (ê j2 ) is used to denote the entire wedge e j1 ∧ e j2 ∧ . . . ∧ e jl without the vector e j2 (the vector with<br />
the hat is left out of the expression).<br />
We are now ready to take care of arbitrary base multivectors, let γ i , γ j ∈ B ′ and write i and j in binary<br />
as usual: i = 2 i1−1 + 2 i2−1 + . . . + 2 ik−1 , j = 2 j1−1 + 2 j2−1 + . . . + 2 jl−1 with 1 ≤ i 1 < i 2 < . . . < i k ≤ n<br />
and 1 ≤ j 1 < j 2 < . . . < j l ≤ n. Use the last rule for •:<br />
)<br />
)<br />
γ i • γ j =<br />
(e i1 ∧ e i2 ∧ . . . ∧ e ik •<br />
(e j1 ∧ e j2 ∧ . . . ∧ e jl<br />
6
(<br />
= e i1 •<br />
= e i1 •<br />
(<br />
e i2 •<br />
(<br />
e i2 •<br />
(<br />
. . . •<br />
(<br />
. . . •<br />
)) ))<br />
(e j1 ∧ e j2 ∧ . . . ∧ e jl . . .<br />
e ik •<br />
(<br />
)<br />
(e ik • e j1 ) ∧ (ê j1 ) + . . . + (e ik • e jl ) ∧ (ê jl )<br />
Suppose that i k ≠ j l ′ for all 1 ≤ l ′ ≤ l, then (as e i • e j = δj iσ(i))<br />
))<br />
. . .<br />
the entire expression equals 0. Otherwise, call r k = l ′ (so i k = j rk )<br />
and all inner products vanish except for (e ik • e jrk ) = σ(i k ).<br />
We will assume that such an j rk can be found,<br />
otherwise the entire expression simply equals 0.<br />
( ( ( (<br />
) ))<br />
= e i1 • e i2 • . . . • e ik−1 • σ(i k ) ∧ (ê jrk ) . . .<br />
( ( (<br />
(<br />
))<br />
= e i1 • e i2 • . . . • 0 − σ(i k ) ∧ e ik−1 • (ê jrk )<br />
( ( (<br />
= e i1 • e i2 • . . . • − σ(i k )σ(i k−1 ) ∧ (ê jrk , ê jrk−1 )<br />
. . . Process i k−2 , i k−3 , . . . , i 1 similarly.<br />
= (−1) k+1 σ(i 1 )σ(i 2 ) . . . σ(i k )(ê jr1 , . . . , ê jrk )<br />
= (−1) k+1 σ(i 1 )σ(i 2 ) . . . σ(i k )(ê i1 , . . . , ê ik )<br />
))<br />
. . .<br />
))<br />
))<br />
. . .<br />
This is under the assumption that for any i k ′ we can find an j l ′ = i k ′, otherwise the expression becomes<br />
zero. So any bit that is set in i, should be set in j if the result is to be nonzero. This is the case if and<br />
only if i and j = i. Furthermore, all base vectors occuring in the wedge γ i are removed from the wedge<br />
γ j (note (ê i1 , . . . , ê ik ) in the expression for γ i • γ j ). So all bits set in i are cleared in j. As these bits also<br />
have to be set in j (otherwise the result is 0) this is a xor operation: (ê i1 , . . . , ê ik ) = γ i xor j. Note that<br />
because all set bits in i also occur in j, we have that sgn(i, j) = (−1) k+1 . At this point it is useful to<br />
introduce the extended signature ˆσ(i) := σ(i 1 )σ(i 2 ) . . . σ(i k ). This allows us to write the final expression<br />
as (in the above expression we assumed that i and j = i, so we need to add the Kronecker delta):<br />
γ i • γ j = δ i and j<br />
i (−1) k+1 σ(i 1 )σ(i 2 ) . . . σ(i k )(ê i1 , . . . , ê ik )<br />
= δ i and j<br />
i sgn(i, j)ˆσ(i)γ i xor j<br />
This expression defines the inner product on the entire G n through bilinearity.<br />
The geometric product<br />
The only thing left to do is to define a suitable geometric product on our space. To make our geometric<br />
product easy to work with, it should be bilinear, associative and, if possible, invertible.<br />
Let us first concentrate on the product of just two vectors a and b. We already have two bilinear products<br />
(being ∧ and •), but neither is invertible as becomes apparent if we consider the solution sets for b of<br />
the equations a ∧ b = C and a • b = α. These are the line {b + βa|β ∈ R} for the ∧ product (as<br />
a ∧ (b + βa) = a ∧ b + βa ∧ a = a ∧ b) and a plane with normal a at distance α/|a| from the origin for<br />
the • product. The intersection of both solution sets however (as noted in [2]) is exactly one point, so<br />
if we define the geometric product as a · b := a • b + a ∧ b then a · b = α + C has a unique solution b.<br />
Furthermore with this definition the geometric product is bilinear and associative just as we desired.<br />
For base vectors this definition results in:<br />
{<br />
σ(i) = ej · e<br />
e i · e j = e i • e j + e i ∧ e j =<br />
i if i = j<br />
e i ∧ e j = −e j · e i if i ≠ j<br />
We can easily extend this to base multivectors, as with deriving the ∧ product:<br />
γ i · γ j = ( e i1 ∧ e i2 ∧ . . . ∧ e ik<br />
)<br />
·<br />
(<br />
ej1 ∧ e j2 ∧ . . . ∧ e jl<br />
)<br />
= ( e i1 · e i2 · . . . · e ik<br />
)<br />
·<br />
(<br />
ej1 · e j2 · . . . · e jl<br />
)<br />
= e i1 · e i2 · . . . · e ik · e j1 · e j2 · . . . · e jl<br />
= sgn(i, j)e i ′<br />
1 · e i ′<br />
2 · . . . · e i ′<br />
k+l<br />
7
We used the expression for base vectors and the associativity of the geometric product. 1 ≤ i ′ 1 ≤ i ′ 2 ≤<br />
. . . ≤ i ′ k+l ≤ n is a re-arrangement of i 1, i 2 , . . . , i k , j 1 , j 2 , . . . , j l (we can exchange the base vectors just as<br />
with the ∧ product). Now we consider all the 1 ≤ k ′ < k+l for which i ′ k = ′ i′ k ′ +1 , then e i ′ ·e k ′ i ′ = σ(i′ k ′ +1 k ′).<br />
This can only occur (as all the i k ′ and j l ′ are distinct) if i ′ k = i ′ k ′′ and i′ k ′ +1 = j l ′ (or vice versa) for some<br />
k ′′ and l ′ . Therefore the same bit at position i k ′′ = j l ′ in both i and j needs to be set. Conversely, if in<br />
both i and j the same bit is set, then the same basevector occurs twice and can hence be replaced with<br />
σ(i ′ k ′). Therefore all base vectors removed from the product in this way are exactly those whose bits are<br />
set in i and j and for each removal the sign changes with σ(i ′ k ′):<br />
γ i · γ j = sgn(i, j)ˆσ(i and j)e i ′′<br />
1 · e i ′′<br />
2 · . . . · e i ′′ N<br />
Where 1 ≤ i ′′<br />
1 < i ′′<br />
2 < . . . < i ′′ N ≤ n and N ≤ k + l. This is again a new base multivector, γ i xor j to<br />
be precise (if a bit is set in both i and j, the same basevector occurs in both wedges γ i and γ j , it is<br />
removed, otherwise the vector is added to the wedge). With this information we can write:<br />
We now have closed formulas for all our products:<br />
γ i · γ j = sgn(i, j)ˆσ(i and j)γ i xor j<br />
γ i ∧ γ j = sgn(i, j)δ i and j<br />
0 γ i or j<br />
γ i • γ j = δ i and j<br />
i sgn(i, j)ˆσ(i)γ i xor j<br />
γ i · γ j = sgn(i, j)ˆσ(i and j)γ i xor j<br />
To symmetrize them, note that if i and j = 0 then i or j = i xor j and ˆσ(i and j) = ˆσ(0) = 1 (empty<br />
product). Furthermore δ i and j = 1 always, so we can also write our products as:<br />
i and j<br />
γ i ∧ γ j = sgn(i, j)δ i and j<br />
0 ˆσ(i and j)γ i xor j<br />
γ i • γ j = sgn(i, j)δ i and j<br />
i ˆσ(i and j)γ i xor j<br />
γ i · γ j = sgn(i, j)δ i and j<br />
i and j ˆσ(i and j)γ i xor j<br />
Hopefully, it is now apparent why I chose the ‘xor’ operation to illustrate the cover of this document: it<br />
is embedded in our algebra in the most fundamental way.<br />
1.1.5 Use of our extended space<br />
Now that we have our new space and its operations, it is time to see its geometrical use. Let us consider G n<br />
with the Euclidian signature (so σ(1) = σ(2) = . . . = σ(n) = 1). Let ι C : C → G 2 : a+bi ↦→ a1+b(e 1 ∧e 2 )<br />
this is an embedding and because (e 1 ∧ e 2 ) · (e 1 ∧ e 2 ) = e 1 · e 2 · e 1 · e 2 = −e 1 · e 1 · e 2 · e 2 = −σ(1)σ(2) = −1<br />
we have that ι C (z · w) = ι C (z) · ι C (w). So this embedding of the complex numbers in our extended<br />
space preserves complex multiplication: C is ‘part’ of our extended space and the geometric product is<br />
(when restricted to ι C (C)) nothing more than complex multiplication. This even gives us a geometrical<br />
interpretation of i = √ −1 being e 1 ∧ e 2 : i is the 2-dimensional linear subspace spanned by the base<br />
vectors e 1 and e 2 with size 1.<br />
Furthermore, the quaternions H are part of G 3 in a similar manner, the embedding ι H : H → G 3 :<br />
a + bi + cj + dk ↦→ a1 + b(e 2 ∧ e 3 ) + c(e 1 ∧ e 3 ) + d(e 1 ∧ e 2 ) preserves the quaternion product. So our<br />
geometrical product is ‘right’ in the sense that in certain linear subspaces of our extended space it reduces<br />
to useful products we are already familiar with.<br />
Another use is mentioned in [3], given some linear subspace A = a 1 ∧ a 2 ∧ . . . ∧ a k we can easily seperate<br />
any vector a ∈ R n in a part a ⊥ perpendicular to A and a ‖ parallel to A. This is such that a = a ⊥ + a ‖<br />
with a ⊥ • A = 0 and a ‖ ∧ A = 0.<br />
Note that a ⊥ · A = a ⊥ • A + a ⊥ ∧ A = 0 + a ⊥ ∧ A + a ‖ ∧ A = a ∧ A (the formula a · A = a • A + a ∧ A<br />
can be derived from the definitions of the products in the previous paragraph and the particular form of<br />
8
A). Also a ‖ · A = a ‖ • A + a ‖ ∧ A = a • A. Now dividing by A yields:<br />
a ⊥ = ( a ∧ A ) /A a ‖ = ( a • A ) /A<br />
In [2] it is shown that we can rotate any multivector by simple conjugating it with the multivector<br />
e A φ 2 (we define e x := ∑ ∞<br />
) where φ is the angle in radians and A is the plane of rotation (e.g.<br />
n=1 xn<br />
n!<br />
A = e 1 ∧ e 2 ). So to rotate any multivector x to x ′ simply use x ′ = e −A φ 2 xe +A φ 2 . This formula applies to<br />
any multivector x of any dimension (we can rotate a plane like x = e 2 ∧ e 3 using the same formula) in<br />
arbitrary G n .<br />
Later, after the introduction of the conformal geometric algebra, it will become clear that the products<br />
on our extended space can be used to do a variety of things: rotations, translations, reflections,<br />
sphere/line/plane intersections and more. It turns out that all these operations can be described with<br />
formulas independent of the chosen basis and dimension of our space. This independence is the true<br />
benefit of using geometric algebra.<br />
1.1.6 Embedding R n in our extended space<br />
Until now we have more or less pretended that the (base)vectors are elements of our space G n , but this<br />
is not entirely true. We view e i ∈ G n ≃ R 2n while (strictly speaking) e i ∈ R n and these are two very<br />
different sets. What we mean of course is (through the ‘definition’ of our base multivectors γ i ) that we<br />
associate e i with the wedge consisting of only one element: γ 2 i−1. To make this mathematically precise,<br />
we say that the R n is embedded in our extended space G n via the map (actually a linear embedding)<br />
ι K : R n → G n : ∑ n<br />
i=1 a ie i ↦→ ∑ n<br />
i=1 a iγ 2 i−1. Later we will see that embedding R n in other ways (in<br />
higher dimensional models of space) can be extremely useful. If left unspecified however, the embedding<br />
is assumed to be the default ι K we have been using implicitly all the time.<br />
We set out extending our space with the ∧ operator such that ‘planes and their higher dimensional<br />
equivalents are part of our model’, but without ever specifying what we actually meant. To make this<br />
precise, we consider some object A ⊆ R n and a linear embedding ι of R n into G m for some m. Suppose<br />
A to be a linear subspace, then A is the span of some vectors a 1 , . . . , a k and we have that a ∈ A if and<br />
only if a is a linear combination of the vectors a 1 , . . . , a k , but (in our extended model G n ) this is the<br />
case if and only if a ∧ (a 1 ∧ . . . ∧ a k ) = 0, so we would like to say that a 1 ∧ . . . ∧ a k represents the linear<br />
subspace A.<br />
This motivates the definition that some multivector B ∈ G m represents an object A ⊆ R n if and only if<br />
x ∈ A ⇐⇒ ι(x) ∧ B = 0 (and in our example of a linear subspace A, ι was just the default inclusion of<br />
R n in G n ).<br />
In R n you can also characterize a plane through the origin with just a normal vector a. To include this<br />
type of representation in our extended model, we say that B dually represents an object A if and only<br />
if x ∈ A ⇐⇒ ι(x) • B = 0 (as for all elements x in a plane through the origin with normal a we have<br />
that < x, a >= 0).<br />
There is a way to switch from one representation to another if we make two additional definitions. For<br />
any geometric algebra G n we define γ 2 n −1 (the wedge of all base vectors: all bits are set) to be the<br />
pseudoscalar. The inner product of some multivector B with the pseudoscalar is called the dual of B:<br />
B ∗ := B • γ 2 n −1. The use of these definitions becomes apparent when we consider the final rule of the<br />
inner product: (x ∧ B) • γ 2 n −1 = x • (B • γ 2 n −1) = x • B ∗ . From this we see that B represents A if and<br />
only if B ∗ dually represents A. So the dual of a plane is its normal and vice versa (as (B ∗ ) ∗ = B). This<br />
operation permits us to switch from direct object representation to dual representation and back again.<br />
Also note that (since we xor the bits with 1111 . . . 111) if B has grade k, then B ∗ has grade n − k as all<br />
bits are inverted because of the xor operation when we take the dual.<br />
Further use of the dual is (as illustrated in [2]) the calculation of the largest linear subspace contained<br />
in two given linear subspaces (i.e. for two planes this is usually the line given by their intersection). For<br />
A, B ∈ G n it turns out that B ∗ • A is the largest common linear subspace of A and B .<br />
9
This concludes this (rather lengthy) introduction to geometric algebra as an extended model of space.<br />
Actually it is nothing more than a justification of the definitions that are about to follow, but a very<br />
important one, as it emphasizes their geometrical motivation.<br />
1.2 Definitions<br />
Let n ∈ N and σ : {1, 2, . . . , n} → {−1, +1} be given.<br />
Definition: The extended signature ˆσ:<br />
ˆσ : {0, 1, . . . , 2 n − 1} → {−1, +1} : i ↦→<br />
k∏<br />
σ(i j )<br />
j=1<br />
for i = 2 i1−1 + 2 i2−1 + . . . + 2 i k−1<br />
1 ≤ i 1 < i 2 < . . . < i k ≤ n<br />
This map is well-defined because every natural number can be written uniquely in binary form.<br />
Definition: The order sign sgn:<br />
sgn : {0, 1, . . . , 2 n − 1} × {0, 1, . . . , 2 n − 1} → {−1, +1}<br />
Let (i, j) ∈ {0, 1, . . . , 2 n −1}×{0, 1, . . . , 2 n −1}, write them both in binary form: i = 2 i1−1 +2 i2−1 +. . .+<br />
2 ik−1 and j = 2 j1−1 + 2 j2−1 + . . . + 2 jl−1 for 1 ≤ i 1 < i 2 < . . . < i k ≤ n and 1 ≤ j 1 < j 2 < . . . < j l ≤ n.<br />
Define sgn(i, j) := (−1) N where N equals the number of nontrivial transpositions (exchanges of two<br />
adjacent, different numbers) to order (i 1 , i 2 , . . . , i k , j 1 , j 2 , . . . , j l ) such that i 1 < i 2 < . . . < i k < j 1 <<br />
j 2 < . . . < j l . This is well-defined because any natural number can be written uniquely in binary form<br />
and because if we have two different ways to order the sequences, they must differ an even number of<br />
transpositions and (−1) N+2K = (−1) N for any integer K.<br />
Definition: The Kronecker delta δ i j :<br />
δ : Z × Z → {0, 1} : (i, j) ↦→ δ i j :=<br />
{<br />
1 if i = j<br />
0 if i ≠ j<br />
Definition: The n-dimensional geometrical algebra:<br />
G n := (R 2n , +, ·, ∧, •, (0, 0, . . . , 0), (1, 0, . . . , 0))<br />
Where for any α ∈ R and (a 1 , a 2 , . . . , a 2 n), (b 1 , b 2 , . . . , b 2 n) ∈ R 2n :<br />
(a 0 , a 1 , . . . , a 2 n −1) + (b 0 , b 1 , . . . , b 2 n −1) := (a 0 + b 0 , a 1 + b 1 , . . . , a 2 n −1 + b 2 n −1)<br />
α(a 0 , a 1 , . . . , a 2 n −1) := (αa 0 , αa 1 , . . . , αa 2 n −1)<br />
(a 0 , a 1 , . . . , a 2 n −1) · (b 0 , b 1 , . . . , b 2 n −1) :=<br />
(a 0 , a 1 , . . . , a 2 n −1) ∧ (b 0 , b 1 , . . . , b 2 n −1) :=<br />
(a 0 , a 1 , . . . , a 2 n −1) • (b 0 , b 1 , . . . , b 2 n −1) :=<br />
2∑<br />
n −1<br />
i,j=0<br />
2∑<br />
n −1<br />
i,j=0<br />
2∑<br />
n −1<br />
i,j=0<br />
a i b j sgn(i, j)ˆσ(i and j)δ i and j<br />
i and j γ i xor j<br />
a i b j sgn(i, j)ˆσ(i and j)δ i and j<br />
0 γ i xor j<br />
a i b j sgn(i, j)ˆσ(i and j)δ i and j<br />
i γ i xor j<br />
Note that G n when considered with just vector addition and scalar multiplication is a vector space, while<br />
considered with vector addition and any of the products it is a nonabelian ring with nilpotent elements<br />
(for n ≥ 1) and isomorphic to R for n = 0.<br />
10
Definition: Canonical embedding<br />
The canonical embedding of R n into G n is defined as:<br />
Definition: Object representation<br />
ι K : R n → G n :<br />
n∑<br />
a i e i ↦→<br />
i=1<br />
Let A ⊆ R n , B ∈ G m and ι : R n → G m an embedding.<br />
n∑<br />
a i γ 2 i−1<br />
We say that B represents A if and only if x ∈ A ⇐⇒ ι(x) ∧ B = 0.<br />
We say that B dually represents A if and only if x ∈ A ⇐⇒ ι(x) • B = 0.<br />
Definition: Dual<br />
Let A ∈ G n , the dual of A is defined as A ∗ := A • γ 2 n −1 and γ 2 n −1 is called the pseudoscalar.<br />
Definition: Grade<br />
Let A = ∑ 2 n −1<br />
i=0<br />
a i γ i ∈ G n then we say that A has grade or dimension k ∈ N if and only if for all<br />
0 ≤ i < 2 n we have that a i ≠ 0 → there are precisely k bits set in the number i written in binary form.<br />
i=1<br />
1.3 Implementation<br />
1.3.1 Data types<br />
Now we will discuss implementing this model in some programming language. We will assume that two<br />
datatypes are available: integers and real numbers.<br />
Given are the dimension as some positive integer:<br />
integer n<br />
And the signature as an array (list) of n integers:<br />
integer sigma[n]<br />
Such that n = n and sigma[0] = σ(1), sigma[1] = σ(2), . . . , sigma[n-1] = σ(n). Multivectors are<br />
nothing more than elements of R 2n , so we characterize them as an array of 1
function sigmahat(integer i)<br />
//return value of our function<br />
integer returnval = 1<br />
integer j<br />
set j = 0 and do while j < n<br />
//check if lowest bit is set, if so multiply<br />
//with appropriate signature<br />
if (i and 1 = 1) then returnval = returnval * sigma[j]<br />
//advance to the next bit by shifting i to the right<br />
i = i >> 1<br />
advance j = j + 1<br />
return returnval<br />
1.3.3 Order sign<br />
For this function, we are given two numbers i, j ∈ N such that 0 ≤ i, j < 2 n . We now need to find out<br />
what the set bit positions of i and j are, add these to a list and find out how often we must exchange<br />
two adjacent, different elements of the list to sort it. Sorting lists can be done in a lot of ways, I chose<br />
to use the bubble sort algorithm because of its simplicity. Extracting the bit positions can be done with<br />
the same bit shift trick as we used before: we keep shifting a number to the right while incrementing<br />
the position and if the lowest bit is set, we add the current position to the list. Note that i and j are<br />
both at most n-bit numbers, so a list that is 2n elements long should be big enough to contain all bit<br />
positions. This leads to the following algorithm:<br />
function sgn(integer i, integer j)<br />
//return value<br />
integer returnval = 1<br />
//the actual bit positions of i and j<br />
integer bitpos[2 * n]<br />
//total number of bit positions in both i and j<br />
integer numbitpos = 0<br />
integer k<br />
integer l<br />
//extract bit positions from i<br />
set k = 0 and do while k < n<br />
if (i and 1 = 1) then<br />
bitpos[numbitpos] = k + 1<br />
numbitpos = numbitpos + 1<br />
end if<br />
i = i >> 1<br />
advance k = k + 1<br />
//extract bit positions from j<br />
set k = 0 and do while k < n<br />
if (j and 1 = 1) then<br />
bitpos[numbitpos] = k + 1<br />
numbitpos = numbitpos + 1<br />
end if<br />
j = j >> 1<br />
advance k = k + 1<br />
//sort bit position list (bubble sort)<br />
set k = 0 and do while k < (numbitpos - 1)<br />
12
set l = 0 and do while l < (numbitpos - 1 - k)<br />
//we need to swap two adjacent numbers to sort the list<br />
if (bitpos[l] > bitpos[l + 1]) then<br />
swap bitpos[l], bitpos[l + 1]<br />
//extra transposition, so sign flips<br />
returnval = -returnval<br />
end if<br />
advance l = l + 1<br />
advance k = k + 1<br />
return returnval<br />
1.3.4 Kronecker delta<br />
This is rather easy to implement:<br />
function delta(integer i, integer j)<br />
if (i = j) return 1<br />
return 0<br />
1.3.5 Multivector addition and scalar multiplication<br />
This is simply done componentwise: we loop through all the multivector’s components and apply the<br />
operation.<br />
function add(real a[1
two multivectors according to some given multiplication table C(i, j) of some product □:<br />
In code:<br />
( 2∑<br />
n −1<br />
i=0<br />
a i γ i<br />
)□<br />
( 2 n −1<br />
∑ )<br />
b j γ j =<br />
j=0<br />
2∑<br />
n −1<br />
i,j=0<br />
a i b j C(i, j)γ i xor j<br />
function mul(real a[1
can be done with Gauss reduction. ( ∑2<br />
First we must ( construct the matrix A however. From the formula<br />
we derived above: c = a□b =<br />
n −1 ∑2<br />
)<br />
i=0<br />
a i γ i<br />
)□<br />
n −1<br />
j=0 b jγ j = ∑ 2 n −1<br />
i,j=0 a ib j C(i, j)γ i xor j and the fact<br />
that for ordinary matrix multiplication c i = ∑ 2 n −1<br />
j=0 A ijb j we see that the matrix A must have elements<br />
A i xor j,j = a i C(i, j). Now we just have to solve the system Ab = (1, 0, 0, . . . , 0):<br />
function rightinverse(real a[1
extract multivector<br />
set i = 0 and do while i < (1
Chapter 2<br />
Extended <strong>Geometric</strong> <strong>Algebra</strong><br />
2.1 Homogeneous geometric algebra<br />
With ι K : R n → G n we have embedded R n in our extended space in which all k-dimensional linear<br />
subspaces through the origin are represented. It would be nice to find another embedding ι which<br />
enables us to embed R n in a slightly bigger space which contains k-dimensional linear subspaces at any<br />
point. Consider R 2 and the embedding ι H : R 2 → R 3 : a ↦→ a + e 3 .<br />
Now let a, b ∈ R 2 be two distinct, arbitrary points. The plane through the origin, ι H (a) and ι H (b) is<br />
represented in our extended space G 3 as l := ι H (a) ∧ ι H (b). It is easily seen that any x ∈ R 2 with<br />
ι H (x) ∧ l = 0 must lie in the preimage through ι H of the intersection of the plane l and the plane ι H (R 2 ).<br />
This is precisely the line through the points a and b, so in that sense l = ι H (a) ∧ ι H (b) represents (in R 2 )<br />
the line through a and b. Therefore this construction enables us to represent lines through any two points<br />
in the plane, which was not possible in G 2 (there all represented lines, 1-dimensional linear subspaces,<br />
passed through the origin).<br />
a<br />
c<br />
b<br />
i_H<br />
a<br />
c<br />
b<br />
l = a^b<br />
points identified<br />
with c<br />
Figure 2.1: 2-dimensional homogeneous geometric algebra<br />
But what do the points not lying in the plane ι H (R 2 ) represent? Consider the line in R 3 from the origin<br />
through some point ι H (c) for c ∈ R 2 . In figure 2.1 we see that if we were to identify all points on this<br />
line with c, it would be consistent with l representing the line in R 2 between a and b (with this point<br />
identification all points on the plane in R 3 represented by l would be identified with points on the line<br />
from a to b). Because of this we say that for a ∈ R 2 , a + αe 3 and 1 α a + e 3 for α ≠ 0 represent the same<br />
point 1 α a ∈ R2 .<br />
But what of points for which α = 0? Let us consider points a + ɛe 3 for 0 < ɛ ≪ 1 a very small number,<br />
if we let ɛ ↓ 0 we get the case that α = 0. a + ɛe 3 is identified with 1 ɛ a + e 3, so the point 1 ɛ a in R2 . If<br />
we now let ɛ ↓ 0 we see that the distance between the origin and 1 ɛ<br />
a becomes arbitrarily large for a ≠ 0.<br />
Therefore we view points (x, y, 0) (arbitrary points with α = 0) in R 3 as points at infinity, as they are<br />
identified with points at an infinite distance from the origin in R 2 .<br />
17
To generalize representing subspaces at arbitrary locations to higher dimensions, consider R n and ι H :<br />
R n → R n+1 : a ↦→ a + e n+1 . Let A = a 1 ∧ a 2 ∧ . . . ∧ a k be the representation in G n of some k-dimensional<br />
linear subspace through the origin in R n . We want to move A to some location b ∈ R n different from<br />
the origin. Consider A ′ := ι H (b) ∧ a 1 ∧ a 2 ∧ . . . ∧ a k ∈ G n+1 and let α 1 , . . . , α k ∈ R. Note that:<br />
ι H (b + α 1 a 1 + . . . + α k a k ) ∧ A ′ = ( b + e n+1 + α 1 a 1 + . . . + α k a k<br />
)<br />
∧<br />
(<br />
b + en+1 ) ∧ a 1 ∧ . . . ∧ a k<br />
= 0<br />
Since this holds for arbitrary α 1 , . . . , α k , the linear subspace spanned by a 1 , . . . , a k at location b in<br />
R n (call this A ′′ ) is a subset of the object represented by A ′ . Conversely, suppose that we have an<br />
x ∈ R n such that ι H (x) ∧ A ′ = 0, then x + e n+1 must be a linear combination of b + e n+1 , a 1 , . . . , a k :<br />
x + e n+1 = α ( )<br />
b + e n+1 + α1 a 1 + . . . + α k a k . Because b, a 1 , . . . , a k ∈ R n and the e 1 , e 2 , . . . , e n+1 are<br />
linearly independent we see that α = 1 and therefore x = b+α 1 a 1 +. . .+α k a k : x is an element of A ′′ . So<br />
the object represented by A ′ is a subset of A ′′ . Therefore we may conclude that the object represented<br />
by ι H (b) ∧ a 1 ∧ . . . ∧ a k is precisely A ′′ , the linear subspace spanned by a 1 , . . . , a k at location b. Because<br />
of this, the embedding ι H enables us to represent any linear subspace at any location in R n .<br />
These considerations motivate the following definition of the homogeneous geometric algebra:<br />
Definition: n-dimensional homogeneous geometric algebra<br />
Let n ∈ N and σ : {1, 2, . . . , n} → {−1, +1} be given. Extend σ to ˜σ : {1, 2, . . . , n, n + 1} → {−1, +1} :<br />
k ↦→ σ(k) if 1 ≤ k ≤ n and 1 otherwise. We define the n-dimensional homogeneous geometric algebra<br />
G n H := Gn+1 the geometric algebra with signature ˜σ and associated embedding ι H : R n → G n H :<br />
∑ n<br />
i=1 a ie i ↦→ γ 2 n + ∑ n<br />
i=1 a iγ 2 i−1.<br />
2.2 <strong>Conformal</strong> geometric algebra<br />
Now we would like to extend our space such that spheres are represented in the geometrical algebra.<br />
Spheres are defined as the collection of points for which the distance to a given point is equal to a given<br />
number (the radius of the sphere): S = {x ∈ R n |‖x − a‖ 2 = r 2 } is a sphere located at position a ∈ R n<br />
with radius r ∈ R. The abbreviation ‖a‖ 2 is defined as ‖a‖ 2 :=< a, a >= ∑ n<br />
i=1 σ(i)a2 i , the length of a<br />
squared.<br />
A sphere around the origin is nothing but the level set of the map a ↦→ ‖a‖ 2 . This can also be seen as<br />
the projection onto R n of the intersection of the plane with normal e n+1 at a distance r from the origin<br />
with the image of the map a ↦→ a + ‖a‖ 2 e n+1 .<br />
Planes can be represented by multivectors in geometric algebra, so embedding our space R n into R n+1<br />
using a ↦→ a + ‖a‖ 2 e n+1 could be a good start. The only problem is that in ordinary geometric algebra<br />
only linear subspaces through the origin are represented, to be able to have linear subspaces at arbitrary<br />
locations we must extend our extended space to the homogeneous geometric algebra. Therefore we<br />
introduce another independent base vector e n+2 as our homogeneous origin (the same procedure as<br />
when we created the homogeneous extension of R 2 where we added e 3 , see the previous section). This<br />
gives us the embedding a ↦→ e n+2 + a + ‖a‖ 2 e n+1 which we will call ι C .<br />
Now we consider R 2 embedded in R 4 using ι C . Let a, b, c ∈ R 2 and define A = ι C (a) ∧ ι C (b) ∧ ι C (d)<br />
this is the plane through the points ι C (a), ι C (b) and ι C (c) on the parabola. We see that A intersects the<br />
parabola in an ellipsoid and that d ∈ R 2 satisfies ι C (d)∧A = 0 if and only if ι C (d) lies on the ellipsoid. So<br />
A represents this ellipsoid, but we wanted to represent spheres (or circles in this case). This means that<br />
we have to ‘unwarp’ our ellipsoid to a circle by choosing a special signature for our extended space. It<br />
turns out that for sensible results, this signature must be chosen such that e n+1 •e n+1 = e n+2 •e n+2 = 0,<br />
but this is not allowed (this would imply that the signature of our extended space assumes the value 0,<br />
but signatures may only assume the values −1 and +1) . Therefore we choose new extension vectors to<br />
be o 0 and o ∞ (the names of which will become clear later on) which are linear combinations of e n+1 and<br />
e n+2 and of which o 0 plays the role of the homogeneous origin.<br />
18
0<br />
1<br />
2<br />
-1<br />
-2<br />
4<br />
3<br />
2<br />
1<br />
0<br />
-2<br />
-1<br />
0<br />
1<br />
2<br />
Figure 2.2: Level surface of a ↦→ ‖a‖ 2<br />
So we extend our space with two vectors o 0 and o ∞ not part of our original space R n . We take the<br />
embedding to be ι C (a) = o 0 + a + 1 2 ‖a‖2 o ∞ for vectors a ∈ R n into R n+2 with signature ˜σ (currently<br />
unspecified) and generate the associated geometric algebra G n+2 . Time to get to work:<br />
ι C (a) • ι C (b) =<br />
(o 0 + a + 1 )<br />
2 ‖a‖2 o ∞ •<br />
(o 0 + b + 1 )<br />
2 ‖b‖2 o ∞<br />
= o 0 • o 0 + 1 4 ‖a‖2 ‖b‖ 2 o ∞ • o ∞ + a • b +<br />
o 0 • b + a • o 0 + 1 2 ‖b‖2 o 0 • o ∞ + 1 2 ‖a‖2 o ∞ • o 0<br />
Suppose we can choose the signature ˜σ for the space R n+2 such that o 0 • o 0 = o ∞ • o ∞ = 0, o 0 • o ∞ = 1<br />
and o 0 • e i = o ∞ • e i = 0 for 1 ≤ i ≤ n. Then the above simplifies to:<br />
ι C (a) • ι C (b) = 1 2 ‖a‖2 · 1 + a • b + 1 2 ‖b‖2 · 1<br />
Furthermore, we choose ˜σ negative, such that a • b = − < a, b > (here < ., . > is the inner product on<br />
our original space R n ). This leads to:<br />
ι C (a) • ι C (b) = 1 2 < a, a > − < a, b > +1 2 < b, b ><br />
= 1 2 < b − a, b − a >= 1 ‖b − a‖2<br />
2<br />
So the inner product now reflects the metric of our original space. But this was all under the assumption<br />
we could find a signature such that the simplification above holds. For this we pick ˜σ(1) = 1, ˜σ(n + 2) =<br />
−1 and o 0 := 1 √<br />
2<br />
(<br />
e1 + e n+2<br />
)<br />
, o∞ := 1 √<br />
2<br />
(<br />
e1 + e n+2<br />
)<br />
. Then certainly o0 • o 0 = o ∞ • o ∞ = 0 and<br />
o 0 • o ∞ = 1. Furthermore, to ensure that a • b = − < a, b > we choose ˜σ(k) = −σ(k − 1) for<br />
2 ≤ k ≤ n + 1. This defines the entire signature for our extended space in which we embed R n as<br />
∑ n<br />
i=1 a ie i ↦→ o 0 + ∑ n<br />
i=1 a ie i+1 + 1 2 ‖a‖2 o ∞ .<br />
Note that ι(a) • o ∞ = o 0 • o ∞ + a • o ∞ + 1 2 ‖a‖2 o ∞ • o ∞ = 1 + 0 + 0 = 1. With this, for some r ∈ R:<br />
ι C (a) •<br />
(ι C (b) − 1 )<br />
2 r2 o ∞ = 1 (‖b − a‖ 2 − r 2)<br />
2<br />
Now define A = ι C (b) − 1 2 r2 o ∞ , then clearly ι C (a) • A = 0 ⇐⇒ ‖b − a‖ 2 = r 2 , so A dually represents<br />
an n-dimensional sphere at location b with radius r in R n . If we take the dual of A, A ∗ then this is a<br />
19
multivector of grade n + 1 (we take the dual in n + 2-dimensional space of a 1 dimensional multivector<br />
A). Furthermore, the object represented by A ∗ is an n-dimensional sphere (as A dually represents an<br />
n-dimensional sphere). Observe that (dualisation is linear because the inner product is linear in its first<br />
argument):<br />
A ∗ =<br />
(ι C (b) − 1 2 r2 o ∞<br />
) ∗<br />
= o ∗ 0 + b ∗ + 1 2(<br />
‖b‖ 2 − r 2) o ∗ ∞<br />
It is not hard to see that we can find vectors a 1 , . . . , a n+1 ∈ R n (this is a grade n + 1 multivector) such<br />
that A ∗ = αι C (a 1 ) ∧ . . . ∧ ι C (a n+1 ) for some constant α. Just as with the homogeneous extension, we<br />
identify multivectors that are scalar multiples of each other, so we may suppose that α = 1. For these<br />
vectors a i , we have that ι C (a i ) ∧ A ∗ = 0, so a i is for 1 ≤ i ≤ k an element of the object represented<br />
by A ∗ : the sphere. Therefore the direct representation of the n-dimensional sphere is a wedge of n + 1<br />
vectors on the sphere and we have achieved our goal.<br />
Now we formalize this with the following definition:<br />
Definition: n-dimensional conformal geometric algebra<br />
Let n ∈ N and σ : {1, 2, . . . , n} → {−1, +1} be given. Extend σ to ˜σ : {1, 2, . . . , n, n+1, n+2} → {−1, +1}<br />
by letting ˜σ(1) = 1, ˜σ(k) = −σ(k − 1) for 2 ≤ k ≤ n + 1 and ˜σ(n + 2) = −1. We define the<br />
n-dimensional conformal geometric algebra G n C := Gn+2 the geometric algebra with signature ˜σ and<br />
associated embedding:<br />
ι C : R n → G n C :<br />
n∑<br />
a i e i ↦→ o 0 +<br />
i=1<br />
n∑<br />
a i γ 2 i + 1 ( ∑<br />
n )<br />
σ(i)a 2 i o ∞<br />
2<br />
i=1<br />
Where o 0 := 1 √<br />
2<br />
(γ 1 + γ 2 n+1) and o ∞ := 1 √<br />
2<br />
(γ 1 − γ 2 n+1).<br />
i=1<br />
2.3 Object classification<br />
Within the conformal geometric algebra, it turns out (see [1]) that there are simple (independent of<br />
dimension and represented object to which they are applied) expressions for reflections and intersections<br />
of multivectors.<br />
Reflection<br />
Let us suppose that A ∈ G n C represents some object (say a plane or a sphere), then we can reflect any<br />
multivector x ∈ G n C in this object A to x′ using x ′ = A · x · A −1 .<br />
Intersection<br />
The intersection C of the representations of two objects A, B ∈ G n C is given by the largest common<br />
subspace of both A and B, through the formula C = A ∗ • B (this formula was also mentioned in the<br />
rationale, for planes it is rather obvious, but in CGA it also holds for representations of more complicated<br />
objects).<br />
Classification of represented objects<br />
Just as with the homogeneous geometric algebra we choose to identify elements x of the form x =<br />
αo 0 + ∑ n<br />
i=1 a ∑n<br />
)<br />
iγ 2 i + 2( 1 i=1 σ(i)a2 i o ∞ with points 1 α x ( 1 α x equals ι C(p) for some p ∈ R n ) for α ≠ 0 and<br />
say that x is at infinity if α = 0. We call (for α ≠ 0) replacing x with the point 1 αx the normalization<br />
of x. Because o ∞ • ( αo 1 + ∑ n<br />
i=1 a iγ 2 i + 1 2 (∑ n<br />
i=1 σ(i)a2 i )o (<br />
∞)<br />
= α we can use the formula x/ o∞ • x ) to<br />
normalize x.<br />
Note that according to these definitions o ∞ in particular is a point at infinity. We can really interpret<br />
this point as being the infinity, after all it is the limit of 1 α o 0 + 0 + o ∞ for α ↑ ∞. This point is for<br />
20
all α > 0 identified with o 0 + 0 + αo ∞ : a point at an ever increasing distance from the origin with no<br />
preferred direction. Similarly, o 0 can be interpreted as the origin, for it equals ι C (0).<br />
Having incorporated infinity as an element of our algebra, we can also represent linear subspaces at any<br />
location (just as with the homogeneous extension of our space). Consider G 3 C where we represent a<br />
sphere with A = ι C (a) ∧ ι C (b) ∧ ι C (c) ∧ ι C (d). If we now let the point d move farther and farther away<br />
from the origin, we see that the sphere represented by A becomes larger and larger and appears more<br />
and more like a plane through a, b and c. For large distances it also does not matter in which direction<br />
we let d move to infinity, since the plane is determined only by a, b and c. Therefore, if we take the<br />
limit of ‖d‖ 2 ↑ ∞ we may just as well take d → o ∞ . In this limit , the sphere represented by A will turn<br />
into a plane through a, b and c, while A → ι C (a) ∧ ι C (b) ∧ ι C (c) ∧ o ∞ . So ι C (a) ∧ ι C (b) ∧ ι C (c) ∧ o ∞<br />
represents of a plane through a, b and c. Similarly a line can be seen as a circle through infinity in G 2 C :<br />
ι C (a) ∧ ι C (b) ∧ o ∞ . In general this enables us represent any k-dimensional linear subspace of R n in G n C<br />
by ι C (a 1 ) ∧ ι C (a 2 ) ∧ . . . ∧ ι C (a k ) ∧ o ∞ for vectors a 1 , . . . , a k inside the subspace. So our new model<br />
represents linear subspaces as well as spheres.<br />
Now we will start making a rough classification of objects represented by multivectors in G n C . Let A ∈ Gn<br />
be a multivector with a well-defined grade k.<br />
There are two possibilities, either o ∞ • A = 0 or o ∞ • A ≠ 0. For our reasoning to be compatible with<br />
what we decided for points, we say that A is located at infinity if o ∞ • A = 0. In this case A cannot<br />
have a well-defined position, only some orientation (remember that points at infinity can have a certain<br />
direction: 0 · o 0 + 4 · e 2 + o ∞ for example). Therefore we call objects without a well-defined position<br />
orientations. Otherwise (if o ∞ • A ≠ 0) we say that A has a well-defined position, we only need to find<br />
it.<br />
If A has a well-defined position, there are again two possibilities: o ∞ ∧ A = 0 or o ∞ ∧ A ≠ 0 (infinity is<br />
either part of our represented object, or it isn’t). In the first case we say the object is flat, as it extends<br />
to infinity. These are the lines, planes, etc.: k-dimensional linear subspaces of our n-dimensional space<br />
with 0 ≤ k ≤ n at a certain position. In the second case, we call A round: it somehow bends such that<br />
it does not extend to infinity. These rounds must be k-dimensional spheres for 0 ≤ k ≤ n with respect<br />
to the metric induced by the signature of our space.<br />
For rounds it is easy to find their position: simply reflect infinity in the given object: A · o ∞ · A −1<br />
(consider a sphere, spherically inverting the sphere’s position gives you infinity and vice versa).<br />
For flats it is slightly more difficult. Consider the homogeneous case in two dimensions G 2 H . A line<br />
through two points certainly classifies as a flat object. For the position of the line, any point on the line<br />
will do (together with the direction, we can reconstruct the line uniquely). In homogeneous space, the<br />
line is represented by the plane l through the origin and two points on the line. To recover a point on<br />
the line, we simply take the orthogonal projection of e 3 on this plane: (e 3 • l) · l −1 . When we extended<br />
e3<br />
e3 parallel<br />
plane representing line<br />
Figure 2.3: Homogeneous position of a flat<br />
our space to conformal geometric algebra, we introduced o 0 as our homogeneous origin (just like e 3 in<br />
the homogeneous extension of R 2 ) to be able to be able to represent linear subspaces at any position,<br />
therefore the position of a flat A in conformal geometric algebra is given by (o 0 • A) · A −1 .<br />
21
Now we only need to determine the orientations of the objects, but what do we actually mean by this?<br />
Consider a flat A located containing the points a 1 , a 2 , . . . , a k , this is A = ι C (a 1 )∧ι C (a 2 )∧. . .∧ι C (a k )∧o ∞ .<br />
Because we have that a ∧ a = 0 for all multivectors a, note that:<br />
A = ι C (a 1 ) ∧ ι C (a 2 ) ∧ . . . ∧ ι C (a k ) ∧ o ∞<br />
(<br />
= o 0 + ∑ a 1,i γ 2 i + 1 )<br />
2 ‖a 1‖ 2 o ∞ ∧<br />
i<br />
(<br />
o 0 + ∑ a 2,i γ 2 i + 1 )<br />
2 ‖a 2‖ 2 o ∞ ∧<br />
i<br />
. . .<br />
(<br />
o 0 + ∑ a k,i γ 2 i + 1 )<br />
2 ‖a k‖ 2 o ∞ ∧ o ∞<br />
i<br />
( ∑<br />
) ( ∑<br />
)<br />
= ι C (a 1 ) ∧ (a 2,i − a 1,i )γ 2 i ∧ . . . ∧ (a k,i − a 1,i )γ 2 i ∧ o ∞<br />
= ι C (a 1 ) ∧ b 2 ∧ . . . ∧ b k ∧ o ∞<br />
i<br />
Where the b j are defined as b j = ∑ i (a j,i −a 1,i )γ 2 i. Clearly the b j can be viewed as the spanning vectors<br />
i<br />
A<br />
a2<br />
b2<br />
a3<br />
b3<br />
a1<br />
Figure 2.4: Orientation of a flat<br />
of the linear space A at position a 1 and therefore it would be sensible to define the orientation of this<br />
object to be b 2 ∧ . . . ∧ b k ∧ o ∞ (we include o ∞ because our usual conception of an orientation is a flat).<br />
But how to extract these vectors b j ? For this we consider a more simple case: A = ι C (a) ∧ b ∧ o ∞ where<br />
b = ∑ i b iγ 2 i. Note that:<br />
( ∑ )<br />
A = ι C (a) ∧ b i γ 2 i ∧ o ∞<br />
=<br />
= ∑ i<br />
(<br />
o 0 + ∑ j<br />
i<br />
) ( ∑ )<br />
a i γ 2 j + ‖a‖ 2 o ∞ ∧ b i γ 2 i ∧ o ∞<br />
b i<br />
(<br />
o 0 ∧ γ 2 i ∧ o ∞ + ∑ j<br />
i<br />
a i γ 2 j ∧ γ 2 i ∧ o ∞<br />
)<br />
If we were to take the inner product with o ∞ (remember that o ∞ • o ∞ = 0 and o ∞ • γ i = 0 for all<br />
2 ≤ i ≤ 2 n ):<br />
o ∞ • A = ∑ (<br />
b i o ∞ • o 0 ∧ γ 2 i ∧ o ∞ + ∑ )<br />
a i γ 2 j ∧ γ 2 i ∧ o ∞<br />
i<br />
j<br />
= (o ∞ • o 0 ) ∑ i<br />
b i γ 2 i ∧ o ∞ + 0<br />
= b ∧ o ∞<br />
22
This is exactly the orientation of A. From this it is easy to see that o ∞ • ( ι C (a) ∧ b 2 ∧ . . . ∧ b k ∧ o ∞<br />
)<br />
=<br />
b 2 ∧ . . . ∧ b k ∧ o ∞ (just add the other b j to the expression above). Therefore the orientation of a flat A<br />
is given by o ∞ • A.<br />
The orientation of an orientation A is much simpler: if A does not yet contain infinity (this is the case<br />
if o 0 • A = 0) the orientation equals A ∧ o ∞ and otherwise (if o 0 • A ≠ 0) the orientation is just A.<br />
For rounds we use the expression for the orientation of a flat. First we convert the given round A to the<br />
flat A ∧ o ∞ (i.e. from a circle through a, b, c we would obtain the plane through a, b, c in which the circle<br />
lies) and calculate the orientation of this flat using the expression we derived above: o ∞ • (A ∧ o ∞ ).<br />
There is one final remark to be made about rounds: they represent objects of a certain finite size (they<br />
do not extend to infinity). Just as with vectors, we see that if we square the dual representation of a<br />
sphere at position a ∈ R n with radius r: A = ι C (a) − 1 2 r2 o ∞ that A · A = r 2 , we retrieve the size of the<br />
sphere squared. This also works for the direct representation (see [4]) if we normalize A before doing so.<br />
So in a nutshell, for a multivector A:<br />
o ∞ • A<br />
<br />
=0 <br />
<br />
Orientation<br />
(2.1)<br />
≠0<br />
o ∞ ∧ A =0 <br />
Flat<br />
<br />
≠0<br />
Round<br />
Type Position Orientation Size<br />
Orientation - A or A ∧ o ∞ -<br />
Flat (o 0 • A) · A −1 o ∞ • A -<br />
Round A · o ∞ · A −1 o ∞ • (A ∧ o ∞ ) A · A<br />
Remember that the results should be normalized afterwards. These expressions allow us to classify all<br />
multivectors in G n C with a certain grade k.<br />
2.4 <strong>Visualizing</strong> Euclidian 3-space<br />
We will now use the expressions from the previous paragraph to visualize a given multivector A of grade<br />
k in G 3 C with signature σ(1) = σ(2) = σ(3) = 1 (Euclidian, + + +).<br />
We will assume that we are able to display parameterized objects with our program (i.e. perhaps through<br />
polygonal approximations as with CGAview) and have use of a transformation stack S on which we can<br />
push transformations of the space of the displayed objects. S is also assumed to be resolved last in first<br />
out (i.e. if S = (T 1 , T 2 ) we first apply T 2 and then T 1 ).<br />
Let A ∈ G 3 C be given. If A does not have a certain grade we reject A and do not draw anything, as<br />
it is a linear combination of represented objects and we cannot draw (for example) the sum of a line<br />
and a sphere. If A does have a certain grade k we classify A using scheme 2.1 to determine its type:<br />
orientation, flat or round. Depending on this type we can use table 2.1 to retrieve the properties of A.<br />
If left unspecified, we will assume the position to be (0, 0, 0), the origin, and the size equal to 1. So now<br />
we know the type of object type(A), its grade k, orientation ori(A), position pos(A) and size size(A).<br />
We can assume that the object is positioned at the origin if we push a transformation ‘Translate(0 →<br />
pos(A))’ on the stack S. Now that the object is located at the origin we can assume it has size with<br />
absolute value 1 by pushing ‘Scale( √ |size(A)|)’ onto S if size(A) ≠ 0. This operation scales the entire<br />
space uniformly with √ |size(A)| (note that the size in table 2.1 is given squared, just as with vectors<br />
a · a = ‖a‖ 2 so we have to take the square root). If the size of A equals 0, we do not push the scale<br />
operation (then nothing would remain). What we would like to do now is add a rotation to S such that<br />
23
we can assume A to be oriented along the e 1 axis in R 3 . For this we first have to convert the multivector<br />
ori(A) into a ‘normal’ vector n(A) ∈ R 3 (for a line this is the direction of the line, for a plane this is the<br />
plane normal). It turns out that we can extract this vector directly from the components of ori(A).<br />
Note that if the orientation of A has grade 0 or 1 that it must be of the form (we extended orientations<br />
to infinity in 2.1) α1 or αo ∞ . So for these grades, A does not really have a certain orientation. Therefore<br />
we simply assume it to be n(A) = e 1 . It becomes more interesting if ori(A) has grade 2. Then it is of<br />
the form ( ∑ 3<br />
i=1 a iγ 2 i)<br />
∧ o∞ . Clearly (see the previous paragraph about the spanning vectors b j ) a is<br />
the normal vector we seek. Since<br />
( 3∑ )<br />
a i γ 2 i ∧ o ∞ = √ −1<br />
2<br />
i=1<br />
3∑<br />
a i γ 1 ∧ γ 2 i + a i γ 2 i ∧ γ 2 3+1<br />
i=1<br />
= −1 √<br />
2<br />
3∑<br />
a i γ 1+2 i + a i γ 2 i +16<br />
we see that the third (3 = 1 + 2 1 ) component of ori(A) is equal to −1 √<br />
2<br />
a 1 , the fifth (5 = 1 + 2 2 ) equal<br />
to −1 √<br />
2<br />
a 2<br />
and the ninth (9 = 1 + 2 3 ) equal to −1 √<br />
2<br />
a 3 . So the normal vector simply equals n(A) =<br />
− √ 2(ori(A) 3 , ori(A) 5 , ori(A) 9 ).<br />
Now suppose that ori(A) has grade 3, then it is of the form ( ∑ 3<br />
i=1 a iγ 2 i)<br />
∧<br />
( ∑ 3<br />
j=1 b jγ 2 j<br />
)<br />
∧ o∞ . We can<br />
save ourselves a lot of trouble by noting that n(A) and ori(A) are linear operations and considering three<br />
simple cases. Suppose a = (1, 0, 0) and b = (0, 1, 0), then ori(A) is the orientation of the e 1 -e 2 plane<br />
which has normal (0, 0, 1), on the other hand<br />
ori(A) = γ 2 1 ∧ γ 2 2 ∧ o ∞ = √ 1<br />
)<br />
(γ 1+2<br />
2 1 +2 2 + γ 2 1 +2 2 +16 = √ 1 ( )<br />
γ 7 + γ 22<br />
2<br />
i=1<br />
Similarly a = (1, 0, 0), b = (0, 0, 1), n(A) = (0, −1, 0) yields ori(A) = 1 √<br />
2<br />
(<br />
γ11 + γ 26<br />
)<br />
and a = (0, 1, 0),<br />
b = (0, 0, 1), n(A) = (1, 0, 0) yields ori(A) = 1 √<br />
2<br />
(<br />
γ13 + γ 28<br />
)<br />
. Now use linearity of n(A) (note that<br />
we can swap a and b at the cost of a minus sign, so through taking linear combinations of the cases<br />
we have considered we can really create all possible orientations ori(A) of grade 3) to conclude that<br />
n(A) = √ 2(ori(A) 13 , −ori(A) 11 , ori(A) 7 ).<br />
If ori(A) has grade 4, then A must be of grade 5. Since we are working in a five (3 + 2) dimensional<br />
geometric algebra A has to be a multiple of just γ 31 (the pseudoscalar). Therefore (just as with ordinary<br />
scalars) we say for grade 4 orientations that n(A) = (1, 0, 0). It is impossible that ori(A) has grade 5<br />
(for this would imply that A has grade 6 which is impossible in 5-dimensional geometric algebra) so in<br />
this case we also assign n(A) = (1, 0, 0). Let us summarize this result:<br />
Grade Form Normal vector<br />
0, 1 - (1, 0, 0)<br />
2 a ∧ o ∞ − √ 2(ori(A) 3 , ori(A) 5 , ori(A) 9 )<br />
3 a ∧ b ∧ o ∞<br />
√<br />
2(ori(A)13 , −ori(A) 11 , ori(A) 7 )<br />
4, 5 - (1, 0, 0)<br />
Now that we have this normal vector, we push ‘Rotate((1, 0, 0) → n(A))’ onto S and may assume that<br />
the orientation of A is along the e 1 axis.<br />
So if our transformation stack looks like (do not include the Scale operation if size(A) = 0):<br />
S = (Translate(0 → pos(A)), Scale( √ |size(A)|), Rotate((1, 0, 0) → n(A)))<br />
and we may assume A to be positioned at the origin, have size −1, 0 or +1 and be oriented along e 1 .<br />
The fact that we are now able to make these assumptions will greatly simplify the parameterizations of<br />
the represented objects.<br />
Suppose A has grade k = 4 and is a round, then A is the wedge of 4 = 3+1 vectors (so A = a∧b∧c∧d of<br />
vectors a, b, c, d through ι C ) and must therefore represent a sphere. There are three possibilities, either<br />
size(A) = 0, in which case A represents the set {x ∈ R 3 |‖x‖ 2 = 0} (remember that we can assume A to be<br />
positioned in the origin, have default orientation, etc.), which is just the point (0, 0, 0). If size(A) = −1<br />
24
then the represented object is empty, since ‖x‖ 2 = x 2 1 + x 2 2 + x 2 3 ≥ 0 for all x ∈ R 3 because of our<br />
signature. If size(A) = 1 then the represented object is the unit sphere at the origin: x 2 1 + x 2 2 + x 2 3 = 1.<br />
This object can be parameterized by (use cos(α) 2 + sin(α) 2 = 1 for all α ∈ R):<br />
for 0 ≤ α < π and 0 ≤ β < 2π.<br />
x 1 = cos(α) cos(β), x 2 = cos(α) sin(β), x 3 = sin(α)<br />
Suppose A has grade k = 4 and is a flat, then A = a ∧ b ∧ c ∧ o ∞ which represents the plane through<br />
vectors a, b and c (A can be seen as a sphere a ∧ b ∧ c ∧ d of which ‖d‖ 2 ↑ ∞). We may assume this plane<br />
to be positioned in the origin and have normal vector e 1 , so it is parameterized by:<br />
for −∞ < α, β < ∞.<br />
x 1 = 0, x 2 = α, x 3 = β<br />
Suppose A has grade k = 3 and is a round. Then A = a ∧ b ∧ c for vectors a, b, c. Because of this A lies<br />
within (in terms of linear subspaces represented by wedge expressions in ‘ordinary’ geometric algebra,<br />
there a∧b∧c represents a linear subspace of the subspace represented by a∧b∧c∧d) the plane a∧b∧c∧o ∞<br />
through a, b and c. A also lies within the sphere represented by a ∧ b ∧ c ∧ d for some vector d. So A<br />
should lie within the intersection. The intersection of a plane with a sphere is a circle (for radius > 0),<br />
therefore it is not unreasonable to assume that A represents a circle through a, b and c. If size(A) = 0<br />
then A represents a circle with radius 0, which is just the point (0, 0, 0). If size(A) = −1 then (circles<br />
with negative radii do not exist) A represents the empty set. If size(A) = 1 then A represents a circle<br />
with radius 1. We can assume the orientation of A to be along e 1 , so the circle should lie within a plane<br />
with normal e 1 . It is furthermore located at the origin and has radius 1, so we can parameterize it using:<br />
for 0 ≤ α < 2π.<br />
x 1 = 0, x 2 = cos(α), x 3 = sin(α)<br />
Suppose A has grade k = 3 and is a flat, then A = a ∧ b ∧ o ∞ . This can (just as the grade 4 flat) be seen<br />
as a circle a ∧ b ∧ c of which ‖c‖ 2 ↑ ∞. In the limiting procedure the circle becomes larger and larger<br />
until it represents a line through a and b. This line is positioned at the origin and oriented along e 1 .<br />
Therefore we can parameterize it with:<br />
for −∞ < α < ∞.<br />
x 1 = α, x 2 = 0, x 3 = 0<br />
Suppose A has grade k = 2 and is a round, then A = a ∧ b. This lies within the circle a ∧ b ∧ c for<br />
some vector c and the line a ∧ b ∧ o ∞ . If size(A) = 0 then A represents just (0, 0, 0) (circle consists of<br />
just one point). If size(A) = −1 then A represents the empty set (circle is empty for negative radii). If<br />
size(A) = 1 then A represents a pair of points at the origin, oriented along e 1 : (−1, 0, 0) and (1, 0, 0).<br />
Suppose A has grade k = 2 and is a flat, then A = a ∧ o ∞ . Again this is the limit of a ∧ b for ‖b‖ 2 ↑ ∞,<br />
so it is a pair of points of which one point of the pair is moved to infinity. Therefore A represents just<br />
the point a which is ‘connected’ (as with the point pair) to infinity. We call this a flat point. Since we<br />
may assume A to be positioned at the origin, this is just (0, 0, 0).<br />
Suppose A has grade k = 1 and is a round, then A = a, just a single point (0, 0, 0) (note: just a point a<br />
dually represents a sphere at position a with radius 0, so points really are round objects, just very small<br />
ones).<br />
Suppose A has grade k = 1 and is a flat, then A = o ∞ , this is the point at infinity which does not<br />
represent any subset of R 3 since all elements of R 3 have a finite distance from the origin. Similarly<br />
rounds of grade 0 represent scalars, but these are not subsets of R 3 either and therefore will not be<br />
parameterized.<br />
Note that grade 0 objects (scalars) are always rounds and grade 5 objects are always flats (since they<br />
always include o ∞ ).<br />
We will now summarize these results, for rounds (with size(A) > 0, otherwise it is either the empty set<br />
for size(A) < 0 or just (0, 0, 0) for size(A) = 0):<br />
25
Grade Form Description Parameterization Parameters<br />
0 α scalar - -<br />
1 a point (0, 0, 0) -<br />
2 a ∧ b point pair (±1, 0, 0) -<br />
3 a ∧ b ∧ c circle (0, cos(α), sin(α)) 0 ≤ α < 2π<br />
4 a ∧ b ∧ c ∧ d sphere (cos(α) cos(β), cos(α) sin(β), sin(α)) 0 ≤ α < π, 0 ≤ β < 2π<br />
And flats:<br />
Grade Form Description Parameterization Parameters<br />
1 o ∞ infinity - -<br />
2 a ∧ o ∞ flat point (0, 0, 0) -<br />
3 a ∧ b ∧ o ∞ line (α, 0, 0) −∞ < α < +∞<br />
4 a ∧ b ∧ c ∧ o ∞ plane (0, α, β) −∞ < α, β < +∞<br />
5 a ∧ b ∧ c ∧ d ∧ o ∞ pseudoscalar - -<br />
With transformation stack S:<br />
S = (Translate(0 → pos(A)), Scale( √ |size(A)|), Rotate((1, 0, 0) → n(A)))<br />
Orientations are positioned at infinity and can therefore not truly represent subspaces of R 3 . However,<br />
it is not unreasonable to visualize them as flats (given our definition of orientations in the previous<br />
paragraph) located at the origin using the table for flats above.<br />
There is one more thing I would like to add about Euclidian 3-space. It turns out that (see [4]) rotations<br />
and translations can be done using conjugation with multivectors of the form V = l 1 /l 2 which are called<br />
versors. Here l 1 = ι C (a 1 ) ∧ ι C (a 2 ) ∧ o ∞ and l 2 = ι C (b 1 ) ∧ ι C (b 2 ) ∧ o ∞ represent lines through the<br />
points a1, a2 and b1, b2 in R 3 . Any object in R 3 represented by some multivector x ∈ G 3 C can now be<br />
rotated/translated to x ′ ∈ G 3 C by using x′ = V · x · V −1 . x ′ is equal to x rotated over twice the angle<br />
between the lines l 1 and l 2 and translated over twice the shortest distance between l 1 and l 2 .<br />
This simple expression is yet another example of how the geometrical foundations of our algebra permit<br />
us to do a complex operation (rotation/translation) through the simple use of an object V which has a<br />
clear geometrical interpretation (the ratio of two lines ‘representing’ the rotation/translation).<br />
2.5 <strong>Visualizing</strong> Hyperbolic 3-space<br />
Things become more challenging if we consider G 3 C with signature: σ(1) = 1, σ(2) = σ(3) = −1 (Hyperbolic,<br />
+ - -). Luckily we have already done a lot of the work necessary to visualize multivectors in the<br />
previous paragraph.<br />
Let A ∈ G 3 C be given and have grade k. Using the same procedure as before, we can determine the type<br />
of A, as well as position, size, orientation and associated normal vector n(A). With the transformation<br />
stack S we can assume that A is positioned at the origin, oriented along e 1 and has size −1, 0 or +1.<br />
Flats can be treated in the exact same way as with the Euclidian signature (identical parameterizations<br />
as the signature does not influence the shape of flats), so for these simply use table for flats from the<br />
previous paragraph. Rounds however change quite a bit with this new signature.<br />
Suppose A is a round and has grade k = 4, so A = a ∧ b ∧ c ∧ d for vectors a,b,c and d. Then we have<br />
three possibilities.<br />
If size(A) = 0, A represents all x ∈ R 3 for which ‖x‖ 2 = x 2 1 − x 2 2 − x 2 3 = 0. Contrary to the Euclidian<br />
case, this is not just (0, 0, 0), but the cone parameterized by:<br />
for −∞ < α < ∞ and 0 ≤ β < 2π.<br />
x 1 = α, x 2 = α cos(β), x 3 = α sin(β)<br />
26
If size(A) = 1, we have x 2 1 − x 2 2 − x 2 3 = 1. This is a hyperboloid which can be parameterized with (use<br />
cosh(α) 2 − sinh(α) 2 = 1 for all α ∈ R):<br />
for 0 ≤ α < ∞ and 0 ≤ β < 2π.<br />
x 1 = ± cosh(α), x 2 = sinh(α) cos(β), x 3 = sinh(α) sin(β)<br />
If size(A) = −1, we have x 2 1 − x 2 2 − x 2 3 = −1, this can be parameterized using:<br />
for −∞ < α < ∞ and 0 ≤ β < 2π.<br />
x 1 = sinh(α), x 2 = cosh(α) cos(β), x 3 = cosh(α) sin(β)<br />
When compared to the Euclidian grade 4 rounds (which were either nothing, a point or a sphere) these<br />
are more complex, but still easy to parameterize. This becomes more challenging if we consider grade 3<br />
Hyperbolic rounds.<br />
Suppose A has grade k = 3, so A = a ∧ b ∧ c. Just as with the Euclidian case we know that A must be<br />
the intersection of a grade 4 round a ∧ b ∧ c ∧ d for some vector d and a plane a ∧ b ∧ c ∧ o ∞ through the<br />
origin. This gives us different possibilities for the represented objects depending on size(A). We may<br />
assume (using the transformation stack S) that A is positioned in the origin, has size −1, 0 or +1 and<br />
normal vector n(A) along e 1 .<br />
Unfortunately, the shape of the intersection depends heavily on the normal vector n(A). With S we can<br />
only assume that A lies within the plane with normal vector e 1 , but not that the intersection of the plane<br />
containing A and the hyperboloid a ∧ b ∧ c ∧ d is, say, an ellipse or a hyperbole. To figure out the shape<br />
of the intersection we rotate our normal vector n(A) around e 1 such that it lies within the e 1 -e 2 plane.<br />
This can freely be done because all grade 4 rounds are invariant under rotations around e 1 . So we add<br />
‘Rotate((x, y, 0) → n(A))’ to our stack S where x = n(A) 1 and y = √ n(A) 2 2 + n(A)2 3 , chosen such that<br />
(x, y, 0) equals n(A) rotated into the e 1 -e 2 plane. Because we added this rotation to S we may assume<br />
that n(A) lies within the e 1 -e 2 plane when determining the shape of the intersection. We also normalize<br />
x and y such that x 2 + y 2 = 1 as only the direction of n(A) matters, not its length.<br />
Figure 2.5: Grade 3 hyperbolic round with size 0<br />
The simplest case is size(A) = 0, here A is the intersection of a plane and a cone (grade 4 round with<br />
size(A) = 0), which for |x| ≤ |y| (see figure 2.7) consists of two lines parameterized by:<br />
x 1 = 0, x 2 = α, x 3 = ±α<br />
for −∞ < α < ∞. For |x| > |y| the intersection is just the point (0, 0, 0).<br />
Figure 2.6: Grade 3 hyperbolic round with size +1<br />
Now consider size(A) = +1. If |x| ≥ |y| then the intersection is empty. If |x| < |y| then the intersection<br />
of the plane containing A and a ∧ b ∧ c ∧ d is a hyperbole, which is stretched as the angle between n(A)<br />
27
and e 1 becomes smaller. Now we view the e 1 -e 2 plane from above. As n(A) lies within this plane and<br />
is the normal vector of the plane containing A, we can view the plane containing A as a line. Because<br />
e_2<br />
y<br />
r<br />
x<br />
r<br />
e_1<br />
Figure 2.7: Hyperbolic warping for size +1<br />
in the e 1 -e 2 plane n(A) has direction (x, y), this line has direction (y, −x). We will call r the smallest<br />
distance from the origin to the intersection of the plane containing A and the hyperboloid a ∧ b ∧ c ∧ d.<br />
Since the closest point of intersection must lie on both the line and the hyperboloid, we must have<br />
(ry, −rx) = (± cosh(α), sinh(α)). Also note that |x| < |y| and x 2 + y 2 = 1 so |y| > 0, therefore we can<br />
divide x by y:<br />
x<br />
y = −−rx ry<br />
= ± sinh(α)<br />
cosh(α) = ± tanh α<br />
So α = ±arctanh(x/y) and with this (the function cosh is even):<br />
|ry| = r|y| = | ± cosh(α)| = cosh(α)<br />
= cosh(±arctanh( x y )) = cosh(arctanh(x y ))<br />
=<br />
√ √ y − x y + x<br />
y + x + y − x<br />
We can now calculate r:<br />
r = 1 ( √ √<br />
y − x y + x<br />
)<br />
2|y| y + x + y − x<br />
Because of the stack S we must give a parameterization for which n(A) = e 1 . Now that we have r this<br />
can easily be done, simply add ‘Scale 2 (r)’ (scale the e 2 axis with r) to S and we may assume that r = 1.<br />
For r = 1 the intersection of the plane containing A with the hyperboloid is the (unstretched) hyperbole<br />
parameterized by:<br />
x 1 = 0, x 2 = ± cosh(α), x 3 = sinh(α)<br />
for −∞ < α < ∞. Technically for r = 1 we have that y = 1 and x = 0, so n(A) = e 2 and we should<br />
parameterize a hyperbole in the e 1 -e 3 plane, but because of the rotation already on our stack S we must<br />
assume that n(A) = e 1 . That is why we set x 1 = 0 for our parameterization and scale in the e 2 direction<br />
instead of e 1 , otherwise our hyperbole is rotated to a wrong orientation by S.<br />
Now consider size(A) = −1. Again we write n(A) = (x, y, 0) for the normal of A. If |x| < |y| then the<br />
intersection of the plane containing A and the hyperboloid a ∧ b ∧ c ∧ d is again a hyperbole and we<br />
28<br />
(2.2)
or<br />
Figure 2.8: Grade 3 hyperbolic round with size -1<br />
treat this case the same as with size(A) = +1. Only the r = 1 parameterization differs (as we intersect<br />
a different hyperboloid because size(A) = −1 instead of 1), now we have<br />
x 1 = 0, x 2 = sinh(α), x 3 = ± cosh(α)<br />
for −∞ < α < ∞. If |x| > |y| the intersection is not empty, but equal to an ellipse, which really is a circle<br />
e_2<br />
intersects ellipse<br />
e_1<br />
intersects<br />
hyperbole<br />
Figure 2.9: Hyperbolic warping for size -1<br />
stretched with r. Through a calculation almost identical to size(A) = +1 (this time p = (ry, −rx) =<br />
(sinh(α), ± cosh(α)), so simply swap x and y in the calculations) we derive:<br />
r = 1 ( √ √<br />
x − y x + y<br />
)<br />
2|x| x + y + x − y<br />
The stack S remains the same as with size(A) = +1 and the parameterization (the intersection is for<br />
r = 1 simply a circle) becomes:<br />
for 0 ≤ α < 2π.<br />
x 1 = 0, x 2 = cos(α), x 3 = sin(α)<br />
Suppose A has grade k = 2, so A = a ∧ b. Then A is the intersection of a line a ∧ b ∧ o ∞ with a grade 3<br />
round a ∧ b ∧ c for some c. This intersection, just as in the Euclidian case, always consists of a point pair.<br />
It is easily seen that the figures above also apply to this case (we intersect a line with a hyperbole/ellipse),<br />
so we must compensate for the point pair being ‘stretched’ with exactly the same amount r as for the<br />
grade 3 rounds. So we add ‘Scale 1 (r)’ (scale e 1 with r because the point pair lies along e 1 ) to our stack<br />
S where we use expressions 2.2 and 2.3 for the cases |x| < |y| and |x| > |y| respectively. Then the point<br />
29<br />
(2.3)
pair can be ‘parameterized’ as (−1, 0, 0) and (+1, 0, 0) because we may now assume that r = 1 and<br />
n(A) = e 1 .<br />
Suppose A has grade k = 1, so A = a. Then A represents a point and we visualize it as (0, 0, 0) just as<br />
with the Euclidian case.<br />
This concludes the classification of objects represented in Hyperbolic G 3 C . Below is a summary of the<br />
parameterizations.<br />
Hyperbolic rounds of grade 4:<br />
S = (Translate(0 → pos(A)), Scale( √ |size(A)|), Rotate((1, 0, 0) → n(A)))<br />
Size Condition Description Parameterization Parameters<br />
-1 - hyperboloid (sinh(α), cosh(α) cos(β), cosh(α) sin(β)) −∞ < α < ∞, 0 ≤ β < 2π<br />
0 - cone (α, α cos(β), α sin(β)) −∞ < α < ∞, 0 ≤ β < 2π<br />
+1 - hyperboloid (± cosh(α), sinh(α) cos(β), sinh(α) sin(β)) 0 ≤ α < ∞, 0 ≤ β < 2π<br />
Hyperbolic rounds of grade 3:<br />
S = (Translate(0 → pos(A)), Scale( √ |size(A)|), Rotate((1, 0, 0) → n(A)), Rotate((x, y, 0) → n(A)), Scale 2 (r))<br />
For x = n(A) 1 , y = √ n(A) 2 2 + n(A)2 3 and r by 2.2 and 2.3 for |x| < |y| and |x| > |y|. If unspecified, the<br />
represented object is empty.<br />
Hyperbolic rounds of grade 2:<br />
Size Condition Description Parameterization Parameters<br />
-1 |x| < |y| hyperbole (0, sinh(α), ± cosh(α) −∞ < α < ∞<br />
-1 |x| > |y| ellipse (0, cos(α), sin(α)) 0 ≤ α < 2π<br />
0 |x| ≤ |y| line pair (0, ±α, α) −∞ < α < ∞<br />
0 |x| > |y| point (0, 0, 0) -<br />
1 |x| < |y| hyperbole (0, ± cosh(α), sinh(α)) −∞ < α < ∞<br />
S = (Translate(0 → pos(A)), Scale( √ |size(A)|), Rotate((1, 0, 0) → n(A)), Rotate((x, y, 0) → n(A)), Scale 1 (r))<br />
With x,y and r the same as before.<br />
Size Condition Description Parameterization Parameters<br />
-1 - point pair (±1, 0, 0) -<br />
0 - point (0, 0, 0) -<br />
1 - point pair (±1, 0, 0) -<br />
Hyperbolic rounds of grade 1 are just the point (0, 0, 0).<br />
30
Chapter 3<br />
Conclusion<br />
We have now classified and parameterized all represented objects in Euclidian and Hyperbolic 3-space.<br />
Together with the implementations of the geometric algebra operations from the first chapter, this should<br />
enable the reader to write a program similar to CGAview or GA viewer, with which conformal geometric<br />
algebra can be visualized and further explored.<br />
Such a program can for example be used to take a look at the use of geometric algebra in physics: easy<br />
object intersection through inner products, rotations (Euclidian signature) or Lorentz transformations<br />
(Hyperbolic signature) through conjugation with the appropriate versors, interpretation of the sum of<br />
(dually) represented objects, simulation of Newtonian/Relativistic dynamics with rotor equations and<br />
much, much more.<br />
Apart from that the reader could also explore the mathematical background of geometric algebra (which<br />
is essentially a Clifford algebra of R n ) and try to prove the geometrical applications of the defined<br />
products. Furthermore the ring G n is bound to have many interesting properties as it contains both<br />
complex and quaternion multiplication through the geometric product.<br />
With these suggestions this paper is concluded and I hope to have given you a satisfactory introduction<br />
to this subject.<br />
Bas Fagginger Auer<br />
3.1 Acknowledgements<br />
I would like to thank Frank Witte for his kind assistance and our stimulating conversations during the<br />
development of CGAview and L. Dorst and D. Fontijne for their previous work concerning geometric<br />
algebra, without which this project could not have progressed quite as much as it did.<br />
31
Appendices<br />
3.2 Binary numbers and operations<br />
Let n ∈ N be an arbitrary number. Usually we write numbers with respect to base-10 (i.e. 324 =<br />
3 · 10 2 + 2 · 10 1 + 4 · 10 0 ), this means that we write n = n k n k−1 . . . n 2 n 1 where the 0 ≤ n i ≤ 9 are<br />
called the digits of the number n, and n = ∑ k<br />
i=1 n i10 i . We can also do this in another basis, say b ∈ N<br />
with b > 1: n = ∑ k<br />
i=1 n ib i . It should be stressed that although the digits will change as we change our<br />
base (both the number of digits and their values), they still represent the same number n. To guarantee<br />
uniqueness of the digit representation of n, we require that (in the representation of n with respect to<br />
basis b) digits lie between 0 ≤ n i < b for all 1 ≤ i ≤ k and that n k ≠ 0 if k > 1. It is easy to see that<br />
now every n is uniquely characterized by a certain number of digits.<br />
Example<br />
Consider the number n = 1023 in base 10 (this is called decimal), we have that 1023 = 1·10 3 +0·10 2 +2·<br />
10 1 +3·10 0 . We can also write n in base 16 (hexadecimal): 1023 = 3·16 2 +15·16 1 +15·16 0 , so n = 3 15 15 =<br />
3FF in hexadecimal (in hexadecimal we use A = 10, B = 11, C = 12, D = 13, E = 14, F = 15 to be able to<br />
write all digits as just one character). Or in base 8 (octal): 1023 = 1·8 3 +7·8 2 +7·8 1 +7·8 0 , so n = 1777<br />
in octal. Or in base 2 (binary): 1023 = 1·2 9 +1·2 8 +1·2 7 +1·2 6 +1·2 5 +1·2 4 +1·2 3 +1·2 2 +1·2 1 +1·2 0 ,<br />
so n = 1111111111 in binary.<br />
We will now write n in base-2: n = n k n k−1 . . . n 2 n 1 . The digits n 1 , n 2 , . . . , n k are called bits and<br />
n k n k−1 . . . n 2 n 1 a k-bit binary number. The bit on the i-th position, n i , can have only two values (since<br />
we are working in base-2): 0 and 1. If n i = 1 we say that the bit on the i-th position or the i-th bit is<br />
set. Otherwise (if n i = 0) we say that the i-th bit is not set or clear.<br />
Example<br />
Let n = 5 then if we write n in binary it is equal to 101. We see that the first and third bits are set,<br />
while the second bit is not.<br />
For binary numbers we can easily define a few operations that work bitwise on their operands. Let<br />
a, b ∈ N and a 1 , a 2 , . . . , a k , b 1 , b 2 , . . . , b k be their binary digits (if they have a different number of bits,<br />
we pad the binary form with the smallest number of bits with 0-valued bits). We define c = a and b as<br />
the binary number c k c k−1 . . . c 2 c 1 where c i = 1 if both bits a i and b i are equal to 1 and c i = 0 otherwise<br />
(it should now be clear why this is called the and operation). Similarly we define c = a or b: c i = 1 if<br />
either a i = 1 or b i = 1 (or both) and 0 otherwise and c = a xor b: c i = 1 if either a i = 1 or b i = 1 (but<br />
not both) and c i = 0 otherwise. This can neatly be summarized in a table (just remember to apply the<br />
operation to every bit of a and b):<br />
a b a and b a or b a xor b<br />
0 0 0 0 0<br />
1 0 0 1 1<br />
0 1 0 1 1<br />
1 1 1 1 0<br />
33
Example Let a = 103 and b = 418, then a = 001100111, b = 110100010 in binary (note that we padded<br />
a with cleared bits to ensure that a and b have an equal number of bits). Using the table above, we see<br />
that a and b = 000100010, a or b = 111100111 and a xor b = 111000101. So a and b = 34, a or b = 487<br />
and a xor b = 453. Note that if we calculate (a xor b) xor b = 00100111 = 103, so (a xor b) xor b = a.<br />
It is not difficult to see (use the table for the xor operation) that this must hold for all a, b ∈ N.<br />
Because bits can only be equal to 0 and 1 we can also uniquely characterize a binary number by the<br />
positions of the bits that are set (since we know for certain that if a bit is not set, that is has to be<br />
clear and cannot assume any other value): a = 10011 = 2 1−1 + 2 2−1 + 2 5−1 , a is characterized by<br />
the bits on positions 1, 2 and 5. More general, let i ∈ N, then we can decompose i in a unique way:<br />
i = 2 i1−1 + 2 i2−1 + . . . + 2 i k−1 with certain 1 ≤ i 1 < i 2 < . . . < i k . Given such a decomposition, we know<br />
that i is an i k -bit number of which k bits are set at exactly the positions i 1 , i 2 , . . . , i k . All unspecified<br />
positions are occupied by cleared bits. This decomposition will be very useful when we start doing base<br />
multivector operations.<br />
There are two more operations that I would like to discuss: the left and right bit shift. Let i = 2 i 1−1 +<br />
2 i 2−1 + . . . + 2 i k−1 be some binary number. Note that if we multiply i by 2, we get 2i = 2 (i 1+1)−1 +<br />
2 (i2+1)−1 + . . . + 2 (i k+1)−1 : all bit positions have shifted one to the left. This is called the left bit shift<br />
of i with 1 bit position. By multiplying i with 2 l for some l ∈ N we get 2 l i = 2 (i1+l)−1 + 2 (i2+l)−1 +<br />
. . . + 2 (i k+l)−1 : all bits are shifted l positions to the left. We write i > l as 2 −l i rounded down: now all bit<br />
positions are shifted to the right l times.<br />
Example Let a = 11001 in binary, then a > 2 = 110, a >> 3 = 11. Furthermore the value 2 l = 1
Bibliography<br />
[1] D. Fontijne and L. Dorst: Performance and elegance of five models of 3D Euclidean geometry in a<br />
ray tracing application, University of Amsterdam 2003<br />
[2] L. Dorst and S. Mann: <strong>Geometric</strong> algebra: a computational framework for geometrical applications,<br />
IEEE Computer Graphics and Applications, 2002 (part I May/June 2002, part II July/August 2002)<br />
[3] J. Suter: <strong>Geometric</strong> <strong>Algebra</strong> Primer, available at http://www.jaapsuter.com/, 2003<br />
[4] L. Dorst and D. Fontijne: 3D Euclidean Geometry Through <strong>Conformal</strong> <strong>Geometric</strong> <strong>Algebra</strong>, University<br />
of Amsterdam 2005<br />
35