2D Transformations By: KanwarjeetSingh

Slides:



Advertisements
Similar presentations
Computer Graphics: 2D Transformations
Advertisements

COMPUTER GRAPHICS 2D TRANSFORMATIONS.
2D TRANSFORMATIONS. 2D Transformations What is transformations? –The geometrical changes of an object from a current state to modified state. Why the.
25 May May May 2015Week 5-2D Transformations1 2D Transformations By: KanwarjeetSingh.
2D TRANSFORMATIONS.
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
Computer Graphics with OpenGL 3e
2D Transformations x y x y x y. 2D Transformation Given a 2D object, transformation is to change the object’s Position (translation) Size (scaling) Orientation.
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
CAP4730: Computational Structures in Computer Graphics
CS 450: Computer Graphics 2D TRANSFORMATIONS
Mathematical Fundamentals
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
2D Transformation of Graphics
Lecture Notes: Computer Graphics.
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
2D Geometric Transformations
Part7: Geometric Transformations
GRAFIKA KOMPUTER ~ M. Ali Fauzi. Drawing 2 D Graphics.
 2D Transformations 2D Transformations  Translation Translation  Rotation Rotation  Scaling Scaling.
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
Geometric Transformations
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
Introduction to Computer Graphics Geometric Transformations
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Two-Dimensional Geometric Transformations A two dimensional transformation is any operation on a point in space (x, y) that maps that point's coordinates.
Geometric Transformations
2D Geometric Transformation Translation A translation is applied to an object by repositioning it along a straight-line path from one coordinate location.
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
III- 1 III 3D Transformation Homogeneous Coordinates The three dimensional point (x, y, z) is represented by the homogeneous coordinate (x, y, z, 1) In.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
2D Transformations What is transformations? The geometrical changes of an object from a current state to modified state. Why the transformations is needed?
CSCE 441 Computer Graphics: 2D Transformations
Modeling Transformation
Instructor: Dr. Shereen Aly Taie Basic Two-Dimensional Geometric Transformation 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
2D Geometry - points and polygons
CPT450 – Computer Graphics
Computer Graphics 2D Transformations
Geometric Transformations
Transformations Objectives
Geometric Transformations Hearn & Baker Chapter 5
2D TRANSFORMATIONS.
2D Geometric Transformations
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
Review: Transformations
Computer Graphics Lecture 18 3-D Transformations-II Taqdees A
3D Geometric Transformations
Computer Graphics Transformations.
Review: Transformations
2D Transformations y y x x y x.
Homogeneous Coordinates (Projective Space)
Computer Graphics Transformations
Line and Character Attributes 2-D Transformation
Mobile Robot Kinematics
2-D Geometry.
Chapter IV Spaces and Transforms
2D Geometric Transformations
2D/3D Transformations User Interfaces.
Geometric Objects and Transformations (II)
CS1550 Fundamentals For Computer Graphics Transformations-2
Rendering – Matrix Transformations and the Graphics Pipeline
TWO DIMENSIONAL TRANSFORMATION
Presentation transcript:

2D Transformations By: KanwarjeetSingh 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Matrix math Is there a difference between possible representations? 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Pick a convention We’ll use the column-vector representation for a point. Which implies that we use pre-multiplication of the transformation – it appears before the point to be transformed in the equation. What if we needed to switch to the other convention (to use some library, for instance)? How could we do that? 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Translation A translation moves all points in an object along the same straight-line path to new positions. The path is represented by a vector, called the translation or shift vector. We can write the components: p'x = px + tx p'y = py + ty or in matrix form: P' = P + T 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Rotation A rotation repositions all points in an object along a circular path in the plane centered at the pivot point. First, we’ll assume the pivot is at the origin. We can write the components: p'x = px cos  – py sin  p'y = px sin  + py cos  or in matrix form: P' = R • P  4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations More rotation Another convention, we’ll take  to be counterclockwise, as in our example. R, the rotation matrix, looks like: 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Scaling Scaling alters the size of an object. Scales are about the the origin. Scale factors between 0 and 1 shrink objects. Scale factors greater than 1 enlarge objects. We can write the components: p'x = sx • px p'y = sy • py or in matrix form: P' = S • P The scale factors need not be the same in each direction. 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations More scaling We write a scale matrix as: Scaling also translates objects; away from the origin if the scale factor is greater than 1, or towards the origin if the scale factor is less than 1. What does scaling by 1 do? What is that matrix called? What does scaling by a negative value do? 4 June 2018 Week 5-2D Transformations

Combining transformations We have a general transformation of a point: P' = M • P + A When we scale or rotate, we set M, and A is the additive identity. When we translate, we set A, and M is the multiplicative identity. To combine multiple transformations, we must explicitly compute each transformed point. It’d be nicer if we could use the same matrix operation all the time. But we’d have to combine multiplication and addition into a single operation. 4 June 2018 Week 5-2D Transformations

A less than obvious solution Let’s move our problem into 3D. Let point (x, y) in 2D be represented by point (x, y, 1) in the new space. Scaling our new point by any value a puts us somewhere along a particular line: (ax, ay, a). We can always map back to the original 2D point by dividing by the last coordinate. The fact that all the points along each line can be mapped back to the same point in 2D gives this coordinate system its name – homogeneous coordinates. w (x,y,1) w = 1 x,y (0,0,0) 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations So what? Well, now we can wedge some addition into our multiplicative matrix. Our point now has three coordinates. So our matrix is needs to be 3x3. We want a matrix which gives us: 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Now what? 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations And? Rotations: Scales: 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations What of it? We can represent any of our three transformations as a single matrix. No special cases when transforming a point – matrix • vector. Composite transformations – matrix • matrix. Composite transformations: Rotate about an arbitrary point – translate, rotate, translate Scale about an arbitrary point – translate, scale, translate Change coordinate systems – translate, rotate, scale Does the order of operations matter? 4 June 2018 Week 5-2D Transformations

Is matrix multiplication associative? 4 June 2018 Week 5-2D Transformations

Is matrix multiplication commutative? 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Order of operations So, it does matter. Let’s look at an example: 4 June 2018 Week 5-2D Transformations

Week 5-2D Transformations Useful compositions Rotate about a pivot point: T(pivot) • R() • T(–pivot) • P Scale about a fixed point: T(fixed) • S(scale) • T(–fixed) • P General scaling directions: R(–) • S(scale) • R() • P 4 June 2018 Week 5-2D Transformations

Other transformations Reflection: x-axis y-axis 4 June 2018 Week 5-2D Transformations

Other transformations Reflection: origin line x=y 4 June 2018 Week 5-2D Transformations

Other transformations Shear: x-direction y-direction 4 June 2018 Week 5-2D Transformations

Coordinate system transformations We often need to transform points from one coordinate system to another: We might model an object in non-Cartesian space (polar) Objects may be described in their own local system Other reasons: textures, display, etc 4 June 2018 Week 5-2D Transformations

Matrix multiplication So we can do a lot with one basic operation. We’d better make this operation as fast as possible. Let’s start with the form of the matrix: Why haven’t we used the bottom row of the matrix? 4 June 2018 Week 5-2D Transformations

Matrix multiplication Since we don’t use the bottom row of the 2D transformation matrix, we could have a special transform composition operation: 4 June 2018 Week 5-2D Transformations