MODULE - 7. Subject: Computer Science. Module: Other 2D Transformations. Module No: CS/CGV/7

Similar documents

Drill Exercise - 1. Drill Exercise - 2. Drill Exercise - 3

Drill Exercise - 1. Drill Exercise - 2. Drill Exercise - 3

UNIT 2 2D TRANSFORMATIONS

Translations SLIDE. Example: If you want to move a figure 5 units to the left and 3 units up we would say (x, y) (x-5, y+3).

Chapter 5. Transforming Shapes

Mathematics (

If three points A (h, 0), P (a, b) and B (0, k) lie on a line, show that: a b 1.

Review for Mastery Using Graphs and Tables to Solve Linear Systems

CSE328 Fundamentals of Computer Graphics

UNIT 5: Transformations

MODULE - 4. e-pg Pathshala

CSE528 Computer Graphics: Theory, Algorithms, and Applications

Section 10.1 Polar Coordinates

Reflections, Translations, and Dilations

S56 (5.3) Higher Straight Line.notebook June 22, 2015

Computer Graphics. Chapter 5 Geometric Transformations. Somsak Walairacht, Computer Engineering, KMITL

Basics of Computational Geometry

Homework Questions 1 Gradient of a Line using y=mx+c

MATHEMATICS 105 Plane Trigonometry

Graphics and Interaction Transformation geometry and homogeneous coordinates

COMP30019 Graphics and Interaction Transformation geometry and homogeneous coordinates

Computer Graphics: Geometric Transformations

Module 2 Test Study Guide. Type of Transformation (translation, reflection, rotation, or none-of-theabove). Be as specific as possible.

THREE DIMENSIONAL GEOMETRY

CHAPTER 2 REVIEW COORDINATE GEOMETRY MATH Warm-Up: See Solved Homework questions. 2.2 Cartesian coordinate system

Computer Graphics Hands-on

The x-intercept can be found by setting y = 0 and solving for x: 16 3, 0

STRAIGHT LINES. 2) The coordinates of the join of trisection of the points (-2,3), (3,-1) nearer to (-2,3) is

Vector Algebra Transformations. Lecture 4

Chapter 2: Transformations. Chapter 2 Transformations Page 1

MATRIX REVIEW PROBLEMS: Our matrix test will be on Friday May 23rd. Here are some problems to help you review.

Objectives. Cabri Jr. Tools

Multivariable Calculus

We have already studied equations of the line. There are several forms:

notes13.1inclass May 01, 2015

(Refer Slide Time: 00:04:20)

STRAIGHT LINE GRAPHS THE COORDINATES OF A POINT. The coordinates of any point are written as an ordered pair (x, y)

Section 4.1: Introduction to Trigonometry

Problems of Plane analytic geometry

We have already studied equations of the line. There are several forms:

Matrices. Chapter Matrix A Mathematical Definition Matrix Dimensions and Notation

2.1 Transforming Linear Functions

Focus Questions How does the new shape compare to the old shape? How do the coordinates of the new shape compare to the coordinates of the old shape?

transformation: alters the equation and any combination of the location, shape, and orientation of the graph

VERIFYING PROPERTIES OF GEOMETRIC FIGURES. Ad is a median

Section 6.2 Graphs of the Other Trig Functions

Intro. To Graphing Linear Equations

Transforms. COMP 575/770 Spring 2013

Viewing with Computers (OpenGL)

Finite Element Analysis Prof. Dr. B. N. Rao Department of Civil Engineering Indian Institute of Technology, Madras. Lecture - 24

Three-Dimensional Coordinate Systems

In this section, we will study the following topics:

Pre-Image Rotation Rotational Symmetry Symmetry. EOC Review

Algebra I Notes Absolute Value Functions Unit 04c

MATH DICTIONARY. Number Sense. Number Families. Operations. Counting (Natural) Numbers The numbers we say when we count. Example: {0, 1, 2, 3, 4 }

This assignment is due the first day of school. Name:

Geometric transformations assign a point to a point, so it is a point valued function of points. Geometric transformation may destroy the equation

1.1 Functions. Cartesian Coordinate System

Review Exercise. 1. Determine vector and parametric equations of the plane that contains the

Lecture 5 2D Transformation

SYSTEMS OF LINEAR EQUATIONS

Unit 7. Transformations

Section A1: Gradients of straight lines

What and Why Transformations?

Hello, welcome to the video lecture series on Digital Image Processing. So in today's lecture

Section III: TRANSFORMATIONS

Unit 12 Topics in Analytic Geometry - Classwork

THE VIEWING TRANSFORMATION

Transformations. Name: Period:

B ABC is mapped into A'B'C'

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

2D and 3D Transformations AUI Course Denbigh Starkey

12 - THREE DIMENSIONAL GEOMETRY Page 1 ( Answers at the end of all questions ) = 2. ( d ) - 3. ^i - 2. ^j c 3. ( d )

B ABC is mapped into A'B'C'

8. The triangle is rotated around point D to create a new triangle. This looks like a rigid transformation.

August 3 - August 31

2D and 3D Coordinate Systems and Transformations

Unit 1, Lesson 1: Moving in the Plane

B ABC is mapped into A'B'C'

Section 12.1 Translations and Rotations

Lecture 4: Transforms. Computer Graphics CMU /15-662, Fall 2016

A function: A mathematical relationship between two variables (x and y), where every input value (usually x) has one output value (usually y)

An angle that has a measure less than a right angle.

Birkdale High School - Higher Scheme of Work

GEOMETRIC MOVEMENTS IN A PLANE

1.8 Coordinate Geometry. Copyright Cengage Learning. All rights reserved.

Handout 1: Viewing an Animation

2D Geometric Transformations and Matrices

Buds Public School, Dubai

Lecture 4. If P1(x1,y1) and P2(x2,y2) are points on a non-vertical line, then the slope m of the line is defined by

Game Engineering: 2D

L2 Translations, Reflections, and Rotations Pre-Assessment Per Date

Pre-Calculus Guided Notes: Chapter 10 Conics. A circle is

In this translation, CDE is being translated to the right by the same length as segment AB. What do you think is true about CDE and C'D'E'?

12.4 Rotations. Learning Objectives. Review Queue. Defining Rotations Rotations

SECTION 1.3: BASIC GRAPHS and SYMMETRY

PITSCO Math Individualized Prescriptive Lessons (IPLs)

TRANSFORMATIONS. The original figure is called the pre-image; the new (copied) picture is called the image of the transformation.

NAME: DATE: PERIOD: 1. Find the coordinates of the midpoint of each side of the parallelogram.

Transcription:

MODULE - 7 e-pg Pathshala Subject: Computer Science Paper: Computer Graphics and Visualization Module: Other 2D Transformations Module No: CS/CGV/7 Quadrant e-text Objectives: To get introduced to the other useful transformations like Reflection, Shear and Transformations between coordinate systems Discussion: From the previous discussion it is evident that, any complex transformation can be represented as a combination of simple or basic transformations. A composite matrix that represents the complex transformation, is then derived by multiplying these basic transformations. Let s now look at the other useful transformations: Reflection, Shear and Transformation between coordinate systems. These transformations too can be considered as complex and they can represented as a combination of basic transformations. Reflection: It is similar to having an exact replica on the other side of either an axis or a plane. In 2D, we perform reflection with respect to a line or axis called axis of reflection. This axis or line can be in any orientation in 2D space. For simplicity let s try to understand reflection with respect to the standard coordinate axes the X and Y. As shown in the figure above, consider a triangle positioned in the positive quadrant, and has one of its vertices is at (4,5). Now let s perform reflection with respect to X-axis. It is intuitive to say that, the points on both the triangles are equidistant on either side the axis of reflection (x-axis), i.e. for every point on the initial triangle there exists a point on the other

side of the reflection axis that is exactly at the same perpendicular distance as that of the initial point. Consider a point (4,5), for this point, the reflection point would be (4, -5), where the y-coordinate alone is ve, but the magnitudes remain the same. In general for any point (x, y) in the positive quadrant, the reflection point (x, y ) with respect to X-axis will be (x, -y) We can represent this in equation form as given below. X = X Y = -Y The equations can be represented in matrix form as below. If we choose the reflection axis to be Y-axis, the scenario is as shown below. Now the axis of reflection being Y-axis and the initial position of the triangle be the positive quadrant, for a point (x, y), the corresponding reflection point would be (-x, y). We can represent this in equation form as X = -X Y = Y The equations can be represented in matrix form as below. In general reflection can be performed with respect to any general axis in space. I we consider another axis say the Z-axis (axis passing through origin and is perpendicular to the plane containing X and Y axes), The reflection point for (x,y) will be (-x, -y). Similarly if we consider other reflection axes like Y=X and Y= -X, then for a point (x, y) in the positive quadrant, the reflection points would be (y, x) and (-y, -x) respectively. The reflection transformations and the corresponding matrices are shown below.

Reflection can also be performed using a rotation operation, i.e., either by rotating the object about a pivot point within the same plane by an angle of 8 CW or CCW, or by rotating the object about a pivot point, by an out of the plane movement and getting back to the plane by an angle of 8. Now the question is, what is that pivot about which we should rotate? It is easy to say that, the pivot point lies on the axis of reflection, (for simplicity let s consider X-axis as axis of reflection). But what could be that exact pivot point! To answer this, let s have a look into the figures above, explaining this concept. When the axis of reflection is X-axis, the pivot point for P (4, 5) shall be (4, ) which lies on X-axis, and when the axis of reflection is Y-axis, the pivot point for P (5, 3) shall be (,3) which lies on Y-axis. If we imagine that an object is made up of 3 vertices, and for each vertex there is a separate pivot point about which we should perform rotation, then it is quite a cumbersome task, instead we can simplify this by computing a centroid point for the object and then we need to identify a single pivot point about which all the 3 vertices are rotated. (You can do this as an exercise). Exercise: Prove that reflection is rotation by 8 about some point on X-axis. (Hint: Take a point say (4, 5) and perform a rotation about (4, ) by an angle of 8. The same answer can be easily obtained by multiplying the point (4,5) with the reflection matrix about x-axis) You may also observe that reflection by rotation within the plane of coordinate system does not give the same result as that of rotation out of the plane and back into the plane, method, even though both procedures give the same shape. Thus reflection does not alter the shapes of objects, unlike scaling. If reflection is to be performed about any randomly oriented axis or line in space then you can follow these steps to solve the problem. Step-: Try to align the randomly oriented axis or line with one of the known axes say (x,y,x=y,x=-y). Step: 2 Perform reflection with respect to the known axis. Step: 3 Reorient the axis to its original position Now for each of the above steps, derive transformation matrices, multiply all of them to get a composite transformation matrix. Multiply the vertices of the target object with the composite transformation matrix to get the final new reflected vertices.

********************************************************************************************************* Ex: Find the new reflection point for the vertex (2, ) when reflected with respect to the axis defined by y=x+5. Sol: For this the solution is given in the following steps As we notice that the equation of the axis is of the form y=mx+c, the slope of the line m is, and intercept c is 5, that means the infinite line cuts through the y-axis at the point (,5). As the slope m is, the line makes an angle 45 with x-axis (θ = Tan - (m)). Let s follow the simple steps given in the previous discussion. i) Align the randomly oriented line with the known axes. The sol. Is translate the line by (,-5) such that the line passes through origin and the line coincides with the known axis X=Y (since the line has slope ). Thus the transformation matrix for this step is T (,-5) ii) Perform Reflection with respect to X=Y axis using the matrix given above in the previous discussion, Ref(Y=X) iii) Reorient the line such that it is back at its original position T (, 5) The final step is to write the matrices in the reverse order to compute the composite matrix, as shown below. P (x, y ) = {T (, 5). Ref (Y=X). T (,-5)} P(x,y) x [ y ] = [ x [ y 5] [ ] = [ ] [ 5 x 5 ] [ y] x 5] [ y] Now multiplying the point, (2,) with the above composite matrix we get (5,7) x [ y ] = [ 5 2 5 ] [ ] Ans: The reflection point is (5, 7). ********************************************************************************************************* Shear: Let s try to understand the next transformation under discussion, the shear transformation. Unlike reflection transformation, the shear transformation deforms the shape of the object. For performing shear transformation we require 3 parameters, which are Axis of shear Direction of Shear Magnitude of shear Axis of shear, is the axis with respect to which the shear transformation is performed (It is also understood as the firm bottom to which the object / shape is attached). Direction of

shear, is the direction in which the shear force is applied on the object /shape. Magnitude of shear is the shear force. If shear force is applied along X-direction we indicate that with the notation Sh x. In the figure shown above, the effect of shear is evident on a standard unit square at origin. The shear force is applied along X-direction so direction of shear, is the X-direction. Axis of shear being the X-axis, and with some force the shear is applied, the effect of which is to deform the square to a parallelogram. x = x + sh x y y = y As can be observed from the equations above, while there is a shift in the x-coordinate by an amount Sh x.y, there is no change in the y-coordinate. The net effect is distortion in shape. The shear effect can be understood better in the following discussion. Imagine you are holding a big bulky book on one of your palms with your hands stretched straight to the front, apply force on top of the book, along the forward direction with your other hand, the effect is that the top few pages of the book appear to have moved forward, while the middle pages a little forward and the bottom pages of the book show no movement. The shape is the shear effect. (The module-7 of video lecture explains this better). It can also be inferred that the effect of shear in this case, is proportional to the y- distance of the point from origin, i.e., the larger the y-coordinate of a point, the greater is the shear effect, with sh x being constant. The corresponding shear transformation matrix is given below. sh x [ ] Assume now a scenario, where the axis of shear is changed from X-axis to some other axis parallel to X-axis, say (y ref), now what could be the effect of shear, assuming the other parameters (direction of shear, magnitude of shear) remaining the same as in the above discussion. The effect is as shown in the figure below.

From the above figure it can be observed that the axis of shear (a line parallel to X- axis referred to as y ref) is chosen such that it is a line parallel to x-axis defined with the equation y ref = -2. As mentioned before, axis of shear is understood to be the firm base to which the object is stuck. But the initial square is aligned with the coordinate axes and the bottom is shifted to align with the line y ref = -2, so what could be the equations that model the shear effect? The answer is x = x + sh x (y y ref ) y = y As can be observed from the equations above, the new x coordinate (x ) has some new terms in the equation, while there are no changes in y. The effect is that, the object not only gets sheared but also gets translated by the amount proportional to (-sh x. y ref). Since, y ref is ve, the translation amount becomes +ve, so the object is shifted along the +ve X- direction. If y ref is chosen as positive, then the translation parameter becomes ve, and the object shifts along the ve X-direction. The shear transformation matrix for shear along any line parallel to X-axis given by sh x [ sh x. y ref ] In general shear transformation can be performed with respect to any general line in space. In the Y-axis shear, we use x ref as any general line that is parallel to Y-axis. The same set of equations can be used by just flipping x with y and y with x. Shear transformation for a standard unit square at origin, can be represented as a combination of basic transformations. It is equivalent to scaling along the diagonal followed by rotation. You can try this as an exercise! Transformation between Coordinate Systems: Let s try to understand the last transformation under discussion, the transformation between coordinate systems. A transformation can be understood in either of the two ways: an object transformation or a coordinate system transformation. In object transformation, the coordinate system is assumed to be fixed while the object is transformed. Here the object assumes new coordinates after every transformation. In coordinate system transformation, objects are assumed to be stationary while the coordinate system is transformed. The end effect in both these types is the same, only that the approach differs. Whatever we have learnt so far in the discussion under the heading transformations, is fundamentally object transformations. In typical graphics pipeline, a set of initial coordinates are given as input, and these coordinates are converted to a new set of coordinates by transformation i.e., from modeling to world, world to viewing, viewing to Normalized viewing and then finally to device coordinates. In coordinate system transformations, the objects assume new coordinates after every transformation, but not because the object is transformed, but because the reference with respect to which the object is defined gets transformed, i.e., when we see the same object from a new reference position or frame, the object looks different. (Remember that a coordinate system is nothing but a reference frame in space.). Let s now understand how this transformation is performed. Assume that there is an initial / base coordinate system (say) XY, with respect to which a new coordinate system X Y is derived. The new / derived coordinate system has its origin at Q(x,y ), and the X direction of the derived system makes some +ve angle θ with the X direction of the base system as shown in the figure below. Assume a point P(x,y)

represented with respect to the base (XY) coordinate system, what would be the coordinates of the point P, if represented with respect to the derived (X Y ) coordinate system? i.e., given a point p(x,y) with respect to Base system, what is its equivalent in the derived system? Follow the steps as given below: Let the equivalent coordinates for P (x,y) in the base system be, P (x,y ) in the derived system. Translate origin of the derived such that it coincides with origin of base T(-X,-Y ). Rotate derived system such that it aligns with base system. R(-θ) Find composite by multiplying the above two matrices. Multiply the point P(x,y) with composite to get P (x,y ) Note carefully that we should not go further to reverse the transformations as we were doing in the earlier occasions. The transformations that were used to derive the new coordinate system (say a rotation with respect to origin by an angle θ followed by a translation to position Q) are reversed to obtain the steps for this. P (x, y ) = {R (-θ).t (-x, -y )} P(x,y) Thus the transformation matrix for transformation between coordinate systems can be denoted as M XY X Y = {R (-θ).t (-X, -Y )} Now consider a scenario as shown in the figure below, where a point P (x,y ) is given with respect to the derived system. What is its equivalent with respect to the base system? P(x, y) = {T (X,Y ). R (θ)} P (x,y ) M X Y XY = {T (X,Y ). R (θ)} If you observe the above two ways of performing transformation between coordinate systems, the matrices M XY X Y, M X Y XY have the operations that are exactly in the reverse order. In practical applications, coordinates are represented with respect to the current

reference frame, when transformations are to be performed, the coordinates are converted to world or the base system. Summary: The transformations that we have learnt in this module can be treated as complex transformations, which can be represented as a combination of basic transformations. Shear transformation alters the shape of objects. Reflection can be represented as rotation, shear can be represented as a combination of scaling and rotation.