• 沒有找到結果。

Geometric Algebra for Computer Graphics

N/A
N/A
Protected

Academic year: 2023

Share "Geometric Algebra for Computer Graphics"

Copied!
258
0
0

加載中.... (立即查看全文)

全文

I had just written a book about vectors extolling the power and benefits of the cross product, and now there were moves to banish it. I understand the operation of the algebra, but I don't have a complete picture in my mind of the 5D Minkowski space which is the background for the conformal model.

Aims and objectives of this book

Mathematics for CGI software

At this point, we've basically created another algebra with its own axioms and embellishments like [[P]]−1and[[P]]T. As you will discover, the notation of GA is quite elegant, even if the underlying algebra is finicky.

The book’s structure

Any complexity associated with GA is easily hidden within the software, allowing programmers to develop solutions using high-quality controls and commands. This chapter introduces the reader to the basic concepts, and there is a wide range of technical literature available for readers with the appropriate mathematical skills.

Introduction

Numbers, variables and arithmetic operators

Closure

Identity element

Inverse element

The associative law

The commutative law

The distributive law

Summary

It is also important to know which aspects of algebra are closed or not so that we know what to expect when calculating products. Finally, product associative algebra supports division, which is very useful for solving algebraic problems.

Introduction

Complex numbers

Complex arithmetic

In fact, it is the area of ​​the parallelogram formed by the vectors z1 and z2 as shown in the figure. Therefore, the magnitude of the imaginary part of Eq. 3.17) is the area of ​​the parallelogram formed by z1 and z2.

The complex plane

The product of two complex numbers

Powers of complex numbers

Collection of real and imaginary terms:. 3.58) which we know as the function sin and cos, so,. But in addition to elegance, it seems to have rotational properties; because if we multiply a complex number byeiπits the sign is reversed, i.e.

Logarithm of a complex number

Summary

Introduction

Gibbs's book Elements of Vector Analysis [10] was printed in two parts in 1881 and 1884, laying the foundation for a notation used today. With the support of scientists such as Oliver Heaviside, who applied vector analysis to the study of electromagnetic theory, vectors became the preferred system of the day and quaternions disappeared from the scene.

Vector quantities and their graphical representation

The orientation of a vector is defined in terms of the cosine of the angles it forms with the Cartesian axes, as shown in Figure. Readers wishing to see how vector analysis is used in computer graphics are referred to the author's book Vector Analysis for Computer Graphics [12].

Vector spaces

We start with the term vector space which is nothing but a set of elements called vectors. Generalizing this definition, Rinis the set of all ordered n-tuples, where an ordered tuple is a sequence of real numbers such as (u1,u2,. .,un), which allows us to define a vector as.

Linear combinations

Equations (4.27) and (4.28) are not compatible, since it is impossible to find the values ​​of λ and ε corresponding to them, so the vector (6, −2) cannot be expressed as a linear combination of the vectors (4, 4) and (2, 2) . ).

Spanning sets

Linear independence and dependence

Either way, one of the original vectors is redundant, which begs the question: what is the smallest number of vectors spanning a space. The answer to this question is to discover whether any of the vectors are linearly dependent on the other vectors.

Standard bases

To determine whether an embedded set is minimal or not, we need to determine whether any member of the set is a linear combination of the others. Consequently, for a set of vectors to be a minimal embedded set for a vector space V, they must be linearly independent.

Orthogonal bases

Dimension

Subspaces

Scalar product

When x = y = 0, z = 3, the first axiom is irrelevant and the other two axioms need not be investigated. Before proceeding with the vector product, we need to study two laws related to the dot product: the commutative law and the distributive law, and we also need to confirm the role of scalars.

Vector product

The vector product is also known as the cross product, which reflects the "×" symbol used as an operator.

Summary

Introduction

Although this has no undefined terms, it can be edited as follows:. and the following symmetry appears:. 5.15). Preserving the order between unit imaginaries is essential to keep the algebra consistent, which is also a property of GA.

Adding quaternions

Strictly speaking, thei,jandkare unity of ideas that obey Hamilton's rules true. 5.23) However, when vector algebra became the preferred system over quaternion algebra, the i,j and kterms became the Cartesian unit vectors i, j and k.

The quaternion product

The magnitude of a quaternion

The unit quaternion

The pure quaternion

The conjugate of a quaternion

The inverse quaternion

Quaternion algebra

Rotating vectors using quaternions

For each there is an inverse element−q and q−1 such that:. and the axis of rotation is ˆ. 5.77). It is best elaborated in two steps, and no imaginary terms are included for clarity.

Summary

Introduction

Clockwise and anticlockwise

So this is a problem if an algorithm or function is sensitive to the rotating sequence of vertices. So far, we have ignored an important convention - the fact that we are dealing with an ordered pair of coordinates.

Left and right-handed axial systems

From this we observe that starting with an ordered pair (x,y) and an axial system using horizontal (x) and vertical (y), a counter-clockwise sequence of nodes produces a positive region, otherwise a negative one. Substituting the coordinates of the field shown in Figure 6.7 into Eq. Note that relative to the axial system, the vertices follow a counterclockwise path, which, if reversed, switches the volume in a negative direction.

Summary

Introduction

Grassmann did not help matters by writing a rather dense description of his geometric calculation. In 1861 Grassmann published an updated version of his book entitled Die Ausdehnungslehre: Vollstanding und in streger Form bearbeitet, at that time he was a professor at the Stettin Gymnasium.

Foundations of geometric algebra

Because in his book he presented new ideas on vector analysis, addition and subtraction of vectors, biproduct of vectors and differentiation of vectors, all intertwined with his philosophy on pure thought and existence. But despite this academic promotion, Grassmann had to pay the costs of publishing, which covered a series of three hundred books, and he died a few years later before mathematicians realized that he had been a genius of the order of seen.

Introduction to geometric algebra

Length, area and volume

The dot product creates a non-zero scalar value when the associated vectors are not perpendicular, and tells us something about the mutual alignment of the two vectors. Grassmann interpreted the result of the vector product in terms of its ability to compute a signed area, which is why he created the outer product.

The outer product

Some algebraic properties

Even with our deficient knowledge of the bivector, it is possible to describe how the outer product responds to parallel vectors. Although the outer product is antisymmetric, it behaves the same as the scalar product when multiplying a group of vectors:.

Visualizing the outer product

The area created by a′∧bi is the same as that created by a∧b, so there is no single parallelogram that represents sa∧b—there are an infinite number. Well, that was the starting point, but now that we've discovered this outer product feature, why not substitute another shape, like a circle instead of a parallelogram, and make the area of ​​the circle equal to absinθ.

Orthogonal bases

Before we reveal the imaginary nature of the outer product in the next chapter, let us first consider the scenario shown in Figure 1. The beauty of the final product is that it works in any number of dimensions.

The outer product in action

Area of a triangle

The sequence of vertices O, B, C produces a counterclockwise outer product that takes into account the positive signs in the OBC. The sequence of vertices O, C, Creates a counter-clockwise outer product that respects the positive signs in the OCA.

The sine rule

Intersection of two lines

To find the elimination by multiplying Eq. 7.119) is that the determinants refer to the coordinates of the point we are trying to detect. However, let's go ahead and write Eq. Figure 7.16a gives a graphical interpretation of part of Eq. 7.120) where the parallelogram formed by the outer product p∧a is identical to the outer product formed by ngar∧a.

Figure 7.16a provides a graphical interpretation of part of Eq. (7.120) where the parallelogram formed by the outer product p ∧ a is identical to the outer product formed by r ∧ a
Figure 7.16a provides a graphical interpretation of part of Eq. (7.120) where the parallelogram formed by the outer product p ∧ a is identical to the outer product formed by r ∧ a

Summary

Note how∧banda∧just in the same meaning, while∧and∧ are in the opposite meaning.

Introduction

In the first part we look at vectors, bivectors (areas), pseudoscalars, multivectors and their products in an R2 context. In the second part we look at vectors, bivectors, trivectors (volumes), pseudoscalars, multivectors and their products in an R3 context.

Clifford’s definition of the geometric product

  • Orthogonal vectors
  • Linearly dependent vectors
  • Linearly independent vectors
  • The product of identical basis vectors
  • The product of orthogonal basis vectors
  • The imaginary properties of the outer product

The parallel and orthogonal components created by aa·banda∧b describe everything about the aandb vector, so Clifford combined them into his geometric product. Knowing that the geometric product is the sum of the inner and outer products, it is possible to define the inner and outer products in terms of the geometric product as follows.

The unit bivector pseudoscalar

The rotational properties of the pseudoscalar

At this point, the algebra explodes into many paths that must be explored in turn. As a simple example of the algebra in action, consider post-multiplying a vector a by the pseudoscalarIwhere.

Summary of the products

Multivectors in R 2

A multivector is defined as a linear combination of the graded elements related to the size of the linear space, which in the case of R2 are scalars, vectors and bivectors.

The relationship between bivectors, complex numbers and vectors

Reversion

Rotations in R 2

The vector-bivector product in R 2

Let us assume that there is another vectorv′ with an associated multivectorZ′i such that. which rotates the vector through an angleφtov′. Rotatev =e1 counter-clockwise 90◦in the e12 plane:. 92 Geometric Algebra for Computer Graphics. then'is the productB a'=aB. 8.97) that the vector a is rotated counterclockwise 90◦ and scaled by the magnitude of the bivectorB.

Volumes and the trivector

In fact, just as the parallelogram helped us visualize the area computing power of the bivector, the parallelepiped is just a useful object to illustrate the volumetric computing power of the trivector.

The unit trivector pseudoscalar

For example, a 2D unit bivector is defined by e1∧e2, and if any other bivector has the same sign as e1∧e2, it has the same orientation. Similarly, a trivector of 3D units is defined by e1∧e2∧e3, and if any other trivector has the same sign as e1∧e2∧e3, it has the same orientation.

The product of the unit basis vectors in R 3

The product of identical basis vectors

The product of orthogonal basis vectors

The imaginary properties of the unit bivectors

The vector-unit bivector product in R 3

The vector-bivector product in R 3

Since 12(aB+Ba) creates an object of higher degree than a bivector, it is defined using the external symbol as:. It is clear from these examples how the inner and outer products identify the two parts of the geometric product.

Unit bivector-bivector products in R 3

Unit vector-trivector product in R 3

Unit bivector-trivector product in R 3

Unit trivector-trivector product in R 3

Higher products in R 3

Blades

Duality transformation

Summary of products in R 3

The fact that each product is resolved in terms of the index of the table means that the product of two multivectors forms a closed algebra.

Multivectors in R 3

For completeness, let's form the product of two multivectors to demonstrate that we have a closed algebra. You may have noticed a distinct pattern associated with the number of elements in each multivector.

Relationship between vector algebra and geometric algebra

Since a multivector contains elements with a variety of degrees, it is useful to isolate each degree using the following notation: An, where is the required degree.

Relationship between the outer product and the cross product

Now that we have a mechanism to move between GA and the cross product, we can prove different identities in vector analysis using GA.

Relationship between geometric algebra and quaternions

The subtle difference between Table 8.10 and Table 8.11 is that, except for the diagonal, the signs are reversed, suggesting that there is a difference in the delivery of the axial systems. We can see from Tables 8.10 and 8.12 the intimate relationship between Hamiltonian imaginary and a set of left bivectors, which is elegantly described by Chris Doran and Anthony Lasenby in their book Geometric Algebra for Physicists[14].

Inverse of a vector

The strange thing is that even the greatest mathematicians can misinterpret their discoveries, and what is so ironic is that Grassmann's algebra included vectors, bivectors and quaternions and would have changed the course of mathematics if it had been adopted at the time.

The meet operation

Summary

The inner and outer product can be defined in terms of the geometric product using a·b= 1. While in R3 we have 1 scalar, three unit basis vectors, three unit bivectors and 1 unit trivector.

Introduction

Reflections

Reflecting vectors

Since the mirror's surface normal is defined as a unit vector, thenˆ2 =1, which allows us to write. and replacing the geometric product we have. It is important to note that this reflection formula assumes that the line and plane intersect at the origin.

Reflecting bivectors

130 Geometric Algebra for Computer Graphics. which, except for the minus sign, is identical to the equation for reflecting a vector. Again, it is worth examining the operation of Eq. Figure 9.5 shows a bivectorB=a∧b reflected in the plane defined by nˆ =e3.

Figure 9.5 shows a bivector B = a ∧ b reflected in the plane defined by n ˆ = e 3 .
Figure 9.5 shows a bivector B = a ∧ b reflected in the plane defined by n ˆ = e 3 .

Reflecting trivectors

Expanding the first two terms of Eq. 9.50) Equation (9.50) confirms that the sign of the trivector's reflection has switched from positive to negative, as predicted. It is possible to show that the reflection of a general trivector behaves in exactly the same way.

Rotations

  • Rotating by double reflecting
  • Rotors
  • Rotor matrix
  • Building rotors
  • Interpolating rotors

We have seen from the previous examples that the mirrors and the angle of rotation are controlled by the bivector associated with the plane perpendicular to the mirrors, so let's drop the idea of ​​mirrors and reflections and adopt the idea of ​​rotating vectors using a bivector. Remembering that the double reflection technique doubles the angle of rotation, we must compensate for this by halving the original angle:. which enables us to write the result.

Figure 9.8 shows two mirrors m and n represented by their normal vectors m ˆ and n, separated ˆ by an angle θ
Figure 9.8 shows two mirrors m and n represented by their normal vectors m ˆ and n, separated ˆ by an angle θ

Summary

Introduction

Point inside a triangle

Point inside a 2D triangle

The first outer product is negative and confirms that the point is outside the triangle. Note that the sum of the products remains constant at 15, which is twice the area of ​​the triangle.

Figure 10.2 shows the point P 0 positioned on the boundary of the triangle, which produces the following vectors and outer products:
Figure 10.2 shows the point P 0 positioned on the boundary of the triangle, which produces the following vectors and outer products:

Point inside a 3D triangle

From the table we can see that each column has consistent signs, confirming that the point is inside the triangle. Finally, let's position P0 so that it is still in the plane, but outside the boundary of the triangle.

Figure 10.8 shows the scenario with P 0 (2, 2, − 2 3 ) which is outside the triangle and generates the vectors:
Figure 10.8 shows the scenario with P 0 (2, 2, − 2 3 ) which is outside the triangle and generates the vectors:

The relationship between bivectors and direction cosines

However, if we take twice all the elements and put them in conventional order as shown in Table 10.5, this reveals the direction cosine transform. There is no need to call the double operation since the transformation comes directly from the outer products:.

Lines and planes

  • Relative orientation of a point and a line
  • Relative orientation of a point and a plane
  • Shortest distance from a point to a plane
  • A line intersecting a plane

Equation (10.56) can be used to determine the orientation of Q relative to the line, that is, whether Q is to the right or left, relative to the line's direction. The positive result confirms that the orientation of the bladev ∧(q−t) corresponds to the reference blade e1∧e2, and is to the left of the line moving from TtoP, while the value 1 represents twice the area of ​​the triangleTPQ.

Figure 10.20 shows a blade A containing two points T and Q with their respective position vectors t and q
Figure 10.20 shows a blade A containing two points T and Q with their respective position vectors t and q

Perspective projection

But before we do that, let's first explore how the outdoor product can be used to remove the backing.

Figure 10.26 shows how we would approach the problem using vectors.
Figure 10.26 shows how we would approach the problem using vectors.

Back-face removal

The sign of the projected cross product determines whether the convex polygon faces forward or backward. However, because the polygon is oriented away from the observer, the outer product v1′∧v2′ is negative and the polygon can be ignored.

Homogeneous coordinates

  • Introduction
  • Representing 2D lines in 3D homogeneous space
  • Intersection of two lines in R 2
  • Representing 3D lines in 4D homogeneous space
  • Representing lines and planes in 4D homogeneous space

Whereas, using the dual of the bivector in Eq. 10.182) Which means that the line equation for PQis. Let us now demonstrate that p∧q also encodes the vector perpendicular to the line from the origin.

Figure 10.32 shows how two homogeneous points P and Q are used to define a line using their outer product p h ∧ q h
Figure 10.32 shows how two homogeneous points P and Q are used to define a line using their outer product p h ∧ q h

Summary

Introduction

Spatial dimension

Algebraic underpinning

Mathematical language and notation

Protection

Stereographic projection

Signatures and null vectors

The basis blades for the conformal model

Representing geometric objects

Points

Point pair

Lines

Circles

Planes

Spheres

Conformal transformations

Translations

Rotations

Dilations

Reflections

Intersections

Summary

Introduction

Scale transform

Refraction transform

Rigid-body pose control

Ray tracing

Summary

Introduction

Programming implications

Programming tools

Summary

數據

Figure 6.5a shows a right-handed system of axes, where using one’s right-hand, the thumb aligns with the x-axis, the first-finger with the y-axis, and middle finger with the z-axis
Figure 7.16a provides a graphical interpretation of part of Eq. (7.120) where the parallelogram formed by the outer product p ∧ a is identical to the outer product formed by r ∧ a
Table 8.1 summarizes the products we have encountered so far.
Figure 8.11 shows an extra vector b which is orthogonal to a  and also lies in the plane B
+7

參考文獻

相關文件

396 confidence interval for the difference in two population proportions and P.490 the steps for a z-test for the difference in two proportions 虛無假設:使用網路為主要訊息來源的人18-29歲與50歲以上比例相同 對立假設: