In words of Pablo Colapinto: “modern day graphics systems are an amalgam of matrix, vector, and tensor algebras“. These algebras run fast in computers, but the intricacies of their algebraic representations make it difficult to realize their truly geometric interpretation. Within the last decade, Geometric Algebra has emerged as a powerful alternative to the classical matrix, vector and tensor algebras as a comprehensive conceptual language and computational system for computer science. In his Master’s thesis Colapinto states that “great research has been done demonstrating its powers of synthesis, especially with regards to forms and control systems generated by twist groups and motor algebras“. However, it is known that little research focuses on their application to computer graphics, geometric modeling and animation. The aim of this post is to encourage the reader for use geometric algebra in geometric modeling applications and computer graphics.
Geometric Algebra can be defined as the subset of Clifford Algebra that has geometric interpretation. In Conformal Geometric Algebra (CGA), rigid body motions can be represented as compact (multi-)vectors called Motors. Unlike homogeneous matrices, motors are linear transformations. All multivectors can be transformed by motors in a covariant and linear way. CGA motors can be efficiently interpolated for generating continuously deformed motions, and that is one of the main features that we should exploit in computer graphics. On the other hand, the interpolation of matrices is difficult and expensive. The logarithm of a matrix can be defined but is not elementary and not in closed form. A straightforward way to compute it is to take the eigenvalue decomposition of the rigid body motion matrix in the homogeneous coordinate framework, and take the Nth root of the diagonal matrix. Such numerical techniques makes the matrix logarithm expensive to compute and hard to analyze.
3D Geometric Algebra
It is well known that a vector may be interpreted geometrically as representing a direction in space. If the space has a metric, then the magnitude of is interpreted as its length. The introduction of the outer product enables us to extend the entities of the space to higher dimensions. The outer product of two vectors , called a bivector, may be visualized as the two-dimensional analogue of a direction, that is, a planar direction. Neither vectors nor bivectors are interpreted as being located anywhere since they do not possess sufficient information to specify independently both a direction and a position. If the space has a metric, then the magnitude of is interpreted as its area , and similarly for higher order products.
The bivector is not a vector, and so does not belong to the original linear space. In fact the bivectors form their own linear space. The fundamental defining characteristic of the exterior product is its anti-symmetry. That is, the product changes sign if the order of the factors is reversed.
that means the orientation of the bivector is reversed when we take the product in the opposite order i.e., the plane normal would point in the opposite direction. This property also implies that , whose interpretation is that a new subspace (a plane for example) cannot be created from linearly dependent vectors.
Other properties of the outer product are:
We can express the bivector in terms of its basis. Given a orthonormal basis of vectors denoted as and the vectors and the bivector is a linear combination of basis bivectors:
where , and . The scalar factors appearing here are just those which would have appeared in the usual vector cross product of and . However, there is an important difference, the outer product is valid for any number of vectors in spaces of arbitrary dimension, while the cross product is necessarily confined to products of two vectors in a space of three dimensions. We will use the notation for basis bivectors , for example is equal to .
High dimensional subspaces can be constructed such as the trivectors defined as which encodes a three-dimensional subspace whose norm is the volume of the parallelepiped formed by the vectors , and .
where . A trivector in a space of three dimensions has just one component.
Grade of a vector
The outer product also defines the grade of geometric objects, for example, bivectors are grade- vectors and trivectors are grade- vectors. Euclidian vectors are grade- vectors, denoted as -vectors and scalars are -vectors. In general a -vector, denoted as is a vector of grade .
A multivector is a vector that can have mixed grades. Such objects are also known outside the geometric algebra, for example a quaternion is an entity made of a scalar component and a vector component, and the quaternion basis is . In a similar way, the basis for the -D geometric algebra multivectors is the following:
The -vector of highest grade is known as pseudoscalar i.e., In -D geometric algebra the trivector is the pseudoscalar.
An important algebraic operation applied to multivectors is reversion. This plays an analogous role to transposition in matrix algebra. The reverse of a -vector is defined as . Also can be defined as .
The inner product of two vectors and is defined as usual , and similarly, the inner product of two -vectors and is defined as . The inner product of a vector and a bivector is defined as that is also a vector. More precisely, is a vector that lies in the plane and is orthogonal to the projection of the vector on the plane, i.e., . The inner product of a vector and a trivector is defined as that is a bivector. That is is the bivector orthogonal to the vector . The inner product of a bivector and a trivector is defined as that is a vector perpendicular to the bivector .
In general, the inner product of a -vector and a -vector where gives as a result an element of grade that is perpendicular to the -vector.
The inner product properties:
The inner product of a -vector and the reverse of the pseudoscalar gives as a result an element of grade that is perpendicular to the -vector. That operation is called dualization and is denoted with an asterisk () superscript, for example the dual of a vector is that is a bivector perpendicular to the vector . A notorious dualization is the bivector dual that is the cross product of vectors and .
The geometric product of two vectors and is defined as:
under the geometric product, orthogonal vectors anticommute and parallel vectors commute. The product therefore encodes the basic geometric relationships between vectors. Similarly the geometric product of a vector and a bivector is .
The inner and outer products are not fundamental as we can define them in terms of the geometric product. We can take the -vector part of a multivector using the grade selection operator . For example the grade- part of the product is and the grade- part is .
The geometric product is distributive over addition and is also associative but is not commutative in general. Although, the pseudoscalar commutes with all multivectors in the algebra. Also notice that the pseudoscalar satisfies:
this also is true for the basis bivectors as .
The inverse of a -vector is defined as , where . So the product
In geometric algebra a special transformation, applied to an arbitrary multivector , can be written in the form
Here is an even-grade multivector (grades and ) satisfying . The element is called a Rotor. Every rotor can be written in terms of the exponential of a unit bivector as:
In -D geometric algebra, rotors are isomorphic to quaternions and they behave in the exact same way. In fact, rotors are the generalization of quaternions to the -D spaces.
Conformal Geometric Algebra
The conformal group is the group of transformations that preserve angles. These include the rigid (euclidean) transformations. The conformal group on has a natural representation in terms of rotations in a -D space, with signature which means basis vectors have a positive square, and have a negative square. So, in the same way that projective transformations are linearised by working in a -D homogeneous space, conformal transformations are linearised in a -D space.
The main advantage of basing the description in a conformal setting is that distance is encoded simply. The euclidean distance of two points and is defined as its inner product:
so, points in conformal geometric algebra are null vectors i.e., a point has null square:
because the distance to itself is zero. The existence of null vectors is guaranteed by the fact that the conformal vector space has mixed signature. The conformal vector space poses the three vectors , and and we add to these the vectors and , so that all vectors are orthonormal. The new vectors satisfy:
From the two extra vectors we define the two null vectors and , so that , . The new basis vectors and (also called Minkowski basis) are not orthogonal anymore so that but are still orthogonal to the euclidean basis vectors , and , so that . The vector can be interpreted as the point at the origin and the as the point at infinity.
A general null vector can be constructed in the new basis , given a euclidean vector as:
This null vector can be interpreted as a euclidean point. Note that if is at the origin then the point , and if is far from the origin the point approaches the point at infinity .
Round objects such as spheres and circles can be constructed easily from null points. A circle that pass through the points , and is given by:
And the sphere that pass through the points , , and is given by:
Flat objects such as planes and lines can be constructed easily as well since they are just round objects passing through the point at infinity . A line that pass through points and is given by:
And the plane that pass through the points , and is given by:
We also can construct the line passing through the point and with direction vector as and we can construct the plane passing through the origin having the direction bivector as .
The dual representations of rounds and flats is useful for the construction of geometric objects when we have certain parameters instead of points. For instance if we have the center and radius for circles and spheres or the normal vector and distance to the origin in the case of flats, it is more convenient to use the dual representation.
A conformal tranformation is an even-grade multivector satisfying and can be written as the exponential of a unit bivector :
For example a euclidean translation is given by , where is the translation vector. The rotation rotor is given by where is the rotation (euclidean) bivector. The scaling rotor is given by where is the positive scaling factor.
A general rigid body motion (or motor) can be represented as:
where is a translation rotor and is a rotation rotor.
Conformal transformations can be applied gradually to any object by splitting the conformal motor in equal parts through and then applying them in time steps. A simple way to get the linear interpolation between two motors and is . This formulation requires to take the motor logarithms and .