2D TRANSFORMATION. Homogenous Coordinates. Translation

Similar documents
TWO-DIMENSIONAL TRANSFORMATION

Geometric Transformation CS 211A

Vector Notation: AB represents the vector from point A to point B on a graph. The vector can be computed by B A.

2D Geometric Transformations

Lecture 3: Coordinate Systems and Transformations

Affine Transformations

Computer Graphics Labs

Exam 1 Sample Question SOLUTIONS. y = 2x

Physics 235 Chapter 1. Chapter 1 Matrices, Vectors, and Vector Calculus

Vector Math Computer Graphics Scott D. Anderson

CS 4204 Computer Graphics

Geometric Transformations

Solving Simultaneous Equations and Matrices

Content. Chapter 4 Functions Basic concepts on real functions 62. Credits 11

Rotation Matrices and Homogeneous Transformations

Connecting Transformational Geometry and Transformations of Functions

MAC Learning Objectives. Module 10. Polar Form of Complex Numbers. There are two major topics in this module:

The Point-Slope Form

2D Geometrical Transformations. Foley & Van Dam, Chapter 5

MATH2210 Notebook 1 Fall Semester 2016/ MATH2210 Notebook Solving Systems of Linear Equations... 3

Basic CAD/CAM. CHAPTER 5: Geometric Transformation

Figure 1.1 Vector A and Vector F

Vector has a magnitude and a direction. Scalar has a magnitude

Lecture L3 - Vectors, Matrices and Coordinate Transformations

Geometric Transformations

LS.6 Solution Matrices

DRAFT. Further mathematics. GCE AS and A level subject content

Torgerson s Classical MDS derivation: 1: Determining Coordinates from Euclidean Distances

JUST THE MATHS UNIT NUMBER 8.5. VECTORS 5 (Vector equations of straight lines) A.J.Hobson

PLANE TRUSSES. Definitions

Introduction to Matrices

Equations Involving Lines and Planes Standard equations for lines in space

EQUATIONS and INEQUALITIES

Dear Accelerated Pre-Calculus Student:

Section 1.1. Introduction to R n

5.3 The Cross Product in R 3

Lecture 14: Section 3.3

Unified Lecture # 4 Vectors

Number Sense and Operations

Big Ideas in Mathematics

Orthogonal Projections

Lectures notes on orthogonal matrices (with exercises) Linear Algebra II - Spring 2004 by D. Klain

Mechanics lecture 7 Moment of a force, torque, equilibrium of a body

Essential Mathematics for Computer Graphics fast

521493S Computer Graphics. Exercise 2 & course schedule change

5. Orthogonal matrices

Given a point cloud, polygon, or sampled parametric curve, we can use transformations for several purposes:

A vector is a directed line segment used to represent a vector quantity.

Part I. Basic Maths for Game Design

The elements used in commercial codes can be classified in two basic categories:

Exploring Geometric Transformations in a Dynamic Environment Cheryll E. Crowe, Ph.D. Eastern Kentucky University

Computing Euler angles from a rotation matrix

Biggar High School Mathematics Department. National 5 Learning Intentions & Success Criteria: Assessing My Progress

9.4. The Scalar Product. Introduction. Prerequisites. Learning Style. Learning Outcomes

Lecture 2: Homogeneous Coordinates, Lines and Conics

EDEXCEL NATIONAL CERTIFICATE/DIPLOMA MECHANICAL PRINCIPLES AND APPLICATIONS NQF LEVEL 3 OUTCOME 1 - LOADING SYSTEMS

Geometric Camera Parameters

Math 241 Lines and Planes (Solutions) x = 3 3t. z = 1 t. x = 5 + t. z = 7 + 3t

x(x + 5) x 2 25 (x + 5)(x 5) = x 6(x 4) x ( x 4) + 3

Chapter 6. Linear Transformation. 6.1 Intro. to Linear Transformation

Solving Equations Involving Parallel and Perpendicular Lines Examples

MOVIES, GAMBLING, SECRET CODES, JUST MATRIX MAGIC

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

2x + y = 3. Since the second equation is precisely the same as the first equation, it is enough to find x and y satisfying the system

Abstract. Introduction

1 Symmetries of regular polyhedra

[1] Diagonal factorization

Linear algebra and the geometry of quadratic equations. Similarity transformations and orthogonal matrices

Chapter 17. Orthogonal Matrices and Symmetries of Space

Section 9.1 Vectors in Two Dimensions

Vector Treasure Hunt Teacher s Guide

Structural Axial, Shear and Bending Moments

MATH 304 Linear Algebra Lecture 18: Rank and nullity of a matrix.

SIGNAL PROCESSING & SIMULATION NEWSLETTER

3. KINEMATICS IN TWO DIMENSIONS; VECTORS.

Week 13 Trigonometric Form of Complex Numbers

9 MATRICES AND TRANSFORMATIONS

Vectors Math 122 Calculus III D Joyce, Fall 2012

Prentice Hall Mathematics: Algebra Correlated to: Utah Core Curriculum for Math, Intermediate Algebra (Secondary)

Complex Numbers. w = f(z) z. Examples

Solving Systems of Linear Equations

v w is orthogonal to both v and w. the three vectors v, w and v w form a right-handed set of vectors.

We can display an object on a monitor screen in three different computer-model forms: Wireframe model Surface Model Solid model

How To Understand And Solve Algebraic Equations

Systems of Linear Equations

Current Standard: Mathematical Concepts and Applications Shape, Space, and Measurement- Primary

Section Continued

Math 215 HW #6 Solutions

13 MATH FACTS a = The elements of a vector have a graphical interpretation, which is particularly easy to see in two or three dimensions.

2 Session Two - Complex Numbers and Vectors

Chapter 19. General Matrices. An n m matrix is an array. a 11 a 12 a 1m a 21 a 22 a 2m A = a n1 a n2 a nm. The matrix A has n row vectors

Understanding Poles and Zeros

When the fluid velocity is zero, called the hydrostatic condition, the pressure variation is due only to the weight of the fluid.

Linear Algebra Notes

Mathematics Course 111: Algebra I Part IV: Vector Spaces

Unit 3 (Review of) Language of Stress/Strain Analysis

Parametric Equations and the Parabola (Extension 1)

Notes on Orthogonal and Symmetric Matrices MENU, Winter 2013

Rotation about an arbitrary axis and reflection through an arbitrary plane

Linear Algebra Notes for Marsden and Tromba Vector Calculus

Transcription:

2D TRANSFORMATION http://www.tutorialspoint.com/computer_graphics/2d_transformation.htm Copyright tutorialspoint.com Transformation means changing some graphics into something else by applying rules. We can have various types of transformations such as translation, scaling up or down, rotation, shearing, etc. When a transformation takes place on a 2D plane, it is called 2D transformation. Transformations play an important role in computer graphics to reposition the graphics on the screen and change their size or orientation. Homogenous Coordinates To perform a sequence of transformation such as translation followed by rotation and scaling, we need to follow a sequential process Translate the coordinates, Rotate the translated coordinates, and then Scale the rotated coordinates to complete the composite transformation. To shorten this process, we have to use 3 3 transformation matrix instead of 2 2 transformation matrix. To convert a 2 2 matrix to 3 3 matrix, we have to add an extra dummy coordinate W. In this way, we can represent the point by 3 numbers instead of 2 numbers, which is called Homogenous Coordinate system. In this system, we can represent all the transformation equations in matrix multiplication. Any Cartesian point PX, Y can be converted to homogenous coordinates by P (X h, Y h, h). Translation A translation moves an object to a different position on the screen. You can translate a point in 2D by adding translation coordinate (t x, t y ) to the original coordinate X, Y to get the new coordinate X, Y. From the above figure, you can write that X = X + t x Y = Y + t y The pair (t x, t y ) is called the translation vector or shift vector. The above equations can also be

represented using the column vectors. We can write it as P = [X] [Y] p' = [X ] [Y ] T = [t x ] [t y ] P = P + T Rotation In rotation, we rotate the object at particular angle θ theta from its origin. From the following figure, we can see that the point PX, Y is located at angle φ from the horizontal X coordinate with distance r from the origin. Let us suppose you want to rotate it at the angle θ. After rotating it to a new location, you will get a new point P X, Y. Using standard trigonometric the original coordinate of point PX, Y can be represented as X = rcosϕ...... (1) Y = rsin ϕ...... (2) Same way we can represent the point P X, Y as {x}'= r \: cos \: \left ( \phi \: + \: \theta \right ) = r\: cos \: \phi \: cos \: \theta \: \: r \: sin \: \phi \: sin \: \theta... (3) {y}'= r \: sin \: \left ( \phi \: + \: \theta \right ) = r\: cos \: \phi \: sin \: \theta \: + \: r \: sin \: \phi \: cos \: \theta... (4) Substituting equation 1 & 2 in 3 & 4 respectively, we will get x = x cos θ y sin θ {y}'= x \: sin \: \theta + \: y \: cos \: \theta Representing the above equation in matrix form, [X Y ] = [X Y ] P = P. R [ ] cosθ sinθ sinθ cosθ OR

Where R is the rotation matrix R = cosθ sinθ [ sinθ cosθ ] The rotation angle can be positive and negative. For positive rotation angle, we can use the above rotation matrix. However, for negative angle rotation, the matrix will change as shown below Scaling = R = cos( θ) sin( θ) [ sin( θ) cos( θ) ] cosθ sinθ [ ( cos( θ) = cosθ and sin( θ) = sinθ) sinθ cosθ ] To change the size of an object, scaling transformation is used. In the scaling process, you either expand or compress the dimensions of the object. Scaling can be achieved by multiplying the original coordinates of the object with the scaling factor to get the desired result. Let us assume that the original coordinates are X, Y, the scaling factors are (S X, S Y ), and the produced coordinates are X, Y. This can be mathematically represented as shown below X' = X. S X and Y' = Y. S Y The scaling factor S X, S Y scales the object in X and Y direction respectively. The above equations can also be represented in matrix form as below X Y = X Y S x 0 ( ) ( )[ ] 0 S y OR P = P. S Where S is the scaling matrix. The scaling process is shown in the following figure.

If we provide values less than 1 to the scaling factor S, then we can reduce the size of the object. If we provide values greater than 1, then we can increase the size of the object. Reflection Reflection is the mirror image of original object. In other words, we can say that it is a rotation operation with 180. In reflection transformation, the size of the object does not change. The following figures show reflections with respect to X and Y axes, and about the origin respectively.

Shear A transformation that slants the shape of an object is called the shear transformation. There are two shear transformations X-Shear and Y-Shear. One shifts X coordinates values and other shifts Y coordinate values. However; in both the cases only one coordinate changes its coordinates and other preserves its values. Shearing is also termed as Skewing. X-Shear The X-Shear preserves the Y coordinate and changes are made to X coordinates, which causes the vertical lines to tilt right or left as shown in below figure. The transformation matrix for X-Shear can be represented as Y-Shear X sh = [ ] 1 0 0 shx 1 0 0 0 1 X' = X + Sh x. Y Y = Y The Y-Shear preserves the X coordinates and changes the Y coordinates which causes the horizontal lines to transform into lines which slopes up or down as shown in the following figure.

The Y-Shear can be represented in matrix from as Composite Transformation Y sh 0 1 0 1 shy 0 0 0 1 Y = Y + Sh y. X X = X If a transformation of the plane T1 is followed by a second plane transformation T2, then the result itself may be represented by a single transformation T which is the composition of T1 and T2 taken in that order. This is written as T = T1 T2. Composite transformation can be achieved by concatenation of transformation matrices to obtain a combined transformation matrix. A combined matrix Where [Ti] is any combination of Translation Scaling Shearing Rotation Reflection [T][X] = [X] [T1] [T2] [T3] [T4]. [Tn] The change in the order of transformation would lead to different results, as in general matrix multiplication is not cumulative, that is [A]. [B] [B]. [A] and the order of multiplication. The basic purpose of composing transformations is to gain efficiency by applying a single composed transformation to a point, rather than applying a series of transformation, one after another. For example, to rotate an object about an arbitrary point (X p, Y p ), we have to carry out three steps Translate point (X p, Y p ) to the origin. Rotate it about the origin. [ ] Finally, translate the center of rotation back where it belonged. Processing math: 100%