# Maths - Transforms using Multivectors

On these pages we look at how we can transform points in 'n' dimensions using geometric algebra.

The following table summarises some basic types of transform:

derivation transform
no change P/P=1 (Va * P) / P
parallel component go here (Va • P) / P
perpendicular component go here (Va P) / P
reflection go here -(P * Va) / P
rotation   (M * Va) / M
scaling   Va * s
translation   ?
join (similar to union)   Va ^ Vb
meet (similar to intersection)   Ba • Bb

Notes:

• Here I have shown the inverse as "/P" because the order is not ambigous but if there is any doubt it is better to use P-1.
• Va is the input vector
• P is the transform vector
• M is the transform multivector (even grades)
• These transforms are all symmetrical around the origin, we are not yet introducing translations.

### Parallel and Perpendicular Components

These projections seem to be one of the most basic forms of transforms from which we can build reflections and rotations. We can project lines onto planes, lines onto lines, etc. extending up to higher 'blades'. These two types of projection (parallel and perpendicular) are complimentary as adding them gives the original. This is becase of the duality between • and :

parallel component of Va to P: (Va • P) / P

perpendicular component of Va to P: (Va P) / P

((Va • P)+(Va P)) / P

but we know that in general: (a * b) = (a • b)+(a b)

so,

((Va • P)+(Va P)) / P = (Va * P) / P = Va

as expected, adding parallel and perpendicular projections gives original vector.

### Reflection When an object is reflected one of the components of its position is reversed while the other components are not. The left or right handedness of the object is reversed.

## Reflection of points

We want to reflect point Pa in the plane to give the reflected point Pb. To do this we take a vector from the origin to Pa (the red vector on the diagram above), we then spilt this into its components which are normal and parallel to the plane. We then add these points together again but instead of using the normal we use its inverse.

We can calculate this using Clifford algebra as follows:

Va = (Va*P)/P

That is, multiplying and dividing by P: a vector representing the plane, has no effect. If we now reverse the order of Va and P that will reverse the components parallel to the plane but not the component perpendicular to the plane. However we want to reverse the components perpendicular but not parallel to the plane so we reverse (negative sign) the whole expression to give:

Vb = -(P*Va)/P

where:

• Va = unreflected vector.
• Vb = reflected vector.
• P = Plane represented by normal vector.
• * = Geometric Product.

This is the main result on these pages and it applies when we are working in any number of dimensions (although in a number of dimensions, other than 3, the mirror is not a plane). The result also applies regardless of whether the dimensions square to +ve or -ve, in fact, if the dimensions all square to +ve we can simplify to:

Vb = -(P*Va*P)/(P*P)
= -P*Va*P

The result does require that the dimensions all anti-commute.

This is a very important result as it allows us to calculate rotations in any number of dimensions, on this page, by generating rotations from an even number of reflections.

So all that remains to do here is derive the result using different types of algebras and to look at the implications, especially in higher dimensional spaces.

#### Reflection in terms of Perpendicular and Parallel Components

We can calculate this result by more explicitly calculating the perpendicular and parallel components, which were derived On this page so we can combine them as follows,

Va is the sum of its perpendicular and parallel components:

Va = Va || P + Va P

and its reflection is:

Vb = Va || P - Va P

where:

• Va = vector form origin to Pa
• Vb = vector form origin to Pb
• P = plane, represented by bivector which is normal to plane

from the same page we know that:

• Va || P = (Va P) / P
• Va P = Va • P / P

so,

Vb = -(Va • P - Va P)/P

since • commutes and anticommutes reversing the order gives:

Vb = -(P • Va + P Va)/P

since a • b + a b = a*b we have:

Vb = -(P * Va)/P

### Rotations

As described on this page the most general way to define an 'n' dimensional rotation, using Clifford algebra, is by using 2 (or an even number) of reflections.

So we will define the first reflection by:

V' = -P1 * V * P1-1

and the second reflection by:

V' = -P2 * V * P2-1

To calculate the result of this compond reflection we need to feed the output of the first to the input of the second, so we get:

V' = -P2 * (-P1 * V * P1-1) * P2-1

That is the second 'wraps' round the outside of the first. Canceling out the negative signs gives:

V' = P2 * P1 * V * P1-1 * P2-1

since a quantity times its inverse is1 then (P2 * P1)*(P2 * P1)-1=1

So we can add this to the end of our equation without altering anything:

V' = P2 * P1 * V * P1-1 * P2-1 * (P2 * P1)*(P2 * P1)-1

we can then cancel out P2-1 * P2 = 1 and then P1-1 * P1 = 1 to give:

V' = (P2 * P1) * V *(P2 * P1)-1

we can now let M=P2 * P1 to give the equation for the rotation as:

V' = M * V *M-1

where:

• M is a multivector formed from the vector product and which can define the rotation.
• V is the vector being transformed.

So two vectors multiplied together produce a rotation represented by a scalar and a bivector term, for instance,

(a e1 + b e2)(c e1 + d e2) = (ac+bd) + (ad-bc) e12

We can combine these rotations by multiplying the scalar+bivector term for each rotation to give the scalar+bivector term for the combined rotation. This works well in 2 and 3 dimensional space, however in 4D space this might well produce a quadvector term (e1234). This represents the geometry of 4D space where compound rotations may require all the even subalgebra terms and does not nesessarily represent rotation projected onto a single plane. See this page for more about n-dimensional rotations.

The equation involves the inverse M-1, in many cases this is equivalent to the reversal written M†, for instance:

(e1e2)-1 = e2-1e1-1 = e2 e1 = -e1 e2

where e1 and e2 are unit length and both square to +1 or both square to -1 but not mixed types.

In this case the inverse of scalar+bivector terms = scalar- bivector terms.

### Translations

Solid objects in 3 dimensional space have 6 degrees of freedom, there are 3 dimensions in which the position can move (translation) but the object can also rotate with an additional 3 degrees of freedom.

The translation and rotation of a solid body have different properties, translation can be represented by vector algebra, rotation (if represented as a 3 dimensional quantity such as euler angles) is non-linear, has singularities and different definitions depending on the order we apply the rotations.

The only way that we can resolve these problems with rotations is to embed our representation of this 3D quantity into a higher dimensional space. The most common ways to do this are:

These solve the above problems with manipulating rotations at the cost of increasing the number of dimensions. However, these algebras are very different from vector algebra, operations are represented by multiplication and they don't commute (order is important).

Traditionally therefore we calculate the translational and rotational properties of solid body mechanics separately, this can get very complicated and messy, especially when we want to calculate how the rotation and linear movements are interacting.

This is where Geometric Algebra may be able to help. It would be useful if we could combine linear and rotational movement into a single transform and to automatically handle the interaction between them. It would also be useful to be able to use this algebra to work with physics equations. For instance, imagine we have a set of forces acting on a solid body, can we determine the linear and rotational movement?

We have already said that we can't combine rotations by vector addition so can we do the reverse and combine translations using matrix or quaternion multiplication algebra? Yes we can.

We can represent rotation, translation combinations using 4×4 matrix algebra (16 scalar values although 4 of these are fixed), this is very useful for 3D computer graphics and is widely used. Its probably the easiest method of these approaches for the newcomer to understand. There are issues with both 3×3 and 4×4 matrices, they are difficult to re-orthogonise and its difficult to interpolate between matrices. In terms of solid body mechanics its difficult to formulate physics equations in these terms, vector algebra allows us to express physics equations in a general way that is independent of the coordinate system, its difficult to do this with matrices.

So, can we build a 'quaternion like' algebra that has the properties we want for combined translations and rotations? Since quaternions are a particular subset of Geometric Algebra we may be able to make quaternions more general using Geometric Algebra.

There are two approaches that we can take here:

• We can create an algebra which has a multiplication table where the multiplicative part of the translation terms disappears and we are just left with the additive part (an example of this is dual quaternions).
• We can create an algebra which represents translations as directions at infinity (an example of this is plücker coordinates).

The first approach produces a very compact algebra and is very powerful in certain applications, although the multiplication table is unsymmetrical and so I'm not sure it would be very suited to physics equations? The second approach produces an algebra which has large elements, often 32 scalar values, this seems unwieldy but the the code can usually be optimised to reduce this. It is very powerful allowing not only points but whole lines and planes to be transformed (rotation+translation) in one operation. It can be used in raytracing and it seems to me to be the best candidate for calculating the physics of solid body mechanics.

So how do we formulate this in terms of Geometric Algebra? Well quaternion algebra is G+3,0,0 that is the even subalgebra generated by 3 dimensional vectors which square to +ve. (even subalgebra means we take the real and bivector parts only).

Lets take the first approach, to do this we need an algebra with a zero in the term which is the product of the translations.

We can't do this using ordinary geometric algebra based on vectors which square to positive numbers because they will always have a non-zero product term. There are several ways that I know of to do what we want:

1. G+3,0,1 - Add an extra dimension to the vector space which generates the geometric algebra. This extra dimension squares to zero, this produces the dual complex number and dual quaternion algebras.
2. G 4,1,0 - Add two extra dimensions to the vector space which generates the geometric algebra. One of these extra dimensions squares to positive and the other squares to negative, we then rotate these basis vectors so that we find the direction between squaring to +ve and -ve where it squares to zero, these is known as the null vectors.
3. G 4,0,0 or G 3,1,0 - Use projective space as explained on this page.
4. G 4,1,0 - Use conformal space as explained on this page.

An example of the first approach is G+3,0,1 (dual quaternion) which represents both the linear and rotational movement as bivectors which are associated with planes, or quantities associated with them like rotations, we would expect a linier displacement to be represented by a vector. I think this issue could be a problem if we try to formulate the physics equations in terms of dual quaternions.

The projective space and conformal space approaches, representing linier movement like rotating around a point at infinity! To do this we can either:

## Applying a multivector to a point

To calculate the rotated point from the original position of the point.

P2=m * P1 * m-1

• P1 = original position of point
• P2 = resulting position of point after transform
• m= multivector
• m-1 = inverse of m

### In 2 Dimensions

2D motors can be represented by either of the following algebras which are equivalent 'isomorphic' to each other:

#### Dual Complex Numbers

A dual whose elements are complex numbers or a complex numbers whose elements are duals, (its the same thing). Dual complex numbers are explained on this page.

#### A Geometric Algebra G 0,1,1.

That is a Geometric Algebra generated from a 2 dimensional vector space one of which squares to -ve and the other dimension which squares to zero. There is an example of how to use this on this page.

### In 3 dimensions

3D motors can be represented by either of the following algebras which are equivalent 'isomorphic' to each other:

#### Dual Quaternions

A dual whose elements are quaternions or a quaternion whose elements are duals, (its the same thing). Dual Quaternions are explained on this page.

#### A Geometric Algebra G+3,0,1.

That is a Geometric Algebra generated from a 4 dimensional vector space with 3 dimensions which square to +ve and one dimension which squares to zero. We then take the subalgebra made up of the even grade elements: scalar + 6 dimensional bivector + pseudoscalar. There is an example of how to use this on this page.

For specific information about transforms using Clifford algebras in specific spaces see the following pages:

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.      Geometric Algebra for Computer Science: An Object-oriented Approach to Geometry. This book stresses the Geometry in Geometric Algebra, although it is still very mathematically orientated. Programmers using this book will need to have a lot of mathematical knowledge. Its good to have a Geometric Algebra book aimed at computer scientists rather than physicists. There is more information about this book here.

• = outer product