University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don FussellAffine TransformationsUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 2LogisticsRequired reading:Watt, Section 1.1.Further reading:Foley, et al, Chapter 5.1-5.5.David F. Rogers and J. Alan Adams, MathematicalElements for Computer Graphics, 2nd Ed., McGraw-Hill, New York, 1990, Chapter 2.Logistics:HW #1 handed out todayProject #1 due on Tuesday, artifact on followingMonday.University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 3Geometric transformationsGeometric transformations will map points in onespace to points in another: (x',y',z') = f(x,y,z).These transformations can be very simple, such asscaling each coordinate, or complex, such as non-linear twists and bends.We'll focus on transformations that can berepresented easily with matrix operations.We'll start in 2D...University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 4RepresentationWe can represent a point, p = (x,y), in the planeas a column vectoras a row vector! xy" # $ % & ' ! x y[ ]University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 5Representation, cont.We can represent a 2-D transformation M by a matrixIf p is a column vector, M goes on the left:If p is a row vector, MT goes on the right:We will use column vectors.! " p = pMT" x " y [ ]= x y[ ]a cb d# $ % & ' ( ! " p = Mp" x " y # $ % & ' ( =a bc d# $ % & ' ( xy# $ % & ' ( ! M =a bc d" # $ % & 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 6Two-dimensional transformationsHere's all you get with a 2 x 2 transformationmatrix M:So:We will develop some intimacy with theelements a, b, c, d…! " x " y # $ % & ' ( =a bc d# $ % & ' ( xy# $ % & ' ( ! " x = ax + by" y = cx + dyUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 7IdentitySuppose we choose a=d=1, b=c=0:Gives the identity matrix: Doesn't move the points at all! 1 00 1" # $ % & 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 8ScalingSuppose b=c=0, but let a and d take on any positive value:Gives a scaling matrix:Provides differential (non-uniform) scaling in x and y:! a 00 d" # $ % & ' ! " x = ax" y = dy! 2 00 2" # $ % & ' ! 1 2 00 2" # $ % & 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 9ReflectionSuppose b=c=0, but let either a or d go negative.Examples:! "1 00 1# $ % & ' ( ! 1 00 "1# $ % & ' (University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 10ShearNow leave a=d=1 and experiment with bThe matrixgives:! 1 b0 1" # $ % & ' ! " x = x + by" y = y! 1 10 1" # $ % & 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 11Effect on unit squareLet's see how a general 2 x 2 transformationM affects the unit square:! a bc d" # $ % & ' p q r s[ ]=( p ( q ( r ( s [ ]a bc d" # $ % & ' 0 1 1 00 0 1 1" # $ % & ' =0 a a + b b0 c c + d d" # $ % & 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 12Effect on unit square, cont.Observe:Origin invariant under MM can be determined just by knowing how thecorners (1,0) and (0,1) are mappeda and d give x- and y-scalingb and c give x- and y-shearingUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 13RotationFrom our observations of the effect on the unit square, itshould be easy to write down a matrix for “rotation aboutthe origin”:Thus! 10" # $ % & ' (cos())sin())" # $ % & ' 01" # $ % & ' (*sin())cos())" # $ % & ' ! MR= R(") =cos(") #sin(")sin(") cos(")$ % & ' ( )University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 14Linear transformationsThe unit square observations also tell us the 2x2 matrix transformationimplies that we are representing a point in a new coordinate system:where u=[a c]T and v=[b d]T are vectors that define a new basis for alinear space.The transformation to this new basis (a.k.a., change of basis) is alinear transformation.! " p = Mp=a bc d# $ % & ' ( xy# $ % & ' ( = u v[ ]xy# $ % & ' ( = x ) u + y ) vUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 15Limitations of the 2 x 2 matrixA 2 x 2 linear transformation matrix allowsScalingRotationReflectionShearing Q: What important operation does thatleave out?University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 16Affine transformationsIn order to incorporate the idea that both the basis and theorigin can change, we augment the linear space u, v withan origin t.Note that while u and v are basis vectors, the origin t is apoint.We call u, v, and t (basis and origin) a frame for an affinespace.Then, we can represent a change of frame as:This change of frame is also known as an affinetransformation.How do we write an affine transformation with matrices?! " p = x # u + y # v + tUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 17Homogeneous CoordinatesTo represent transformations among affine frames, we can loft theproblem up into 3-space, adding a third component to every point:Note that [a c 0]T and [b d 0]T represent vectors and[tx ty 1]T, [x y 1]T and [x' y' 1]T represent points.! " p = Mp=a b txc d ty0 0 1# $ % % % & ' ( ( ( xy1# $ % % % & ' ( ( ( = u v t[ ]xy1# $ % % % & ' ( ( ( = x ) u + y ) v + 1) tUniversity of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 18Homogeneous coordinatesThis allows us to perform translation as well as the lineartransformations as a matrix operation:! " p = MTp" x " y 1# $ % % % & ' ( ( ( =1 0 tx0 1 ty0 0 1# $ % % % & ' ( ( ( xy1# $ % % % & ' ( ( ( " x = x + tx" y = y + ty! 1 0 10 1 1 20 0 1" # $ $ $ % & ' ' 'University of Texas at Austin CS384G - Computer Graphics Fall 2008 Don Fussell 19Rotation about arbitrary points1. Translate q to origin2. Rotate3. Translate backLine up the matrices for these step in right to left order and multiply.Note: Transformation order is important!!Until now, we have …
View Full Document