CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.

Slides:



Advertisements
Similar presentations
Computer Graphics: 2D Transformations
Advertisements

3D Transformations Assist. Prof. Dr. Ahmet Sayar
Computer Graphics: 3D Transformations
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Geometric Transformations
8. 2D Coordinate Operations Assoc.Prof.Dr. Ahmet Zafer Şenalp Mechanical Engineering Department Gebze.
1 Computer Graphics Chapter 6 2D Transformations.
2D TRANSFORMATIONS.
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
CS 4731: Computer Graphics Lecture 8: 3D Affine transforms Emmanuel Agu.
2IV60 Computer Graphics 2D transformations
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.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformations Dr. Amy Zhang.
2D Transformations.
Lecture Notes: Computer Graphics.
Geometric Transformations Jehee Lee Seoul National University.
Part7: Geometric Transformations
Transformations Jehee Lee Seoul National University.
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.
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Transformational Geometry CS418 Computer Graphics John C. Hart.
2D Transformation. Transformation changes an object’s: – Position(Translation) – Size(Scaling) – Orientation(Rotation) – Shape(Deformation) Transformation.
Introduction to Computer Graphics Geometric Transformations
Computer Graphics 3D Transformations. Translation.
3D Transformations. Translation x’ = x + tx y’ = y + ty z’ = z + tz P = P’ = T = P’ = T. P tx ty tz xyz1xyz1 x’ y’ z’ 1 x y.
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.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
Composing Transformations
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
Learning Objectives Affine transformations Affine transformations Translation Translation Rotation Rotation Scaling Scaling Reflection Reflection Shear.
1 By Dr. HANY ELSALAMONY.  We have seen how to create models in the 3D world. We discussed transforms in lecture 3, and we have used some transformations.
Geometric Transformations. Transformations Linear transformations Rigid transformations Affine transformations Projective transformations T Global reference.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
1 Geometric Transformations Modelling Transforms By Dr.Ureerat Suksawatchon.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
CSCE 441 Computer Graphics: 2D Transformations
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
Modeling Transformation
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Modeling Transformations
2D Transformations By: KanwarjeetSingh
2D Geometric Transformations
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
Review: Transformations
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
2D Transformations y y x x y x.
Computer Graphics Transformations
Three-Dimensional Graphics
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Transformations in 3 Dimensions CS /28/2018 Dr. Mark L. Hornick
Three-Dimensional Graphics
Geometric Objects and Transformations (II)
Rendering – Matrix Transformations and the Graphics Pipeline
TWO DIMENSIONAL TRANSFORMATION
Presentation transcript:

CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu

Introduction to Transformations Transformation changes an objects: Position (translation) Size (scaling) Orientation (rotation) Shapes (shear) We will introduce first in 2D or (x,y), build intuition Later, talk about 3D and 4D? Transform object by applying sequence of matrix multiplications to object vertices

Why Matrices? All transformations can be performed using matrix/vector multiplication Allows pre-multiplication of all matrices Note: point (x,y) needs to be represented as (x,y,1), also called Homogeneous coordinates

Point Representation We use a column matrix (2x1 matrix) to represent a 2D point General form of transformation of a point (x,y) to (x’,y’) can be written as: or

Translation To reposition a point along a straight line Given point (x,y) and translation distance (t x, t y ) The new point: (x’,y’) x’=x + t x y’=y + t y (x,y) (x’,y’) or where

3x3 2D Translation Matrix use 3x1 vector  Note: it becomes a matrix-vector multiplication

Translation of Objects  How to translate an object with multiple vertices? Translate individual vertices

2D Rotation  Default rotation center is origin (0,0)  Rotate counter clockwise Rotate clockwise 

Rotation (x,y) (x’,y’)  (x,y) -> Rotate about the origin by  (x’, y’) How to compute (x’, y’) ?  x = r cos () y = r sin () r x’ = r cos ( +) y = r sin ( +)

Rotation (x,y) (x’,y’)   r x’ = x cos(  ) – y sin(  ) y’ = y cos(  ) + x sin(  ) Matrix form? 3 x 3? Using trig identities

3x3 2D Rotation Matrix (x,y) (x’,y’)   r

Rotation How to rotate an object with multiple vertices? Rotate individual Vertices 

2D Scaling  Scale: Alter object size by scaling factor (s x, s y ). i.e x’ = x. Sx y’ = y. Sy (1,1) (2,2) Sx = 2, Sy = 2 (2,2) (4,4)

3x3 2D Scaling Matrix

Shearing Y coordinates are unaffected, but x cordinates are translated linearly with y That is: y’ = y x’ = x + y * h  h is fraction of y to be added to x

Arbitrary Rotation Center To rotate about arbitrary point P = (Px, Py) by : Translate object by T(-Px, -Py) so that P coincides with origin Rotate the object by R() Translate object back: T(Px, Py) In matrix form: T(Px,Py) R() T(-Px,-Py) * P  Similar for arbitrary scaling anchor,

Composing Transformation Composing transformation – applying several transforms in succession to form one overall transformation Example: M1 X M2 X M3 X P where M1, M2, M3 are transform matrices applied to P Be careful with the order For example: Translate by (5,0) then rotate 60 degrees is NOT same as Rotate by 60 degrees then translate by (5,0)

OpenGL Transformations Designed for 3D For 2D, simply ignore z dimension Translation: glTranslated(tx, ty, tz) glTranslated(tx, ty, 0) => for 2D Rotation: glRotated(angle, Vx, Vy, Vz) glRotated(angle, 0, 0, 1) => for 2D Scaling: glScaled(sx, sy, sz) glScaled(sx, sy, 0) => for 2D

References Hill, chapter 5.2