Transformations. Chapter D Transformations Translation

Similar documents
Two conventions for coordinate systems. Left-Hand vs Right-Hand. x z. Which is which?

( ) ( ) ( ) ( ) TNM046: Datorgrafik. Transformations. Linear Algebra. Linear Algebra. Sasan Gooran VT Transposition. Scalar (dot) product:

COMP 175 COMPUTER GRAPHICS. Lecture 04: Transform 1. COMP 175: Computer Graphics February 9, Erik Anderson 04 Transform 1

2D Geometric Transformations. (Chapter 5 in FVD)

There are five types of transformation that we will be dealing with in this section:

University of Alabama Department of Physics and Astronomy. PH 125 / LeClair Spring A Short Math Guide. Cartesian (x, y) Polar (r, θ)

Computer Graphics: 2D Transformations. Course Website:

Dealing with Rotating Coordinate Systems Physics 321. (Eq.1)

Properties of Transformations

STEP Support Programme. STEP 2 Matrices Topic Notes

9. TRANSFORMING TOOL #2 (the Multiplication Property of Equality)

Numerical Methods for Inverse Kinematics

Section 1.2 A Catalog of Essential Functions

Exam 1 Review SOLUTIONS

Epsilon Delta proofs

If the pull is downward (Fig. 1), we want C to point into the page. If the pull is upward (Fig. 2), we want C to point out of the page.

Section 1.2 A Catalog of Essential Functions

The Cross Product The cross product of v = (v 1,v 2,v 3 ) and w = (w 1,w 2,w 3 ) is

C. Finding roots of trinomials: 1st Example: x 2 5x = 14 x 2 5x 14 = 0 (x 7)(x + 2) = 0 Answer: x = 7 or x = -2

AP Calculus AB Summer Assignment

Performing well in calculus is impossible without a solid algebra foundation. Many calculus

The choice of origin, axes, and length is completely arbitrary.

6.5 Trigonometric Equations

31. TRANSFORMING TOOL #2 (the Multiplication Property of Equality)

Chapter 8. Rigid transformations

The notes cover linear operators and discuss linear independence of functions (Boas ).

CS 378: Computer Game Technology

AP Calculus AB Summer Assignment

Example: Inverted pendulum on cart

Section 1.8/1.9. Linear Transformations

By definition, a translation is applied to a point or set of points. Intuitively, when you translate

Name These exercises cover topics from Algebra I and Algebra II. Complete each question the best you can.

3.3.1 Linear functions yet again and dot product In 2D, a homogenous linear scalar function takes the general form:

Daily Lessons and Assessments for AP* Calculus AB, A Complete Course Page 584 Mark Sparks 2012

Troy High School AP Calculus Summer Packet

SECTION 6.3: VECTORS IN THE PLANE

Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems. Three-Dimensional Coordinate Systems

MATRIX TRANSFORMATIONS

4.1 Distance and Length

Vector Geometry. Chapter 5

we must pay attention to the role of the coordinate system w.r.t. which we perform a tform

Mathematics for Graphics and Vision

CHAPTER 4 Stress Transformation

Example: Inverted pendulum on cart

ACCESS TO SCIENCE, ENGINEERING AND AGRICULTURE: MATHEMATICS 1 MATH00030 SEMESTER / Functions

Understanding Part 2 of The Fundamental Theorem of Calculus

Introduction to Determinants

A VERY BRIEF LINEAR ALGEBRA REVIEW for MAP 5485 Introduction to Mathematical Biophysics Fall 2010

Partial Fractions. June 27, In this section, we will learn to integrate another class of functions: the rational functions.

One Solution Two Solutions Three Solutions Four Solutions. Since both equations equal y we can set them equal Combine like terms Factor Solve for x

the Cartesian coordinate system (which we normally use), in which we characterize points by two coordinates (x, y) and

20 Torque & Circular Motion

(x 3)(x + 5) = (x 3)(x 1) = x + 5

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2011 Lecture 11 September 29, 2011

COORDINATE TRANSFORMATIONS IN CLASSICAL FIELD THEORY

5.4 Continuity: Preliminary Notions

CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer

ENR202 Mechanics of Materials Lecture 12B Slides and Notes

Algebra Concepts Equation Solving Flow Chart Page 1 of 6. How Do I Solve This Equation?

Notes 3.2: Properties of Limits

Rigid Body Transforms-3D. J.C. Dill transforms3d 27Jan99

Example 25: Determine the moment M AB produced by force F in Figure which tends to rotate the rod about the AB axis.

3D Coordinate Transformations. Tuesday September 8 th 2015

Mathematics Trigonometry: Unit Circle

Problem 1: (3 points) Recall that the dot product of two vectors in R 3 is

Strain Transformation and Rosette Gage Theory

(arrows denote positive direction)

Final Review Sheet. B = (1, 1 + 3x, 1 + x 2 ) then 2 + 3x + 6x 2

CSE 167: Introduction to Computer Graphics Lecture #2: Linear Algebra Primer

A Tutorial on Euler Angles and Quaternions

MITOCW ocw-18_02-f07-lec02_220k

A summary of factoring methods

BASIC NOTIONS. x + y = 1 3, 3x 5y + z = A + 3B,C + 2D, DC are not defined. A + C =

11.4 Polar Coordinates

2018 Fall 2210Q Section 013 Midterm Exam I Solution

Study Resources For Algebra I. Unit 2A Graphs of Quadratic Functions

Physics 8 Wednesday, October 25, 2017

Notes: Vectors and Scalars

MODEL ANSWERS TO HWK #1

15. Eigenvalues, Eigenvectors

Physically Based Rendering ( ) Geometry and Transformations

Ishik University / Sulaimani Architecture Department Structure ARCH 214 Chapter -4- Force System Resultant

All parabolas through three non-collinear points

LAB 9: EQUILIBRIUM OF NON-PARALLEL FORCES

Midterm 1 Review. Distance = (x 1 x 0 ) 2 + (y 1 y 0 ) 2.

Chapter 2 Analysis of Graphs of Functions

Lecture 6, September 1, 2017

Chapter 8: Polar Coordinates and Vectors

we must pay attention to the role of the coordinate system w.r.t. which we perform a tform

Section 13.4 The Cross Product

Matrices and Deformation

Section 5.4 The Other Trigonometric Functions

On Range and Reflecting Functions About the Line y = mx

A = 3 B = A 1 1 matrix is the same as a number or scalar, 3 = [3].

Matrix-Vector Products and the Matrix Equation Ax = b

Vectors Part 2: Three Dimensions

ISOMETRIES OF THE PLANE AND COMPLEX NUMBERS. y in R 2 is (

MATH 100 REVIEW PACKAGE

Algebra 8.6 Simple Equations

Mathematics 309 Conic sections and their applicationsn. Chapter 2. Quadric figures. ai,j x i x j + b i x i + c =0. 1. Coordinate changes

Transcription:

Chapter 4 Transformations Transformations between arbitrary vector spaces, especially linear transformations, are usually studied in a linear algebra class. Here, we focus our attention to transformation in R 2 or R 3. The transformation we look at are transformations which are used to move the objects in a scene around as well as change the appearance of the object a little bit. The most common transformations are translations, scaling, rotation, reflections and shear transformations. We will of course look at combinations of these transformations as well. Whenever possible, we will try to epress these transformations as a matri operation. In other words, given a vector X, we would like to be able to transform it using an operation of the form AX where X is a matri. This way, we can use all the theory about matrices to these transformations. For eample, combining transformations will amount to multiply their corresponding matrices. Applying a transformation to undo what a previous transformation did will simply be a matter of using the inverse of the matri of that first transformation. However, we will see that this is not always easy to do. In the process, we will have to introduce homogeneous coordinates. 4. 2-D Transformations Given a point [ y] in R 2, we study various transformations of this point. Let [ y ] be the coordinates of the transformed point. 4.. Translation We can translate points to new positions by adding the translation amounts to the coordinates. In other words, for each point P (, y) to be moved d units in the direction and d y units in the y direction to the new point P (,y ),we 29

30 CHAPTER 4. TRANSFORMATIONS can write = + d (4.) y = y + d y Or, if we define the column vectors OP = OP = T = [ ] y [ ] y [ d d y ] (4.2) Then, equation 4. can be epressed as OP = OP + T (4.3) If we want to translate an entire object, we could apply 4. to all the points of the object. However, this is not realistic and not necessary. It is enough to apply the transformation to the points which define the object, then redraw the object. This will also be true for the other two transformations. For eample, to move a line, we only need to move the endpoints of the line and redraw it. You will note that translations do not change the shape of the object. 4..2 Scaling Points can be stretched along the -ais and the y-ais by the multiplication: = s (4.4) y = s y y This can be epressed in matri form as [ ] [ ][ ] s 0 y = 0 s y y [ ] s 0 The matri will be called S. In the case s 0 s = s y,wehaveauniform y scaling. Otherwise, we have a differential scaling. To scale an object, we would scale the points defining the object, then redraw the object. When scaling objects, it is important to remember the following:. If the scaling is differential, the proportions of the object will be changed. 2. Scaling is about the origin. That is, not only the object changes size, but its distance to the origin also changes.

4.. 2-D TRANSFORMATIONS 3 Figure 4.: Rotation About the Origin 4..3 Rotation Points can be rotated about the origin as shown on figure 4.. Since the rotation is about the origin, the distance between the point and the origin will not change. In other words, OP = OP. We can epress this rotation mathematically. Using the notation of figure 4., we have: For the new point, P,wehave: = r cos φ (4.5) y = r sin φ = r cos (θ + φ) =r cos θ cos φ r sin θ sin φ (4.6) y = r sin (θ + φ) =r sin θ cos φ + r sin φ cos θ Substituting equation 4.5 into equation 4.6 gives = cos θ y sin θ (4.7) y = sin θ + y cos θ This can be epressed in matri notation by [ ] [ cos θ sin θ y = sin θ cos θ [ ] cos θ sin θ The matri will be called R. sin θ cos θ ][ ] y (4.8)

32 CHAPTER 4. TRANSFORMATIONS It is important to emphasize the fact that equation 4.8 describes a rotation about the origin. If the rotation is about another point, we must use a different technique (see problems). 4.2 Homogeneous Coordinates in 2D Both scaling and rotation can be epressed as matri multiplication. Translation is not. This is a problem for several reasons. First, for uniformity, we would like to be able to represent the three transformations the same way. Also, we remember from linear algebra that when a transformation is epressed by matri multiplication, combining several transformations is simply a matter of multiplying the matrices of the transformations. This makes combining transformations very easy. Since most transformations are a combination of the three basic transformations described above, we would like to be able to do the same. This can be done if points are epressed in homogeneous coordinates. In homogeneous coordinates, the point P (, y) is represented as (wx, wy, w) for any scale factor w 0. In what follows, we will use w =. Therefore, the point P (, y) will be represented by (, y, ) in homogeneous coordinates. This may seem at first not necessary and arbitrary. However, thanks to homogeneous coordinates, we can now represent all the transformations studied above as a matri multiplication. 4.2. Translation The translations which transforms the point P (, y, ) into P (,y, ) can be epressed by y = 0 d 0 d y y (4.9) We can see that this matri equation is equivalent to equation 4.. We might epect that the transformation which takes P back to P is the translation whose matri is given by 0 d 0 d y (why?). Wedonothave to guess any more. We can solve this mathematically. If y = 0 d 0 d y y then y = 0 d 0 d y y

4.2. HOMOGENEOUS COORDINATES IN 2D 33 and 0 d 0 d y = 0 d 0 d y. Also, we might epect that if P (,y ) is obtained from P (, y) using the translation [ ] d dy and P (,y ) is obtained from P using the translation [ d d, y] then P is obtained from P using the translation [ d +d d y +d. Again, we can verify y] this mathematically. If y = 0 d 0 d y y and Then y = y = = 0 d 0 d y 0 d 0 d y 0 d + d 0 d y + d y y 0 d 0 d y y y 4.2.2 Scaling The scaling operation which transforms the point P (, y, ) into P (,y, ) can be epressed by y = s 0 0 0 s y 0 y (4.0) We can see that this is equivalent to equation 4.4. We might suspect that the scaling operation transforming P back to P 0 0 s would be given by 0 s y 0. This can be verified mathematically. If y = s 0 0 0 s y 0 y then y = s 0 0 0 s y 0 y

34 CHAPTER 4. TRANSFORMATIONS and s 0 0 0 0 s 0 s y 0 = 0 s y 0. Also, we might epect that if P (,y ) is obtained from P (, y) using the scaling s 0 0 0 s y 0 and P (,y ) is obtained from P using the scaling s 0 0 s s 0 s y 0, then P 0 0 is obtained from P using the scaling 0 s y s y 0. Again, we can verify this mathematically. If y = s 0 0 0 s y 0 y and Then y = y = = s 0 0 0 s y 0 s 0 0 0 s y 0 s s 0 0 0 s y s y 0 y s 0 0 0 s y 0 y y 4.2.3 Rotation The rotation which transforms the point P (, y, ) into P (,y, ) can be epressed by cos θ sin θ 0 y = sin θ cos θ 0 y cos θ sin θ 0 If we call R (θ) = sin θ cos θ 0, then we see that P = R (θ) P. 4.2.4 Shear Transformations A shear is something that pushes things sideways either in the or y direction. A shear in the direction would tilt the vertical ais as shown on figure 4.2. The matri of a shear transformation which tilts the vertical ais clockwise by

4.2. HOMOGENEOUS COORDINATES IN 2D 35 Figure 4.2: Shear in the direction an angle θ will be given by the matri tanθ 0 0 0 The matri of a shear transformation which tilts the horizontal ais clockwise by an angle θ willbegivenbythematri 0 0 tan θ 0 It should also be noticed that shear transformations are about the origin. If the part of the object which is not tilted is not on one of the aes, it will also slide. To avoid this, we will need to do a translation first. Figure 4.2 shows that not only the vertical sides of the square were tilted, the square also slid to the right. This would not have happened if the base of the square had been on the -ais. 4.2.5 Reflection We can reflect aroundeither of the coordinate ais. The matri which reflects around the y-ais is 0 0 0 0. The matri which reflects around the

36 CHAPTER 4. TRANSFORMATIONS -ais is 0 0 0 0. 4.2.6 Conclusion What we gain with homogeneous coordinates is that the three transformations can be epressed as matri multiplication. Combining these transformation is simply a matter of multiplying matrices. Reversing these transformation is simply a matter on inverting their corresponding matrices. Suppose we have a sequence of points P 0,P,..., P n such that P i = M i P i for i =, 2..., n, where M i is one of the above matrices. Then, the transformation which takes P 0 to P n is simply M i M i...m. 4.3 Practice Problems. Prove that to translate a line, it is not necessary to translate the whole line but just the two endpoints, then redraw the line. 2. Eplain what transformations you would use to decrease the size of a square by half so that its lower left corner remains in the same position. Write the matri for each transformation involved as well as the resulting matri. 3. Eplain what transformations you would use to rotate a square 30 about its lower left corner, about its center. Write the matri for each transformation involved as well as the resulting matri. 4. Eplain what transformations you would use to rotate a square 30 about its center. Write the matri for each transformation involved as well as the resulting matri. 5. Prove that if P = R ( θ ) P and P = R (θ) P, then P = R ( θ + θ ) P. 4.4 3-D Transformations We cover the basic transformations: translation, scaling and rotation. As in 2D, we will use homogeneous coordinates. That is, we will add a fourth coordinate to each point. Thus, the point of coordinates (, y, z) will become (, y, z, ). In 3D, there are two possible coordinate systems: the right-handed coordinate system and the left-handed coordinate system. To picture these coordinate systems, imagine holding your hand perpendicular to your arm, your thumb pointing upward. In a right-handed coordinate system,the y-ais is your right arm, the -ais is your fingers and the z-aisisyourthumb. Aleft-handed coordinate system is similar, but from your left arm instead. By convention, right-handed systems are the standard in mathematics.

4.4. 3-D TRANSFORMATIONS 37 4.4. Translation Because we are using homogeneous coordinates, we can represent a translation as a matri product. More precisely, if the original point is V (, y, z, ), and the transformed point is V (,y,z, ), and if the translation is T units in the direction, T y unitsinthey direction and T z units in the z direction, then we should have = + T y = y + T y (4.) z = z + T z This can be represented by the matri product where and T = V = TV (4.2) V = V = y z y z 0 0 T 0 0 T y T z 0 The reader will verify that equation 4.2 gives us equation 4.. The reader will also verify that T is obtained from T by negating T, T y and T z. (See problems at the end of the document). 4.4.2 Scaling As in 2D, scaling is a transformation of the form = S y = ys y (4.3) z = zs z It can be represented by the matri product where S = V = SV (4.4) S 0 0 0 0 S y 0 0 0 0 S z 0 0

38 CHAPTER 4. TRANSFORMATIONS The reader will verify that equation 4.4 gives us equation 4.3. The reader will also verify that S is obtained from S by taking the reciprocal of S, S y and S z. 4.4.3 Rotation While the other two transformations are very similar to their 2D counterpart, rotation in 3D is somewhat more complicated. There are more possible aes of rotation. In this section, we will only consider rotations about one of the coordinate aes.. If we rotate about the -ais, counterclockwise (looking along the -ais towards the origin), this will only change the y and z coordinates. The rotation matri, R, will be like the 2D rotation matri with no operation on. R = 0 0 0 0 cosθ sin θ 0 0 sinθ cos θ 0 0 2. Similarly, if we rotate about the y-ais, counterclockwise (looking along the y-ais towards the origin), this will only change the and the z coordinates. The rotation matri, R y, will be: R y = cos θ 0 sin θ 0 0 0 0 sin θ 0 cos θ 0 0 3. Finally, if we rotate about the z-ais, counterclockwise (looking along the z-ais towards the origin), this will only change the and y coordinates. Therotationmatri,R z,willbe: R z = cos θ sin θ 0 0 sin θ cos θ 0 0 0 0 You will notice that in R y, the minus sign is in a different place, this is not an error. The reader can work out the details to see that this is indeed the case. The inverse of these rotation matrices is obtained by negating the angle of rotation. This produces the transpose of the matri. In other words, we have R = R T (4.5) Ry = Ry T Rz = Rz T

4.5. PRACTICE PROBLEMS 39 You may ask yourself why we need to know this since the two matrices are the same. It is much easier and faster to find the transpose of a matri than its inverse. Though R = R T, a computer will find R T much faster than it will find R. in addition, because of the algorithms used, the computation of R is more likely to introduce a small error. 4.4.4 Final Remarks Like in 2D, scaling is done with respect to the origin. If an object is away from the origin, scaling it will also cause it to move. If the scaling must be done so that a point must not move, then the object has to be translated first so that the point which must not move is at the origin. After the scaling, the object has to be translated back. If a rotation must be made around an ais parallel to one of the coordinate aes, the object must be translated first so that the ais of rotation becomes the coordinate ais to which it is parallel. After the object has been rotated, it must be translated back. All the described transformations are pointwise transformations. Because they are also affine transformations (they preserve parallel lines), we can transform objects which are made of line segments by transforming the points, then redrawing the line segments between the new points. 4.5 Practice Problems. Go over the worksheet tran3d.mws. 2. Eplain why T is obtained from T by negating T, T y and T z. Then, prove it mathematically. 3. Prove equation??. 4. Consider the cube whose vertices are (,, ), (2,, ), (2, 2, ), (, 2, ) for the bottom part and (,, 2), (2,, 2), (2, 2, 2), (, 2, 2) for the top part. Develop a Maple worksheet which does the following: (a) Plot the original cube. (b) Performs a translation by (2,, 3) on the cube. Plot the original cube as well as its transformed version. (c) Rescale the original cube by (2, 2, 3). (d) Rescale the original cube by (2, 2, 3) so that the point (,, ) does not move. (e) Rotate the original cube around an ais parallel to the z-ais, through (,, ) by 30 degrees. Plot the original cube as well as its transformed version.

40 CHAPTER 4. TRANSFORMATIONS (f) You will call your worksheet transform3d.mws.