A Powerful Tool for Solving Geometric Problems in Visual Computing
Total Page:16
File Type:pdf, Size:1020Kb
Geometric Algebra: A powerful tool for solving geometric problems in visual computing Leandro A. F. Fernandes, and Manuel M. Oliveira Instituto de Informática, UFRGS Porto Alegre, RS, Brazil Email: {laffernandes,oliveira}@inf.ufrgs.br Abstract—Geometric problems in visual computing (com- two planes is computed using a different solution than puter graphics, computer vision, and image processing) are the intersection between a line and a plane, or any other typically modeled and solved using linear algebra (LA). Thus, combination of elements. Also, each possible output must vectors are used to represent directions and points in space, while matrices are used to model transformations. LA, however, be handled on a case-by-case basis (e.g., a plane-plane presents some well-known limitations for performing geometric intersection can result in an empty set, a straight line, or computations. As a result, one often needs to aggregate dif- a plane). Alternatively, one can use Plücker coordinates to ferent formalisms (e.g., quaternions and Plücker coordinates) represent points, lines and planes as elementary types in to obtain complete solutions. Unfortunately, such extensions order to operate on them [4]. However, defining a matrix are not fully compatible among themselves, and one has to get used to jumping back and forth between formalisms, for transforming geometric elements represented by Plücker filling in the gaps between them. Geometric algebra (GA), on coordinates is not straightforward. the other hand, is a mathematical framework that naturally It is well known that, under projective geometry, matrices generalizes and integrates useful formalisms such as complex can be used to encode a sequence of projective transfor- numbers, quaternions and Plücker coordinates into a high- mations into a single representation. However, it is also level specification language for geometric operations. Due to its consistent structure, GA equations are often universal and known that matrices are not the best way to handle rotations, generally applicable. They extend the same solution to higher because they are not suitable for interpolation, and they dimensions and to all kinds of geometric elements, without encode the rotation axis and rotation angle in a costly having to handle special cases, as it happens in conventional way (i.e., they require several coefficients). In such a case, techniques. This tutorial aims at introducing the fundamental quaternions offer an alternative and efficient solution [5], concepts of GA as a powerful mathematical tool to describe and solve geometric problems in visual computing. [6]. But this extension is not automatically well-connected to other transformations in linear algebra, or to Plücker Keywords-geometric algebra; geometric computing; applied coordinates. Also, quaternions are defined only in 3-D. mathematics; Plücker coordinates; quaternion; subspaces Geometric algebra [7]–[10] provides an alternative to conventional geometric techniques based on linear algebra. I. MOTIVATION With geometric algebra one can compute directly on geo- Visual computing practitioners often use linear algebra metric elements (e.g., direction, points, lines, planes, circles, to represent geometric elements and transformations [1], [2]. and spheres) as primitives. Also, it naturally generalizes For instance, vectors represent directions and, by introducing and integrates useful frameworks such as Plücker coordi- an origin to the underlying space, they can also be used nates, quaternions and complex numbers into a high-level to represents points. But the semantic difference between a specification language for geometric operations. Because direction vector and a point vector is not encoded in the of its consistent structure, geometric algebra equations are vector type itself, and one must be aware that point vectors often universal and generally applicable, extending the same should be transformed differently than direction vectors [3]. solution to higher dimensions and to all kinds of geometric In linear algebra, geometric elements of higher dimension- elements. ality (e.g., lines and planes) must be assembled from points, Geometric algebra, however, is still mostly unknown in directions and scalar values. This way, a line in 3-D can be the computer science community. Only in the past few represented by a point and a direction vector, or by the inter- years it became accessible in specialized literature [8]–[10]. section of two planes. A plane, on the other hand, is usually This tutorial aims at providing a gentle introduction to the described by a normal vector and a distance from the origin. fundamental concepts of geometric algebra and discussing Such a representation of geometric elements prevents their its great potential as a tool for representing and solving use as computing primitives. As a result, geometric problems problems in computer graphics, computer vision, and image must be solved considering the particular type of geometric processing. object being handled. For instance, the intersection between This tutorial is organized as follows: Sections II to VI present theoretical concepts of geometric algebra. In these sections, geometric primitives, transformations, and alge- braic operations are presented in a more abstract level. For sake of simplicity, we kept the mathematical formalisms to a minimum, and illustrate the geometrical intuition with examples whenever possible. Section VII discusses how one can assume a model of geometry in order to give practical geometric interpretation to the elements discussed in previous sections. Geometric algebra implementations are enumerated in Section VIII. Section IX concludes the tutorial with some observations and directions for research opportunities involving geometric algebra. (a) (b) Figure 1. Graphical representation of subspace in R3.(a)A1-D subspace a II. ORIENTED SUBSPACES AS PRIMITIVES is drawn as an arrow, where the arrow’s length and the arrow’s tip represent, Rn respectively, the weight and the orientation of a.(b)A2-D subspace C2, By definition, a vector space consists of a set of a b { }n spanned from vectors and , is drawn as a disk. Its weight is represented elements called vectors. By assuming a basis ei i=1 for by the radius of the disk, while the orientation is the curved arrow. The n e 3 R , an arbitrary vector (i.e., a 1-D subspace) is written as basis vectors {ei}i=1 are not shown in this image for sake of clarity. a linear combination of the basis vectors. Fig. 1a illustrates 3 a vector aa=α1 e1 + α2 e2 + α3 e3 in R . In this graphical representation, the 1-D subspace is the oriented straight line In fact, k-blades are “concrete” primitives by themselves, that passes through the origin and supports the arrow. The spanned from k vectors. Therefore, one needs a new basis arrow’s length represents the weight of the subspace, while for representing k-blades, because the basis vectors from n the arrow’s tip indicates its orientation. R , by definition, support only 1-D subspaces. In geometric n In geometric algebra, a 2-D subspace is spanned as the algebra, R is the multivector space built from a vector outer product of two vectors. The outer product is formally space Rn.The2n basis elements of Rn are defined n defined in Section II-B. Fig. 1b shows a 2-D subspace as thek-combinations of vectors from the set {ei}i=1 n n n computed as: (i.e., k=0 k =2 ). A linear combination of such basis C2 =aa ∧ b,(1)elements is called a multivector. As an example, the basis of R3 is presented in Fig. 2 (top) and its multivector structure ∧ where (the wedge symbol) denotes the outer product, and is shown at the bottom. By combining zero elements out a and b are two vectors (1-D subspaces). In Fig. 1b, C2 is 3 of the set {ei}i=1, one takes the basis blade “1”for0-D the oriented supporting plane for the disk. The disk’s radius subspaces, i.e., values in R. As one would expect, the basis and the curved arrow are used to illustrate, respectively, blades for 1-D subspaces are the three basis vectors defining 2 the weight and orientation of the subspace. Note that the R3.For2-D subspaces in R3, the three basis blades are orientation of C2 respects the order of the terms in the computed by combining two elements out of the set of three outer product, i.e., from a to b. basis vectors. Finally, the outer product of all basis vectors k Using the outer product one can span -D oriented define the basis blade for 3-D subspaces. Note that blades ≤ k ≤ n 3 subspaces, for 0 . In geometric algebra, such sub- in R3 are a scaled version of the whole 3-D space. Such k spaces are called -blades (the terms blade and subspace blades are often called pseudoscalar, and the unit positive k are used interchangeably), and is said to be the grade pseudoscalar is typically denoted by: of the blade (the terms grade and dimensionality are also used interchangeably). An arbitrary blade Bk presents the In =ee1 ∧ e2 ∧···∧en.(2) following properties: The order of the vectors defining each basis blade attitude The equivalence class αBk,foranyα ∈ R. (e.g., use e1 ∧ e2 or e2 ∧ e1 for the fifth basis blade in weight The value of α in Bk = αJk,whereJk Fig. 2) is a matter of convention. Fortunately, converting is a reference blade with the same attitude between different conventions is easy, and relies on applying as Bk. the properties of the outer product. orientation The sign of the weight relative to Jk. direction The combination of attitude and orientation. B. The outer product Formally, the outer product is a mapping: A. A basis for k-D subspaces r s r+s n n n In contrast to linear algebra, geometric algebra does ∧ : R × R → R .(3) not represent k-D subspaces as a collection of k vectors.