Geometric Algebra: A Computational Framework For Geometrical Applications
Geometric Algebra: A Computational Framework For Geometrical Applications
Geometric Algebra: A Computational Framework For Geometrical Applications
Geometric Algebra:
A Computational
Framework For
Geometrical
Applications Stephen Mann
University of Waterloo
Leo Dorst
Part 2 University of Amsterdam
( )
of the geometric product is that it is invertible.
From that first article, you should x = ba−1 c =
1
2
( b ⋅ a + b ∧ a) c
have gathered that every vector a
This second part of our space with an inner product has a
b
tutorial uses geometric
geometric algebra, whether or not
you choose to use it. This article
=
a
(cos φ − Isin φ) c = e −Iφ
c (1)
where x⊥ and x|| are the perpendicular and parallel com- The total rotor is their product, and we rewrite it back to
ponents of x relative to the rotation plane I, respective- the exponential form to find the axis:
ly. We have seen that we can separate a vector into such
components by commutation (as in Equations 31 and 32
from part one1). As you can verify, the following formu-
R ≡ R2 R1 =
1
2
(
1 − e31 1 − e23 )( )
la effects this separation and rotation simultaneously: 1
(
= 1 − e23 − e31 + e12
2
)
rotation over Iφ: x a RIφx = e–Iφ/2x eIφ/2 (3) 1 1 e + e − e3
= − 3 I3 1 2
2 2 3
The operator e–Iφ/2, used in this way, is called a rotor.
In the 2D rotation we treated before, x I = –I x, and ≡ e−I3aπ /3
moving either rotor to the other side of x retrieves Equa-
tion 2 if x is in the I plane. Therefore, the total rotation is over the axis a=(e1+
Two successive rotations R1 and R2 are equivalent to 3, over the angle 2π/3.
e2 – e3)/√
a single new rotation R of which the rotor R is the geo- Geometric algebra permits straightforward general-
metric product of the rotors R2 and R1, since ization to the rotation of higher dimensional subspaces.
We can apply a rotor immediately to an arbitrary blade
(R o R )x = R ( R x R ) R
2 1 2 1
−1
1
−1
2 through the formula
= (R R ) x (R R )
−1
2 1 2 1 = R x R −1 general rotation: X a R X R–1
Linear algebra B ˜I 3 =
In the classical ways of using vector spaces, linear
algebra is an important tool. In geometric algebra, this ( ) (
= b1e2 ∧ e3 + b2 e3 ∧ e1 + b3e1 ∧ e2 e3 ∧ e2 ∧ e1 )
remains true; linear transformations are of interest in = b1e1 + b2 e2 + b3e3 (5)
their own right or as first order approximations to
more complicated mappings. Indeed, linear algebra is This is a vector, and we recognize it (in this Euclidean
an integral part of geometric algebra, and it acquires space) as the normal vector to the planar subspace
much extended coordinate-free methods through this represented by B (see Figure 2b). So we have normal
inclusion. We show some of the basic principles in this vectors in geometric algebra as the duals of 2-blades,
article, but you can find more in related literature.2,3 if we would want them—but we will soon see a better
alternative.
Outermorphisms We can use either a blade or its dual to represent a
When vectors are transformed by a linear transfor- subspace, and it is convenient to have some terminolo-
mation on the vector space, the blades they span can be gy. We will say that a blade B represents a subspace B if
viewed to transform as well, simply by the rule “the
transform of a span of vectors is the span of the trans- x∈B ⇔ x∧B=0 (6)
formed vectors.” This means that a linear transforma-
tion f: Vm → Vm of a vector space has a natural extension and that a blade B* dually represents the subspace B if
to the whole geometric algebra of that vector space, as
an outermorphism—that is, as a mapping that preserves x ∈ B ⇔ x B* = 0 (7)
the outer product structure:
We switch between the two standpoints by using the dis-
f(a1 ∧ a2 ∧ … ∧ ak) ≡ f(a1) ∧ f(a2) ∧ … ∧ f(ak) (4) tributive relation (A ∧ B) C = A (B C) (which is Equa-
60 July/August 2002
tion 19 from part one1) used for a vector x, a blade B, ermorphism of the linear mapping defined for vectors
-
and a pseudoscalar I: by f(a)⋅b=a⋅f(b)—its matrix representation on vectors
would be the transpose.
( x ∧ B ) ˜I = x (B ˜I ) (8) Because of the complexity of this transformation
behavior, we should steer clear of any constructions that
and by a converse (but conditional) relationship that we involve the inner product, especially when characteriz-
state without proof ing basic properties of geometric objects. The practice of
characterizing a plane by its normal vector—which con-
( x B ) ˜I = x ∧ (B ˜I ) if x ∧ I = 0 (9) tains the inner product in its duality—should be avoid-
ed. Under linear transformations, the normal vector of
If x is known to be in the subspace of I, we can write a transformed plane is not the transform of the plane’s
these simply as (x ∧ B)* = x B* and (x B)* = x ∧ B*, normal vector. (This is a well-known fact, but it is always
which makes the equivalence of the two representations a shock to novices.) Rather, the normal vector is a cross
obvious. product of vectors, which transforms as
Cross product ( ) () ( ) ()
f a × b = f −1 a × f −1 b det f (11)
Classical computations with vectors in 3-space
often use the cross product ×, which produces from where det(f) is the determinant defined by
two vectors a and b a new vector a × b perpendicular det(f)=f(Im)I−1m. (This is a coordinate-free definition
to both (by the right-hand rule), proportional to the of the determinant of the matrix representation of f.)
area they span. We can make this in geometric alge- The right-hand side of Equation 11 is usually not
bra as the dual of the 2-blade spanned by the vectors equal to f(a) × f(b), so a linear transformation is not
(see Figure 2b): cross-product preserving. Therefore, it is much bet-
ter to characterize the plane by a 2-blade, now that
∗
we can. The 2-blade of the transformed plane is the
( )
a × b ≡ a ∧ b ˜I 3 ( )
= a ∧ b
(10) transform of the 2-blade of the plane because linear
transformations are outermorphisms preserving the
2-blade construction. Especially when the planes are
You can verify that computing this explicitly using Equa- tangent planes constructed by differentiation, 2-
tion 1 from part one1 and Equation 5 indeed retrieves blades are appropriate. Under any transformation f,
the usual expression a × b = (a2b3 – a3b2)e1 + (a3b1 – the construction of the tangent plane depends only
a1b3)e2 + (a1b2 – a2b1)e3. on the first-order linear approximation mapping f of
Equation 10 explicitly shows several things that we f. Using blades for those tangent spaces should enor-
always need to remember about the cross product: mously simplify the treatment of objects through dif-
ferential geometry, especially in the context of affine
■ there is a convention involved on handedness (this is transformations.
coded in the sign of I3),
■ there are metric aspects because it is perpendicular Intersecting subspaces
to a plane (this is coded in the usage of the inner prod- Geometric algebra also contains operations to deter-
uct ), and mine the union and intersection of subspaces. These are
■ the construction only works in three dimensions the Join and Meet operations. Several notations exist for
because only then is the dual of a 2-blade a vector these in the related literature, causing some confusion.
(this is coded in the 3-gradedness of I3). In this article, we will use the set notations ∪ and ∩ to
make the formulas more easily readable.
The vector product a ∧ b does not depend on any of The Join of two subspaces is their smallest super-
these embedding properties yet characterizes the (a, b) space—that is, the smallest space containing them
plane just as well. In geometric algebra, we therefore both. Representing the spaces by blades A and B, the
have the possibility of replacing the cross product by a Join is denoted A ∪ B. If the subspaces of A and B are
more elementary construction. Linear algebra gives a disjoint, their Join is obviously proportional to A ∧ B.
good reason for doing so. A problem is that if A and B are not disjoint (which is
precisely the case we are interested in), then A ∪ B
No normal vectors or cross products contains an unknown scaling factor that is funda-
The transformation of an inner product under a lin- mentally unresolvable due to the blades’ reshapable
ear mapping is more involved than that of the outer prod- nature (see Figure 3). (Stolfi4 also observed this
uct in Equation 4 because perpendicularity is a more ambiguity.) Fortunately, in all geometrically relevant
complicated concept to transform than spanning. entities that we compute, it appears that this scalar
Hestenes3 gives the general transformation formula. For ambiguity cancels out.
blades, it becomes The Join is a more complicated product of sub-
spaces than the outer product and inner product. We
( ) ( ) ( )
f A B = f −1 A f B can give no simple formula for the grade of the result
and cannot characterize it with a list of algebraic
-
where f is the adjoint, defined as the extension of an out- computation rules. Although computation of the Join
1 e1 + e 2
=−
1
(e + e ) = −
1 2
(14)
2 2 2
= ((B ˜I ) ∧ ( A ˜I )) I
may appear to require some optimization process,
3 3 3
the smallest superspace is directly related to the
nonzero part of highest grade in the expansion of the = (B ˜I ) (( A ˜I ) I )
3 3 3
= (B ˜I ) A = A ∩ B
geometric product and can therefore be done in con-
3
stant time.5
The Meet of two subspaces A and B is their largest
common subspace. Given the Join J ≡ A ∪ B of A and B, So the classical result is a special case of Equation 13,
we can compute their Meet A ∩ B by the property that but Equation 13 is much more general; it applies to the
its dual (with respect to the Join) is the outer product intersection of subspaces of any grade, within a space
of their duals. In formula, this is of any dimension.
The norm of the Meet gives an impression of the
( A ∩ B ) J˜ = (B J˜) ∧ ( A J˜) intersection strength. Between normalized subspaces
in Euclidean space, the magnitude of the Meet is the
or sine of the angle between them. From numerical
analysis, this is a well-known measure for the distance
( A ∩ B)
∗
= B∗ ∧ A∗ (12) between subspaces in terms of their orthogonality—
it is 1 if the spaces are orthogonal and decays grace-
with the dual taken with respect to the Join J. (The fully to 0 as the spaces get more parallel, before
somewhat strange order in Equation 12 means that changing signs. This numerical significance is useful
the Join J can be written using the Meet M in the fac- in applications.
torization J = (AM–1) ∧ M ∧ (M–1B), and it corre-
sponds to Stolfi4 for vectors.) This leads to a formula Differentiation
for the Meet of A and B relative to the chosen Join (use Geometric algebra has an extended operation of dif-
Equation 8): ferentiation, which contains the classical vector cal-
culus and much more. It is possible to differentiate with
(
˜ A
A ∩ B = B J ) (13) respect to a scalar or vector, as before, but now also
with respect to k-blades. This enables efficient encod-
Let us do an example: the intersection of two planes ing of differential geometry, in a coordinate-free man-
1
represented by the 2-blades A=–2 (e1+e2)∧(e2+e3) and ner and gives an alternative look at differential shape
62 July/August 2002
descriptors like the second fundamental form. (It
becomes an immediate indication of how the tangent
plane changes when we slide along the surface.) This
would lead us too far, but we will show two examples
of differentiation. P(x) x 5 The deriva-
Pa(x) tive of the
A rotor’s scalar differentiation spherical
–Iφ/2
Suppose we have a rotor R = e (where Iφ is a func- a projection.
tion of time t) and use it to produce a rotated version X
= RX0R–1 of some constant blade X0. Using the chain
rule and commutation rules, scalar differentiation with
respect to t gives
d
X= e(
d −Iφ /2
X oeIφ /2 ) (a ⋅∂ ) xx ≡ lim
x
1 x + λa
λ→0 λ
x + λa
−
x
x
dt dt
=−
1 d
2 dt
( )(
Iφ e−Iφ /2X oeIφ /2 ) 1
x + λa
x
= lim −
( ) ( )
1 d λ→0 λ −1 x
+ e−Iφ /2X oeIφ /2 Iφ x 1 + 2λa ⋅ x
(x + λa)(1 − λa ⋅ x ) − x
2 dt −1
1 d
= X
2 dt
Iφ − ( ) d
dt
( )
Iφ X
= lim
λ→0 λx
= X⊗
d
dt
( )
Iφ (15)
=
(
a − x a x −1
) = (a ∧ x )x −1
x x
using the commutator product ⊗ defined in geometric
algebra as the shorthand A ⊗ B ≡ 1/2(AB−BA). This We recognize the result as the rejection of a by x, scaled
product often crops up in computations with continu- appropriately (see the “Projecting subspaces” section
ous groups such as the rotations. from part one1). Figure 5 confirms the outcome. You can
The simple expression that results assumes a more verify in a similar manner that (a ⋅ ∂x)x–1 = –x–1 ax–1
familiar form when X is a vector x in 3-space and when and interpret geometrically.
the attitude of the rotation plane is fixed so that dI/dt =0. For more advanced usage of differentiation relative
We introduce a scalar angular velocity ω ≡ dφ/dt, and to blades, see the Doran et al.2 tutorial, which introduces
the vector dual to the plane as the angular velocity vec- these differentiations using examples from physics, and
tor w, so w ≡ωI Ĩ3=ωI/I3. Therefore, ωI = wI3, which the Lasenby et al.6 application paper.
equals w I3. Using the fact that x ⊗B=1/2(xB−
Bx)=xB for a vector x and a 2-blade B, we obtain Models of geometry
Geometric algebra can help us express several stan-
dard models of geometry. The advantage of doing so is
d
dt
x = x⊗
d
( ) ( )
dt
Iφ = x ⊗ w I3 an increase in expressive power and a structural inte-
gration of seemingly ad-hoc constructions into the
( ) ( )
= x w I3 = x ∧ w I3 = w × x geometry. Here we look at geometric algebra represen-
tations of homogeneous coordinates and Plücker coor-
dinates as well as a model of Euclidean geometry that
where × is the vector cross product. As before, when we naturally handles spheres.
treated other operations, we find that an equally simple
geometric algebra expression is more general. Here Homogeneous model
Equation 15 describes the differential rotation of k So far we have been treating only homogeneous sub-
dimensional subspaces in n dimensional space, rather spaces of the vector space Vm—that is, subspaces con-
than merely of vectors in 3D. taining the origin. We have spanned them, projected
them, and rotated them, but we have not moved them
Differentiation of spherical projection out of the origin to make more interesting geometrical
Suppose that we project a vector x on the unit sphere structures such as lines floating in space. We construct
by the function x aP(x)=x/|x|. We compute its those now, by extending the ideas behind homogeneous
derivative in the a direction, denoted as (a ⋅ ∂x)P(x) coordinates to geometric algebra. It turns out that such
or Pa(x), as a standard differential quotient and using elements of geometry can also be represented by blades,
Taylor series expansion. Note how geometric algebra in a representational space with an extra dimension.
permits compact expression of the result, with geo- The geometric algebra of this space gives us precisely
metrical significance: what we need. In this view, more complicated geomet-
rical objects do not require new operations or tech-
niques, merely the standard computations in a higher The former is the direction vector of the directed line;
dimensional space. the latter is an area that we call the moment of the line
The homogeneous model is often described as aug- through p and q. It specifies the distance to the origin, for
menting a 3D vector v with coordinates [v1, v2, v3] to a we can rewrite it to a rectangle spanned by the direction
4-vector [v1, v2, v3, 1]. That extension makes nonlinear (q – p) and the perpendicular support vector d:
operations such as translations implementable as linear
mappings. p ∧ q = p ∧ (q – p) = d(q – p) (17)
We give the (m + 1)-dimensional homogeneous space
into which we embed our m-dimensional Euclidean space where d ≡ (p ∧ (q – p))(q – p)–1 = (p ∧ q)(q – p)–1 is
a full geometric algebra. Let the unit vector for the extra the rejection of p by q – p. We can therefore rewrite the
dimension be denoted by e. This vector must be perpen- same 2-blade p ∧ q in various ways, such as p ∧ q = p ∧
dicular to all regular vectors in the Euclidean space Em, so (q – p) = d(q – p) (with d = e + d), separating the posi-
e x = 0 for all x ∈ Em. We also need to define e e to make tional part p or d and the purely Euclidean directional
our algebra complete. This involves some dilemmas that part v ≡ q – p (see Figure 6c). The element p ∧ q con-
are only fully resolvable in the double homogeneous tains all these potential interpretations in one data struc-
model, which we explain later on. For now, we can take ture, which we can construct in all these ways.
e e = 1. We interpret e as the Euclidean point at the origin. Temporarily reverting to the cross product to make a
Let us now represent the subspaces of interest into connection with a classical representation, we can
this model, simply by using the structure of its geomet- rewrite Equation 16 as
ric algebra.
p ∧ q = e ∧ (q – p) + p ∧ q = (p – q)e + (p × q)I3 (18)
Points. A point at a location p is made by translat-
ing the point at the origin over the Euclidean vector p. We recognize the six Plücker coefficients [p – q; p ×
We do this by adding p to e. This construction gives the q], characterizing the line by its direction vector v =
representation of the point P at location p as the vector q – p and its moment vector m = p × q as
p in (m + 1)-dimensional space:
l = –ve + mI3
p=e+p
The six coefficients [–v1, –v2, –v3, m1, m2, m3] of the line
This is a regular vector in the (m + 1)-space, now inter- in this representation are the coefficients of a 2-blade on
pretable as a Euclidean point. It is of course no more the bivector basis {e1e, e2e, e3e, e2e3, e3e1, e1e2}. This
than the usual homogeneous-coordinates method in dis- integrates the Plücker representation fully into the homo-
guise—p has coordinates [p1, p2, p3, 1] on the ortho- geneous model (for which it was historically designed).
normal basis {e1, e2, e3, e}. We will denote points of the We will see that the compact and efficient Plücker inter-
m-dimensional Euclidean space in script, the vectors section formulas are now straightforward consequences
and blades in the corresponding vector space in bold, of the Meet operation in geometric algebra.
and vectors and blades in the (m + 1)-dimensional
homogeneous space in italic. You can visualize this con- Hyperplanes. If we have an (m – 1)-dimensional
struction as in Figure 6a (necessarily drawn for m = 2). hyperplane characterized as x n = δ, this can be written
We can multiply these vectors in (m + 1)-dimension- as (e + x) (n – δe) = 0, so x (n – δe) = 0. Therefore, n
al space using the products in geometric algebra. Let us – δe is the dual of the blade representing the hyperplane.
consider in particular the outer product and form blades. The dual A* of a blade A in the homogeneous model is
obtained relative to the pseudoscalar e ∧ I3 = eI3 of the
Lines. To represent a line, we compute the 2-blade full space as A* = A (eI3)–1 = A (eI3) = A(eI3), so we get
spanned by the representative vectors of two points:
(n – δe)(eI3) = neI3 – δI3
p ∧ q = (e + p) ∧ (e + q) = e ∧ (q – p) + p ∧ q (16)
This has the usual four Plücker coefficients [n1, n2, n3,
We recognize the vector q – p and the area spanned by –δ], but on the trivector basis {–e2e3e, –e3e1e, –e1e2e,
p and q. Both are elements that we need to describe an e1e2e3}—it is clearly different from the vector basis for
element of the directed line through the points P and Q. points.
64 July/August 2002
Of course, we can also construct the blade represent- ■ Line and plane. The Meet of a line l and a plane π* =
ing the hyperplane directly (rather than dually), given n – δe in general position is computed as
m points on it—namely, as the outer product of the vec-
tors representing those points. l ∩ π = π* l = (n – δe) (–ve + mI3)
= –(n ⋅ v)e + n (mI3) – δv + 0
And beyond. These ways of making offset planar = –(n ⋅ v)e + (n ∧ m)I3 – δv
subspaces extend easily. An element of the oriented = –(n ⋅ v)e + (m × n – δv)
plane through the points P, Q, and R is represented by
the 3-blade p ∧ q ∧ r and so on for higher dimensional This is the correct result, representing a point at the
offset subspaces—if the space has enough dimensions to location (δv + n × m)/(n ⋅ v) in its homogeneous
accommodate them. The blades we construct this way (Plücker) coordinates. Note how the orthogonality
can always be rewritten in the form A = dA, where A is relationships between the basis elements automati-
a purely Euclidean blade and d is a vector of the form cally kill the potential term involving δ and m. But the
e + d, with d a Euclidean vector. We should interpret A fact that this term is zero is computed, and that is a
as the direction element, so its grade denotes the dimen- slight inefficiency relative to the direct implementa-
sionality of the flat subspace represented by A. The vec- tion of the same result from a table with Plücker for-
tor d represents the closest point to the origin (so that mulas. It is the computational price we pay for the
d is the perpendicular support vector). membership of the full geometric algebra.
Scalar distances. A small surprise is that even a 0 ■ Two lines. The Meet of two lines in general position is
blade (that is, a scalar) is useful; it is the representation of a measure of their signed distance (remember that in
a scalar distance in the Euclidean space (with a sign but this model a dual is made through a right-multiply by
without a direction), as we will see in the next section. eI3, so the dual of the line –v2e + m2I3 is –v2I3 + m2e):
Such distances are of course regular elements of geome-
try, so it is satisfying to find them on a par with position
vectors, direction vectors, and other elements of higher
( )(
l1 ∩ l2 = l2∗ l1 = −v 2 I 3 + m2 e −v 1e + m1I 3 )
dimensionality as just another case of a representing blade = m2 ⋅ v 1 + v 2 ⋅ m1
in the homogeneous model of a flat Euclidean space.
retrieving the well-known compact Plücker way of
Caseless subspace interactions determining how lines pass each other in space. Three
Having such a unified representation for the vari- tests on the signs of such quantities representing the
ous geometrical elements implies that computations edges of a triangle determine efficiently whether a
using them are unified as well; they have just become ray hits the triangle. Again, the basis orthogonality
operations on blades in (m + 1)-space, blissfully igno- relationships have made terms containing m1 ⋅ m2 or
rant of what different geometrical situations these v1 ⋅ v2 equal to zero.
computations might represent. This opens the way to
caseless computation in geometrical algorithms. The directional outcomes are accompanied by numer-
The Meet and Join in the homogeneous model func- ical factors (such as n ⋅ v in the first example) relating to
tion just as you would expect, providing the intersec- the computation’s numerical significance. These are an
tion of lines, planes, and so forth. Writing these out in intrinsic part of the object’s computation, not just sec-
their (Plücker) coordinates retrieves the familiar com- ondary aspects we need to think of separately (with the
pact formulas for the coefficients of the result, but danger of being ad hoc) or that we need to compute sep-
they are now accompanied by automatic evaluation arately (costing time).
of the basis on which these coefficients should be
interpreted. That provides immediate identification Double homogeneous model
of the kind of intersection in a manner so well inte- Hestenes7 has recently shown that embedding of
grated that it suggests we might continue our compu- Euclidean space into a representational space of two extra
tation without intermediate interpretation. This leads dimensions and its geometric algebra is powerful and sim-
to caseless geometrical algorithms in which the plifying. This double homogeneous model of Euclidean
dimensionality of intermediate results does not affect space embeds the Euclidean distance properties into the
the data flow. fabric of the algebra used to compute with it.
Even though the actual computation is a caseless
Meet applied to blades, let us see what is going on in ■ The inner product is defined in terms of the Euclidean
1
detail in some typical situations. Following the inter- distance dE between points: p⋅ q=− –2 d 2E (P,Q). That
nal computational combination of the Plücker-like means that the representational space has a rather
coefficients shows how the algebra of the basis ele- special metric because it follows that p ⋅ p = 0 for any
ments takes care of the proper intersection computa- vector p. Only when we assign a special point as the
tion, at a small additional expense compared to the origin can we define vectors denoting the relative posi-
usual implementation using precompiled tables of tion of a point—such a vector p does of course have a
intersection formulas. (We write the contraction of nonzero norm. But we can specify all computations
vectors as the classical inner product to show the cor- without ever introducing such an origin.
respondence clearly.) ■ The outer product constructs spheres—a k-blade rep-
66 July/August 2002
and coordinate-free differential geometry. You should be
able to glean the connections from the “Further Reading” Further Reading
sidebar, although an accessible explanation for computer There is a growing body of literature on
graphics of such issues is still necessary. ■ geometric algebra. Unfortunately, much of the
more readable writing is not very accessible and
Acknowledgments in specialized books rather than general journals.
The Netherlands Organization for Scientific Research Researchers have written little with computer
and the Natural Sciences and Engineering Research science in mind because the initial applications
Council of Canada supported this work in part. have been to physics. We recommend the
following as natural follow-ups to this article: