Affine TransformationsLogisticsGeometric transformationsRepresentationRepresentation, cont.Two-dimensional transformationsIdentityScalingReflectionShearEffect on unit squareEffect on unit square, cont.RotationLinear transformationsLimitations of the 2 x 2 matrixAffine transformationsHomogeneous CoordinatesHomogeneous coordinatesRotation about arbitrary pointsPoints and vectorsBarycentric coordinatesComputing barycentric coordinatesCross productsBarycentric coords from area ratiosAffine and convex combinationsBasic 3-D transformations: scalingTranslation in 3DRotation in 3DShearing in 3DPreservation of affine combinationsProperties of affine transformationsSummaryNext class: ShadingUniversity of Texas at Austin CS384G - Computer Graphics Spring 2010 Don FussellAffine TransformationsUniversity of Texas at Austin CS384G - Computer Graphics Spring 2010 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, Mathematical Elements for Computer Graphics, 2nd Ed., McGraw-Hill, New York, 1990, Chapter 2. Logistics:HW #1 handed out MondayProject #1 due on Monday, artifact on following Monday.University of Texas at Austin CS384G - Computer Graphics Spring 2010 Don Fussell 3Geometric transformationsGeometric transformations will map points in one space to points in another: (x',y',z') = f(x,y,z).These transformations can be very simple, such as scaling each coordinate, or complex, such as non-linear twists and bends.We'll focus on transformations that can be represented easily with matrix operations.We'll start in 2D...University of Texas at Austin CS384G - Computer Graphics Spring 2010 Don Fussell 4RepresentationWe can represent a point, p = (x,y), in the planeas a column vector as a row vector€ xy ⎡ ⎣ ⎢ ⎤ ⎦ ⎥€ x y[ ]University of Texas at Austin CS384G - Computer Graphics Spring 2010 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 Spring 2010 Don Fussell 6Two-dimensional transformationsHere's all you get with a 2 x 2 transformation matrix M:So:We will develop some intimacy with the elements a, b, c, d…€ ′ x ′y ⎡ ⎣ ⎢ ⎤ ⎦ ⎥=a bc d ⎡ ⎣ ⎢ ⎤ ⎦ ⎥xy ⎡ ⎣ ⎢ ⎤ ⎦ ⎥€ ′ x = ax + by ′y = cx + dyUniversity of Texas at Austin CS384G - Computer Graphics Spring 2010 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 Spring 2010 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 Spring 2010 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 Spring 2010 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 Spring 2010 Don Fussell 11Effect on unit squareLet's see how a general 2 x 2 transformation M 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 Spring 2010 Don Fussell 12Effect on unit square, cont.Observe:Origin invariant under MM can be determined just by knowing how the corners (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 Spring 2010 Don Fussell 13RotationFrom our observations of the effect on the unit square, it should be easy to write down a matrix for “rotation about the origin”:Thus€ 10 ⎡ ⎣ ⎢ ⎤ ⎦ ⎥→cos(θ)sin(θ) ⎡ ⎣ ⎢ ⎤ ⎦ ⎥01 ⎡ ⎣ ⎢ ⎤ ⎦ ⎥→−sin(θ)cos(θ) ⎡ ⎣ ⎢ ⎤ ⎦ ⎥€ MR= R(θ) =cos(θ) −sin(θ)sin(θ) cos(θ) ⎡ ⎣ ⎢ ⎤ ⎦ ⎥University of Texas at Austin CS384G - Computer Graphics Spring 2010 Don Fussell 14Linear transformationsThe unit square observations also tell us the 2x2 matrix transformation implies 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 a linear space.The transformation to this new basis (a.k.a., change of basis) is a linear transformation.€ ′ p = Mp=a bc d ⎡ ⎣ ⎢ ⎤ ⎦ ⎥xy ⎡ ⎣ ⎢ ⎤ ⎦ ⎥= u v[ ]xy ⎡ ⎣ ⎢ ⎤ ⎦ ⎥= x ⋅u + y ⋅vUniversity of Texas at Austin CS384G - Computer Graphics Spring 2010 Don Fussell 15Limitations of the 2 x 2 matrixA 2 x 2 linear transformation matrix allowsScalingRotationReflectionShearing Q: What important operation does that leave out?University of Texas at Austin CS384G - Computer Graphics Spring 2010 Don Fussell 16Affine transformationsIn order to incorporate the idea that both the basis and the origin can change, we augment the linear space u, v with an origin t.Note that while u and v are basis vectors, the origin t is a point.We call u, v, and t (basis and origin) a frame for an affine space.Then, we can represent a change of frame as:This change of frame is also known as an affine transformation.How do we write an affine transformation with matrices?€ ′ p = x ⋅u + y ⋅v + tUniversity of Texas
View Full Document