Lecture Notes: Computer Graphics.

Slides:



Advertisements
Similar presentations
Computer Graphics: 2D Transformations
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
CMPE 466 COMPUTER GRAPHICS
1 Geometrical Transformation 2 Outline General Transform 3D Objects Quaternion & 3D Track Ball.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Course Website: Computer Graphics 3: 2D Transformations.
Math for CSLecture 11 Mathematical Methods for Computer Science Lecture 1.
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.
Geometric Transformation-2D
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
Mathematical Fundamentals
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
5.2 Three-Dimensional Geometric and Modeling Transformations 2D3D Consideration for the z coordinate.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformation of Graphics
Graphics Graphics Korea University cgvr.korea.ac.kr 2D Geometric Transformations 고려대학교 컴퓨터 그래픽스 연구실.
2D Transformation of 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
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.
1 Computer Graphics Week9 -3D Geometric Transformation.
Transformations CS 445/645 Introduction to Computer Graphics David Luebke, Spring 2003.
Multimedia Programming 07: Image Warping Keyframe Animation Departments of Digital Contents Sang Il Park.
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
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.
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
Computer Graphic 2 D Transformation.
Image Warping 2D Geometric Transformations
CSCE 441 Computer Graphics: 2D Transformations
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
Modeling Transformation
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Transformations University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2016 Tamara Munzner.
CPT450 – Computer Graphics
Computer Graphics 2D Transformations
Modeling Transformations
Lecture 10 Geometric Transformations In 3D(Three- Dimensional)
Computer Graphics 3: 2D Transformations
Geometric Transformations Hearn & Baker Chapter 5
2D Geometric Transformations
Computer Graphics Transformations.
2D Transformations with Matrices
Computer Graphics 3: 2D Transformations
3D Geometric Transformations
Chapter 5 2-D Transformations.
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Lecture 7 Geometric Transformations (Continued)
2D Transformations y y x x y x.
Image Warping (Szeliski Sec 2.1.2)
Image Warping (Szeliski Sec 2.1.2)
© 2008, Fayyaz A. Afsar, DCIS, PIEAS.
Image Warping : Computational Photography
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Transformations 3 University of British Columbia
Chapter IV Spaces and Transforms
Image Warping : Computational Photography
Image Warping (Szeliski Sec 2.1.2)
TWO DIMENSIONAL TRANSFORMATION
Translation in Homogeneous Coordinates
Presentation transcript:

Lecture Notes: Computer Graphics

Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it and rotate it

Transformation Two complementary views Geometric trans: Object is transformed relative to a stationary coordinate system Coordinate trans: Object is held stationary while the coordinate system is transformed Ex: moving an automobile against a scenic background Move the auto and keep the background fixed (GT) Keep the car fixed and move the background (CT)

Basic 2D Geometric Transformations Four basic types Translation Scaling Rotation Shear (possible using a combination of rotation and scaling)

Translation xnew = xold + tx ynew = yold + ty Simply moves an object from one position to another xnew = xold + tx ynew = yold + ty Note: House shifts position relative to origin y x 1 2 3 4 5 6 7 8 9 10

Scaling xnew = Sx × xold ynew = Sy × yold Scalar multiplies all coordinates WATCH OUT: Objects grow and move! xnew = Sx × xold ynew = Sy × yold Note: House shifts position relative to origin y x 1 2 3 4 5 6 7 8 9 10

Rotation xnew = xold × cosθ – yold × sinθ Rotates all coordinates by a specified angle xnew = xold × cosθ – yold × sinθ ynew = xold × sinθ + yold × cosθ Points are always rotated about the origin y 6 5 4 3 2 1 x 1 2 3 4 5 6 7 8 9 10

Shear Along X-axis Along Y-axis

Basic 2D Geometric Transformations Translation Scale Rotation Shear

Transformation and Matrix Multiplication Recall how matrix multiplication takes place:

Matrix Representation Represent a 2D Transformation by a Matrix Apply the Transformation to a Point Transformation Matrix Point

Matrix Representation Transformations can be combined by matrix multiplication Transformation Matrix Matrices are a convenient and efficient way to represent a sequence of transformations

2×2 Matrices What types of transformations can be represented with a 2×2 matrix? 2D Identity 2D Scaling

2×2 Matrices What types of transformations can be represented with a 2×2 matrix? 2D Rotation 2D Shearing

2×2 Matrices 2D Mirror over Y axis What types of transformations can be represented with a 2×2 matrix? 2D Mirror over Y axis 2D Mirror over (0,0)

2×2 Matrices 2D Translation What types of transformations can be represented with a 2×2 matrix? 2D Translation NO!! Only linear 2D transformations can be Represented with 2x2 matrix

Homogeneous Coordinates A point (x, y) can be re-written in homogeneous coordinates as (xh, yh, h) The homogeneous parameter h is a non-zero value such that: We can then write any point (x, y) as (hx, hy, h) We can conveniently choose h = 1 so that (x, y) becomes (x, y, 1)

Homogeneous Coordinates Add a 3rd coordinate to every 2D point (x, y, w) represents a point at location (x/w, y/w) (x, y, 0) represents a point at infinity (0, 0, 0) is not allowed y 2 (2, 1, 1) or (4, 2, 2) or (6, 3, 3) 1 x 1 2 Convenient Coordinate System to Represent Many Useful Transformations

Why Homogeneous Coordinates? Mathematicians commonly use homogeneous coordinates as they allow scaling factors to be removed from equations We will see in a moment that all of the transformations we discussed previously can be represented as 3*3 matrices Using homogeneous coordinates allows us use matrix multiplication to calculate transformations – extremely efficient!

Homogeneous Translation The translation of a point by (dx, dy) can be written in matrix form as: Representing the point as a homogeneous column vector we perform the calculation as:

Homogenous Coordinates To make operations easier, 2-D points are written as homogenous coordinate column vectors Translation: Scaling:

Basic 2D Transformations Basic 2D transformations as 3x3 Matrices Translate Scale Rotate Shear

Combining Transformations A number of transformations can be combined into one matrix to make things easy Allowed by the fact that we use homogenous coordinates Imagine rotating a polygon around a point other than the origin Transform to centre point to origin Rotate around origin Transform back to centre point

Matrix Composition Transformations can be combined by matrix multiplication Efficiency with premultiplication Matrix multiplication is associative

Combining Transformations (cont…) 1 2 3 4

Combining Transformations (cont…) The three transformation matrices are combined as follows REMEMBER: Matrix multiplication is not commutative so order matters

Matrix Composition Rotate by  around arbitrary point (a,b) Scale by sx, sy around arbitrary point (a,b) (a,b) (a,b)

Inverse Transformations Transformations can easily be reversed using inverse transformations

Basic 2D Coordinate Transformations Translation Scale Rotation Shear ??