A Guided Tour to the Plane-Based Geometric Algebra PGA
Total Page:16
File Type:pdf, Size:1020Kb
A Guided Tour to the Plane-Based Geometric Algebra PGA Leo Dorst University of Amsterdam Version 1.15{ July 6, 2020 Planes are the primitive elements for the constructions of objects and oper- ators in Euclidean geometry. Triangulated meshes are built from them, and reflections in multiple planes are a mathematically pure way to construct Euclidean motions. A geometric algebra based on planes is therefore a natural choice to unify objects and operators for Euclidean geometry. The usual claims of `com- pleteness' of the GA approach leads us to hope that it might contain, in a single framework, all representations ever designed for Euclidean geometry - including normal vectors, directions as points at infinity, Pl¨ucker coordinates for lines, quaternions as 3D rotations around the origin, and dual quaternions for rigid body motions; and even spinors. This text provides a guided tour to this algebra of planes PGA. It indeed shows how all such computationally efficient methods are incorporated and related. We will see how the PGA elements naturally group into blocks of four coordinates in an implementation, and how this more complete under- standing of the embedding suggests some handy choices to avoid extraneous computations. In the unified PGA framework, one never switches between efficient representations for subtasks, and this obviously saves any time spent on data conversions. Relative to other treatments of PGA, this text is rather light on the mathematics. Where you see careful derivations, they involve the aspects of orientation and magnitude. These features have been neglected by authors focussing on the mathematical beauty of the projective nature of the algebra. But since orientation and magnitude are very relevant for practical usage, we must incorporate them into the framework. 1 I started this text as a replacement for Chapter 11 of the 2007 book `Ge- ometric Algebra for Computer Science', written at a time when PGA was underappreciated. At 100 pages, it has become rather more; but I do assume some familiarity with the standard geometric algebra of the chapters that came before. Even if you are totally new to GA, you will still get the main gist of the power of PGA, and that may motivate you to study the basics of general GA. Welcome to the future! Please refer to this chapter as: Leo Dorst A Guided Tour to the Plane-Based Geometric Algebra PGA 2020, version 1.15 Available at http://www.geometricalgebra.net and http://bivector.net/PGA4CS.html. 2 Contents 1 A Minimal Algebra for Euclidean Motions 6 1.1 PGA: One More Dimension Suffices . .6 1.2 How to Choose a Geometric Algebra? . .7 1.3 Playing with PGA . .9 2 Meet the Primitives of PGA 11 2.1 PGA: Planes as Vectors . 12 2.2 Intersecting Planes: 3D Lines as 2-blades . 14 2.3 Choosing an Orientation Convention . 16 2.4 Vanishing Lines: the meet of Parallel Planes . 17 2.5 3D Points as 3-blades . 17 2.6 Vanishing Points . 19 2.7 Four Planes Speak Volumes About Oriented Distances . 20 2.8 Linear Combinations of Primitives . 21 2.9 Example: Solving Linear Equations . 23 2.10 Summary . 24 3 The join in PGA 25 3.1 The Join as Dual to the Meet . 25 3.2 Constructing the PGA Join . 26 3.3 Examples of the Join . 29 3.3.1 A Line as the Join of Two Points . 29 3.3.2 Constructing a Line from a Point P and a Direction u 29 3.3.3 Constructing a Plane as the Join of Three Points . 30 3.3.4 The Join of Two Lines (and the Importance of Con- traction) . 30 3.4 Summary . 31 4 The Geometric Product and PGA Norms 32 4.1 The Geometric Product of PGA . 32 4.2 The Euclidean norm . 32 4.3 Vanishing or Infinity Norm . 33 4.4 Using Norms . 34 4.5 Summary . 35 3 5 Bundles and Pencils as Points and Lines 36 5.1 The Bundle of Planes at a Point . 36 5.2 The Geometric Product of Plane and Point . 39 5.3 Relocating Any Flat by Orthogonal Projection . 41 5.4 Projecting a Point onto a Plane . 42 5.5 The Pencil of Planes Around a Line . 43 5.6 Non-Blade Bivectors are Screws . 44 5.7 Summary . 48 6 Euclidean Motions through Planar Reflections 50 6.1 Multiple Reflection as Sandwiching . 51 6.2 One Planar Reflection . 52 6.3 Reflections in Two Planes . 55 6.4 Three Reflections; Point Reflection . 57 6.5 Four Reflections: General Euclidean Motions (Oh and Incidentally Dual Quaternions) . 58 6.6 The PGA Square Root of a Motor . 59 6.7 Example: Universal Motors . 60 6.8 Example: Reconstructing a Motor from Exact Point Correspondences . 62 6.9 Summary . 64 7 The Exponential Representation 65 7.1 Exponentiation of Invariants Gives Motions . 65 7.2 Child's Play . 67 7.3 The PGA Motor Logarithm . 69 7.4 Summary . 71 8 Oriented Euclidean Geometry 72 8.1 Ordering . 72 8.2 A Line and a Plane Meet . 74 8.3 The Join of Two Points . 75 8.4 The Meet of Two Planes . 76 8.5 The Meet of Plane and Point: Inside/Outside . 76 8.6 The Meet of Two Lines: Chirality . 76 8.7 Summary . 78 4 9 Projective Duality in PGA 79 9.1 Complement Duality and Hodge ? ................ 79 9.2 The Join by Hodge Duals . 82 9.3 Summary . 83 10 Performance Considerations 84 10.1 PGA versus CGA . 84 10.2 PGA versus LA . 84 10.3 Memory Layout . 85 10.4 Speed-up of Sandwich-like Products . 86 10.5 Inverses . 87 11 To PGA! (and Beyond...) 88 12 Exercises 89 12.1 Drills . 89 12.2 Structural Exercises . 89 5 1 A Minimal Algebra for Euclidean Motions 1.1 PGA: One More Dimension Suffices While the 3D vector space model R3 (of Chapter 10 in [1]) can nicely model directions, it is considered to be inadequate for use in 3D computer graph- ics. The reason is primarily a desire to treat points and vectors as different objects; after all, they are transformed differently by translations. Instead, graphics uses an extension of linear algebra known as `homogeneous coordi- nates', which is often described as augmenting a 3-dimensional vector v with > > coordinates (v1; v2; v3) to a 4-vector (v1; v2; v3; 1) . This extension helps to discriminate point location vectors from direction vectors, and makes non- linear operations such as translations and projective transformations imple- mentable as linear mappings. This `homogeneous model' can be described in terms of a geometric alge- bra of one more dimension, with an explicit extra basis vector. That is how we did it in the first edition of our book [1], in its Chapter 11. Then we went on to show the shortcomings of this model: for while translations become linear, they do not become rotors. That means that the great advantage of geometric algebra, namely `structure preservation of universally applicable operators', fails in this model. We then went on to Conformal Geometric Algebra (CGA), turning translations into rotors by going up 2 dimensions (rather than just 1 as in the homogeneous model) in our representational space. That worked as desired. The conformal model is indeed useful, and its inclusion of spheres and cir- cles as primitives truly makes it feel like a natural Euclidean geometry. But as has been remarked many times, we get too much: going up 2 dimensions in this manner actually lands us in a space in which the rotors are conformal transformations, rather than merely the Euclidean motions we were looking for. Viewing the 3D rigid body motions with their six degrees of freedom (dof) as special rotors in a space that allows 10-dof rotors gives implementa- tional and computational issues. It works, but one would have hoped to do Euclidean geometry of flat offset elements like lines and planes with less. And indeed, one can. Parallel to the development of CGA, Charles Gunn ∗ proposed that an algebra that he denoted R3;0;1 could have the rigid body motions precisely as its rotors, and that it should be the natural algebra for Euclidean geometry. Its useful structure had earlier been exposed by Selig [2] as the Clifford algebra of points, lines and planes. Gunn called it PGA, for 6 Projective Geometric Algebra. That name is somewhat unfortunate, since it suggests to me that it is the algebra that can generate projective transfor- mations by rotors; whereas in fact the `projective' refers to the homogeneous representation it acts on. However, as we will see, PGA is the geometric alge- bra of (hyper)planes; so if we read PGA as `Plane-Based Geometric Algebra', the moniker is fine.1 To represent translations as rotors, one needs null vectors (i.e., vectors squaring to zero, which make exponentiation produce linear terms). In CGA, there are two null vectors, and they combine to make the pseudoscalar invert- ible. In PGA, with only one null vector, the pseudoscalar is a null blade, and not invertible. It was the unconventional nature of duality in PGA that ham- pered its acceptance by the GA community (which had collectively jumped onto CGA by 2007). Rather than division by the pseudoscalar, Gunn intro- ∗ duced a J-map between Rd;0;1 (where the vectors represent hyperplanes) and its dual space Rd;0;1 (where the vectors represent points). It seemed that one needed both those spaces to make things work; and then one effectively had the same number of basis elements as the CGA model of Rd+1;1, which dual- izes more conveniently and has its round primitives like spheres and circles.