Rice COMP 360 - Affine Transformations

Unformatted text preview:

Lecture 4: Affine Transformations for Satan himself is transformed into an angel of light. 2 Corinthians 11:141. TransformationsTransformations are the lifeblood of geometry. Euclidean geometry is based on rigid motions -- translation and rotation -- transformations that preserve distances and angles. Congruent triangles are triangles where corresponding lengths and angles match.The turtle uses translation (FORWARD), rotation (TURN), and uniform scaling (RESIZE) to move about on the plane. The turtle can also apply translation (SHIFT), rotation (SPIN), and scaling (SCALE) to generate new shapes from previously defined turtle programs. These three transformations -- translation, rotation and uniform scaling -- are called conformal transformations. Conformal transformations preserve angles, but not distances. Similar triangles are triangles where corresponding angles agree, but the lengths of corresponding sides are scaled. The ability to scale is what allows the turtle to generate self-similar fractals like the Sierpinski gasket.In Computer Graphics transformations are employed to position, orient, and scale objects as well as to model shape. Much of elementary Computational Geometry and Computer Graphics is based upon an understanding of the effects of different transformations.The transformations that appear most often in 2-dimensional Computer Graphics are the affine transformations. Affine transformations are composites of four basic types of transformations: translation, rotation, scaling (uniform and non-uniform), and shear. Affine transformations do not necessarily preserve either distances or angles, but affine transformations map straight lines to straight lines and affine transformations preserve ratios of distances along straight lines. For example, affine transformations map midpoints to midpoints. In this lecture we are going to develop explicit formulas for various affine transformations; in the next lecture we will use these affine transformations as an alternative to turtle programs to model shapes for Computer Graphics.2. Conformal TransformationsAmong the most important affine transformations are the conformal transformations: translation, rotation, and uniform scaling. We shall begin our study of affine transformations by developing explicit formulas for these conformal transformations.To fix our notation, we will use upper case letters € P,Q,R,K from the middle of the alphabet to denote points and lower case letters € u,v, w,K from the end of the alphabet to denote vectors. Lowercase letters with subscripts will denote rectangular coordinates. Thus, for example, we shall write € P = (p1, p2) to denote that € (p1, p2) are the rectangular coordinates of the point P. Similarly, we shall write € v = (v1,v2) to denote that € (v1,v2) are the rectangular coordinates of the vector v. 2.1 Translation. We have already encountered translation in our study of turtle graphics (see Figure 1). To translate a point € P = (p1, p2) by a vector € w = (w1,w2), we set€ Pnew= P + w(1)or in terms of coordinates € p1new= p1+ w1p2new= p2+ w2.Vectors are unaffected by translation, so€ vnew= v.We can rewrite these equations in matrix form. Let I denote the € 2 × 2 identity matrix; then€ Pnew= P ∗ I + wvnew= v ∗ I.€ •€ P€ v€ •€ Pnew€ vnew€ w€ wFigure 1: Translation. Points are affected by translation; vectors are not affected by translation.2.2 Rotation. We also encountered rotation in turtle graphics. Recall from Lecture 1 that to rotate a vector € v = (v1,v2) through an angle € θ, we introduce the orthogonal vector € v⊥= (−v2,v1) and set € vnew= cos(θ)v + sin(θ)v⊥or equivalently in terms of coordinates€ v1new= v1cos(θ) − v2sin(θ)v2new= v1sin(θ) + v2cos(θ) .(2)Introducing the rotation matrix€ Rot(θ) =cos(θ) sin(θ)−sin(θ) cos(θ)      ,we can rewrite Equation (2) in matrix form as€ vnew= v ∗ Rot(θ) . (3)2In our study of affine geometry in the plane, we want to rotate not only vectors, but also points about other points. Since € P = Q + (P −Q), rotating a point P about another point Q through the angle € θ is equivalent to rotating the vector € P −Q through the angle € θ and then adding the resulting vector to Q (see Figure 2). Thus by Equation (3) the formula for rotating a point P about another point Q through the angle € θ is € Pnew= Q + (P −Q)∗ Rot (θ) = P ∗ Rot (θ) + Q ∗ I − Rot(θ)( ), (4)where I is again the € 2 × 2 identity matrix. Notice that if Q is the origin, then this formula reduces to€ Pnew= P ∗ Rot(θ),so € Rot(θ) is also the matrix representing rotation of points about the origin.€ •€ Q€ •€ •€ P€ Pnew€ P − Q€ θ€ (P − Q)newFigure 2: Rotation about the point Q. Since the point Q is fixed and since € P = Q + (P −Q), rotating a point P about the point Q through the angle € θ is equivalent to rotating the vector € P −Q through the angle € θ and then adding the resulting vector to Q.2.3 Uniform Scaling. Uniform scaling also appears in turtle graphics. To scale a vector € v = (v1,v2) by a factor s, we simply set€ vnew= sv(5)or in terms of coordinates€ v1new= sv1v2new= sv2. Introducing the scaling matrix€ Scale(s) =s 00 s      ,we can rewrite Equation (5) in matrix form as€ vnew= v ∗ Scale(s).3Again, in affine geometry we want not only to scale vectors, but also to scale uniformly the distance of points from a fixed point. Since € P = Q + (P −Q), scaling the distance of an arbitrary point P from a fixed point Q by the factor s is equivalent to scaling the length of the vector € P −Q by the factor s and then adding the resulting vector to Q (see Figure 3). Thus the formula for scaling the distance of an arbitrary point P from a fixed point Q by the factor s is € Pnew= Q + (P −Q)∗ Scale(s) = P ∗ Scale(s) + Q ∗ I − Scale(s)( ). (6)Notice that if Q is the origin, then this formula reduces to€ Pnew= P ∗ Scale(s),so € Scale(s) is also the matrix that represents scaling the distance of points from the origin.€ •€ Q€ •€ •€ P€ Pnew€ P −Q€ (P −Q)new € {Figure 3: Uniform


View Full Document

Rice COMP 360 - Affine Transformations

Documents in this Course
Radiosity

Radiosity

42 pages

Radiosity

Radiosity

22 pages

Load more
Download Affine Transformations
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Affine Transformations and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Affine Transformations 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?