








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!









Lecture 9: Vector Geometry: A Coordinate-Free Approach And ye shall know the truth, and the truth shall make you free. John 8:
1. Coordinate-Free Methods We are going to ascend now from the flat world of 2-dimensions into the real world of 3- dimensions. When working in 3-dimensions, we shall insist predominantly on coordinate-free methods. Even in 2-dimensions we adopted coordinate-free techniques to describe shapes because it is easier to represent geometry without troubling about coordinates. For example, it is simpler to describe a bump using a turtle program rather than trying to delineate the coordinates of all the vertices of the bump. Similarly, we invoke affine transformations -- translation, rotation, scaling, and shear -- to move and reshape geometry without worrying about the entries -- the coordinates -- of the corresponding matrices. Coordinates are useful for computations, but conceptually we prefer to work at a higher level of abstraction. Turtle programs and affine transformations were our entry to coordinate-free methods in 2-dimensions. In 3-dimensions coordinate-free methods are even more crucial. You may be comfortable with coordinate techniques in 2-dimensions, but in 3-dimensions it is much harder to conceptualize geometry using coordinates. In addition to allowing us to work at a higher level of abstraction, coordinate-free methods provide a more concise notation. Typically we will need to deal with only one equation for a point or a vector, rather than with three equations for their coordinates. Also we shall see that coordinate-free methods lead naturally to geometrically meaningful expressions. With coordinates we can perform senseless computations that have no intrinsic geometric significance -- for example, we could add the coordinates of two points. Coordinate-free methods will help us to avoid the pitfalls of such mindless computations. Finally, and most importantly, coordinate-free techniques capture the geometric meaning behind our computational methods. You may know that the dot product of two vectors u,v can be calculated from the formula € u • v = u 1 v 1 + u 2 v 2 + u 3 v 3 , but why would anyone ever want to compute the expression involving the rectangular coordinates on the right hand side? The geometric meaning of the dot product is captured by the coordinate- free expression € u • v =| u | | v | cos( ϑ ) , where € | u | and € | v | are the lengths of the vectors u and v , and € ϑ is the angle between u and v. Angle and length (as well as projection), these quantities are the geometric content of the dot product, content that is completely hidden in the coordinate computation.
Our approach to Computer Graphics is to simplify geometry as much as possible by invoking the Mathematics most appropriate to the problem at hand. In 2-dimensions we employ Turtle Graphics (LOGO) rooted in conformal transformations and Affine Graphics (CODO) based on affine transformations. In 3-dimensions, affine transformations along with a new transformation, perspective projection, play an even more central role. These transformations are applied to manipulate shapes in 3-dimensions, but at bottom most shapes in 3-dimensions are represented in terms of points and vectors. Therefore we begin our study of 3-dimensional Computer Graphics by introducing a coordinate-free approach to the algebra and geometry of points and vectors.
2. Vectors and Vector Spaces Vectors and vector spaces should be familiar to you from standard courses on linear algebra. Vectors can be added, subtracted, and multiplied by scalars, and these vector operations all have coordinate-free definitions (see Figure 1).
(a) addition (b) subtraction (c) scalar multiplication Figure 1: Coordinate-free geometric definitions of (a) addition, (b) subtraction, and (c) scalar multiplication for vectors. These vector operations obey the usual laws of arithmetic: addition is associative (Figure 2(a)) and commutative (Figure 2(b)) and scalar multiplication distributes through addition (Figure 2(c)). € u € w € v € u + v € v + w € u^ + ( v
w
( u
v )
w € u € u € v € v € v + u = u + v € u € c u € v € c v € u + v € c ( u + v ) (a) associative (b) commutative (c) distributive Figure 2: The associative, commutative, and distributive properties of vector addition and scalar multiplication. Vector addition is (a) associative because no matter how we group € u , v , w , if we place these vectors head to tail, the vector € u + v + w goes from the tail of u to the head of w. Vector addition is (b) commutative because € v + u , u + v both represent the diagonal of the parallelogram with sides u , v. Finally, by similar triangles, (c) scalar multiplication distributes through addition. 2
By the way the zero on the right hand side of the second equation is the zero vector, not the origin of the coordinate system. Now for a crucial observation. Notice that formally € ckPk k = 0 n ∑ = ( ck ) P 0 k = 0 n ∑ + ck ( Pk − P 0 ) k = 1 n ∑. That is, if the usual rules of arithmetic are to apply, then the terms € ck P 0 and € − ck P 0 for € k ≥ 1 should cancel. The expression € ck ( Pk − P 0 ) k = 1 n ∑ is well-defined, since this expression is just a linear combination of vectors. Moreover, the expression € ( ck ) P 0 k = 0 n ∑ is well-defined whenever the constants sum to zero or one. Based on these observations, we introduce the following definitions: € ckPk k = 0 n ∑ = P 0 + ck ( Pk − P 0 ) k = 1 n ∑ if ck = 1 k = 0 n ∑ = ck ( Pk − P 0 ) k = 1 n ∑ if ck = 0 k = 0 n ∑ = undefined if ck ≠ 0, 1 k = 0 n ∑ Expressions of the form € ∑ k ck Pk , where € ∑ k ck ≡ 1 , are called affine combinations. Affine combinations are the analogues for points of linear combinations for vectors. Vectors form a vector space; points form an affine space. Vectors are closed under linear combinations; points are closed under affine combinations. This distinction between points and vectors, between vector spaces and affine spaces, is what makes the algebra underlying Computer Graphics just a bit different from the standard algebra of vector spaces that you learn in courses on Linear Algebra.
4. Vector Products There is more to vector algebra than just addition, subtraction, and scalar multiplication. For vectors, there are also several distinct notions of multiplication: dot product, cross product, and 4
determinant. These products are related geometrically to length, area, and volume, so these products show up in many geometric applications. Here we review the coordinate-free definitions of these three products, emphasizing their major algebraic and geometric properties. 4.1 Dot Product. The dot product of two vectors u,v is the scalar defined by € u • v =| u | | v | cos( ϑ ) , where € ϑ is the angle between the vectors u and v. Dot product is commutative and distributes through addition (see Exercise 6a). We are interested in dot product because dot product can be used to compute several important geometric quantities. The following properties follow easily from the definition of the dot product. i. Length € | u | 2 = u • u ii. Cosine (Angle Between Two Vectors) € cos( ϑ ) = u • v | u | | v | iii. Orthogonality € u • v = 0 ⇔ u ⊥ v iv. Projections (see Figure 4) € u || = u • v v • v
v € u || = ( u • v ) v if € | v |= 1 € u ⊥ = u − u || = u − u • v v • v
v € u ⊥ = u − ( u • v ) v if € | v |= 1 The first three properties follow easily from the definition of the dot product. To derive the formulas for projection, notice that the second formula follows from the first formula because € u || + u ⊥ = u (see Figure 4). To prove the first formula, observe from Figure 4 that € | u || |=| u | cos( ϑ ) = | u | | v | cos( ϑ ) | v |
u • v | v | Therefore, since € u || is parallel to v , € u || =| u || | v | v |
u • v | v |
v | v |
u • v v • v
v. 5
€ v
Figure 5: The cross product of two vectors is the vector perpendicular to the two vectors with positive orientation, and has length equal to the area of the associated parallelogram. 4.3 Determinant. The determinant is the scalar defined by the triple product € det( u , v , w ) = ( u × v ) • w. The determinant inherits the properties of the dot and cross product: determinant is multi-linear (linear in each variable) and skew symmetric (interchanging the order of the two vectors changes the sign of the determinant). The main geometric property of the determinant is the relation between determinant and volume (see Figure 6). i. Volume € vol ( u , v , w ) =|det( u , v , w ) |.
Figure 6: The determinant of three vectors is the signed volume of the associated parallelepiped because € | det( u , v , w ) |=| u × v | | w | cos( ϑ ) |= area ( u , v ) • height ( u , v , w ) = vol ( u , v , w ).
5. Summary Linear Algebra provides the mathematical foundation for Computer Graphics. However, the Linear Algebra underlying Computer Graphics differs somewhat from standard Linear Algebra because the fundamental constituents of Computer Graphics -- what one actually sees on a graphics terminal -- are points, not vectors. Points, unlike vectors, cannot be combined using arbitrary linear combinations; points are restricted to affine combinations. Thus the points form an affine space, rather than a vector space. This distinction between affine spaces (spaces of points) and vector spaces (spaces of vectors) is the main difference between the mathematical foundation of 3- dimensional Computer Graphics and the standard Linear Algebra of 3-dimensional vector spaces. 7
Nevertheless, vectors play a fundamental role in Computer Graphics because most of the information in an affine space is stored in the vectors. Fix a single point Q in affine space. Then any other point P can be written as the sum of the fixed point Q and the vector € v = P − Q from Q to P -- that is, € P = Q + v = Q + ( P − Q ). Thus, for example, if we know how an affine transformation T affects the vectors v and we want to know how this transformation behaves on the points P , all we need to do is to compute the transformation on the single point Q ; the rest of the transformation is known from its effect on the vectors because €
To emphasize concepts over computation, we adopt a coordinate-free approach to vector geometry. Addition, subtraction, scalar multiplication, dot product, cross product, and determinant all have coordinate-free, geometric interpretations. These geometric properties are the main conceptual tools we will apply in our analysis of geometry for Computer Graphics. Coordinate computations are discussed in the next lecture. These coordinate computations can be implemented once and forgotten, but the geometric concepts behind these computations will be reused again and again. Appendix 1: The Non-Associativity of the Cross Product The purpose of this appendix is to derive the handy identities € (v × w) × u = (u • v)w − (u • w)v € u × ( v × w ) = ( u • w ) v − ( u • v ) w. We begin with an important special case from which the general results will follow. Lemma: € ( u × w ) × u = ( u • u ) w − ( u • w ) u Proof: To prove that two vectors are equal, we need to check that they have the same direction, orientation, and length. a. Direction. € (^ ( u^ •^ u ) w^ −^ ( u^ •^ w ) u ) •^ u^ =^ ( u •^ u )( w^ •^ u )^ −^ ( u •^ w )( u •^ u )^ =^0 (^ ( u^ •^ u ) w^ −^ ( u^ •^ w ) u ) •^ ( u^ ×^ w )^ =^ ( u^ •^ u )^ ( w^ •^ ( u^ ×^ w )) −^ ( u^ •^ w )^ ( u^ •^ ( u^ ×^ w )) =^0. Therefore € ( u • u ) w − ( u • w ) u is perpendicular both to u and to € u × w , so € ( u • u ) w − ( u • w ) u is either parallel or anti-parallel to € ( u × w ) × u. b. Orientation. € det (^) ( u × w , u , ( u • u ) w − ( u • w ) u ) = det (^) ( u , ( u • u ) w − ( u • w ) u , u × w ) = (^) ( u × {( u • u ) w − ( u • w ) u }) • ( u × w )
= ( u • u ) (^) (( u × w )• ( u × w )) = | u |^2 | u × w |^2 > 0. 8
Appendix 2: The Algebra of Points and Vectors For easy reference we collect below the main algebraic identities for addition, subtraction, scalar multiplication, dot product, cross product, and determinant. Most of these formulas either follow easily from the definitions or are derived in the text; the remainder are proved in the exercises at the end of this lecture. Addition, Subtraction, and Scalar Multiplication for Vectors € u + ( v + w ) = ( u + v ) + w (associative) € u + v = v + u (commutative) € c ( u + v ) = c u + c v (distributive) € | u + v |≤| u | + | v | (triangle inequality) Addition, Subtraction, and Affine Combinations for Points € P + ( v + w ) = ( P + v ) + w (associative) €
(cancellation) € ckPk k = 0 n ∑ = P 0 + ck ( Pk − P 0 ) k = 1 n ∑ if ck = 1 k = 0 n ∑ ( affine combinations ) = ck ( Pk − P 0 ) k = 1 n ∑ if ck = 0 k = 0 n ∑ = undefined if ck ≠ 0, 1 k = 0 n ∑ Dimensional Analysis for Points and Vectors Point + Point = Undefined Point – Point = Vector Point ± Vector = Point Vector±Vector = Vector Scalar € × Vector = Vector € ∑ Scalar × Vector = Vector € ∑ Scalar × Point = Point ∑ Scalar = 1 = Vector ∑ Scalar = 0 = Undefined Otherwise 10
Dot Product € u • v =| u | | v | cos( θ) (definition) € u • v = v • u (commutative) € u • ( v + w ) = u • v + u • w ( v + w )• u = v • u + w • u (distributive) € | v | 2 = v • v (length) € cos( θ) = u • v | u | | v | (angle) € u || = u • v v • v
v u || = ( u • v ) v if | v |= 1 (parallel projection) € u ⊥ = u − u || = u − u • v v • v
v u ⊥ = u − ( u • v ) v if | v | = 1 (perpendicular projection) € u • v = 0 ⇔ u ⊥ v (orthogonality) Cross Product € | u × v |=| u || v |sin( θ) u × v ⊥ u , v sgn( u , v , u × v ) > 0 (definition) € area ( u , v ) = | u × v | (area) € ( u × v )• u = 0 ( u × v )• v = 0 (orthogonality) € u × u = 0 u × v = 0 ⇔ v ||± u (parallelism) € u × ( v + w ) = u × v + u × w ( v + w ) × u = v × u + w × u (distributive) € u × v = − v × u (anti-commutative) € u × ( v × w ) = ( u • w ) v − ( u • v ) w ( v × w ) × u = ( u • v ) w − ( u • w ) v (non-associative) € | u × v | 2 =| u | 2 | v | 2 − ( u • v ) 2 (length) € ( u 1 × u 2 )• ( v 1 × v 2 ) = ( u 1 • v 1 )( u 2 • v 2 ) − ( u 1 • v 2 )( u 2 • v 1 ) (Lagrange Identity) 11