2D Geometric Transformations

Slides:



Advertisements
Similar presentations
Computer Graphics 2D & 3D Transformation.
Advertisements

COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Gursharan Singh Tatla TRANSFORMATIONS Gursharan Singh Tatla Gursharan Singh Tatla.
2D TRANSFORMATIONS.
CMPE 466 COMPUTER GRAPHICS
Linear Algebra and SVD (Some slides adapted from Octavia Camps)
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.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Computer Graphics with OpenGL 3e
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.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Transformation of Graphics
TWO DIMENSIONAL GEOMETRIC TRANSFORMATIONS CA 302 Computer Graphics and Visual Programming Aydın Öztürk
Graphics Graphics Korea University kucg.korea.ac.kr Transformations 고려대학교 컴퓨터 그래픽스 연구실.
Graphics Graphics Korea University cgvr.korea.ac.kr 2D Geometric Transformations 고려대학교 컴퓨터 그래픽스 연구실.
2D Transformation of Graphics
2D Transformations.
Lecture Notes: Computer Graphics.
2D Geometric Transformations
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.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
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.
Affine Transformation. Affine Transformations In this lecture, we will continue with the discussion of the remaining affine transformations and composite.
CS552: Computer Graphics Lecture 4: 2D Graphics. Recap 2D Graphics Coordinate systems 2D Transformations o Translation o Scaling o Rotation Combining.
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.
Homogeneous Coordinates and Matrix Representations Cartesian coordinate (x, y, z) Homogeneous coordinate (x h, y h, z h, h) Usually h = 1. But there are.
1 Geometric Transformations-II Modelling Transforms By Dr.Ureerat Suksawatchon.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Computer Graphic 2 D Transformation.
CSCE 441 Computer Graphics: 2D Transformations
3D Geometry and Transformations
Modeling Transformation
학기 Chapter 5. Geometric Transformations 1.
Instructor: Dr. Shereen Aly Taie Basic Two-Dimensional Geometric Transformation 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse.
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
Modeling Transformations
Geometric Transformations Hearn & Baker Chapter 5
2D Transformations By: KanwarjeetSingh
Computer Graphics Transformations.
Review: Transformations
3D Transformation.
3D Geometric Transformations
Chapter 5 2-D Transformations.
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Review: Transformations
Lecture 7 Geometric Transformations (Continued)
2D Transformations y y x x y x.
Line and Character Attributes 2-D Transformation
© 2008, Fayyaz A. Afsar, DCIS, PIEAS.
Geometric Transformations
Unit-5 Geometric Objects and Transformations-II
Computer Graphics Lecture 12 2D Transformations II Taqdees A
Geometric Transformations for Computer Graphics
Geometric Transformations
Transformations 고려대학교 컴퓨터 그래픽스 연구실 kucg.korea.ac.kr.
Transformations in OpenGL
Geometric Transformations
Geometric Objects and Transformations (II)
TWO DIMENSIONAL TRANSFORMATION
Lecture #6 2D Geometric Transformations
Presentation transcript:

2D Geometric Transformations

Contents Definition & Motivation 2D Geometric Transformation Translation Rotation Scaling Matrix Representation Homogeneous Coordinates Matrix Composition Composite Transformations Pivot-Point Rotation General Fixed-Point Scaling Reflection and Shearing Transformations Between Coordinate Systems

Geometric Transformation Definition Translation, Rotation, Scaling Motivation – Why do we need geometric transformations in CG? As a viewing aid As a modeling tool As an image manipulation tool

Example: 2D Geometric Transformation Modeling Coordinates World Coordinates

Example: 2D Scaling Modeling Coordinates Scale(0.3, 0.3) World Coordinates

Example: 2D Rotation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) World Coordinates

Example: 2D Translation Modeling Coordinates Scale(0.3, 0.3) Rotate(-90) Translate(5, 3) World Coordinates

Example: 2D Geometric Transformation Modeling Coordinates Again? World Coordinates

Example: 2D Geometric Transformation Modeling Coordinates Scale Translate Scale Rotate Translate World Coordinates

Basic 2D Transformations Translation ( P’ = P + T ) Scale Rotation y’= x sin θ + y cos θ Shear

Basic 2D Transformations Translation Scale Rotation y’= x sin θ + y cos θ Shear Transformations can be combined (with simple algebra)

Basic 2D Transformations Translation Scale Rotation Shear y’= x sin θ + y cos θ

Basic 2D Transformations Translation Scale Rotation Shear y’= x sin θ + y cos θ

Basic 2D Transformations Translation Scale Rotation Shear y’= x sin θ + y cos θ

Basic 2D Transformations Translation Scale Rotation Shear y’= x sin θ + y cos θ

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

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

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

2D Reflection What types of transformations can be represented with a 2×2 matrix? 2D Mirror reflection over Y axis 2D Mirror reflection over (0,0)Co-ordinate origin

2D Translation 2D translation can be represented by a 3×3 matrix Point represented with homogeneous coordinates

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

OpenGL for Translation glTranslate * ( tx, ty, tz); tx, ty,tz can be assigned any real number values * is single suffix code is either f(float) or d (double) For 2D – we set, tz = 0 ; Ex: glTranslatef ( 25.0, -10.0, 0.0); Translate subsequently defined co-ordinate positions 25 units in x-direction and -10 units in y-direction.

OpenGL for Rotation glRotate * ( theta, vx, vy, vz); Vector v =( vx,v,vz) can have any floating point values , defines the orientation for a rotation axis that passes through the origin. * is single suffix code is either f(float) or d (double) Theta is rotation angle in degrees.( + is CCW and – is CW). Ex: glRotatef ( 90.0, 0.0, 0.0, 1.0);\\90 degree rotation about the z-axis.

OpenGL for Scaling glScale * ( sx, sy, sz); sx, sy,sz can be assigned any real number values * is single suffix code is either f(float) or d (double) Ex: glScalef ( 2.0, -3.0, 1.0); .

OpenGL Model View Matrix glMatrixMode ( GL_MODEL VIEW); Defalut argument for glmatrixmode is GL_MODELVIEW Used to store and combine the geometric transformations.

Homogeneous Coordinates Add a 3rd coordinate to every 2D point (x, y) is converted to (xh, yh, h) where x = (xh /h), y = (yh /h) (x,y) = ( h.x , h.y, h) (x, y, 0) represents a point at infinity (0, 0, 0) Is not allowed y 1 (2, 1, 1) or (4, 2, 2) or (6, 3, 3) x 1 2 Convenient Coordinate System to Represent Many Useful Transformations

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

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

General Pivot-Point Rotation (xr,yr) Translate Rotate Translate

Steps : Gen Pivot Point Rotation Translate the object so that pivot position is moved to origin Rotate the object about the co-ordinate origin Translate the object so that pivot is returned to the original position

General Fixed-Point Scaling (xf,yf) Translate Scale Translate

Steps: Gen Fixed Point Scaling Translate the object so that fixed point coincides with the origin Scale the object w.r.t co-ordinate origin Use inverse Translation of step 1 to return the object to its original position

Reflection Reflection with respect to the axis • Refl abt x-axis Refl abt y-axis Refl -axis perpen x-same, y-flips x-flips, y-same to xy- plane x-flips, y-flips y 1 y y 1 1’ 1’ 2 3 2 3 3’ 2 3’ 2 x x x 3 2’ 3’ 1 2 1’

Reflection Reflection with respect to a Line Clockwise rotation of 45  Reflection about the x axis  Counterclockwise rotation of 45 x y y=x x y 1 3 2 1’ 3’ 2’ x y x y

Shear Unit sqare Converted to a parallelogram with x’ = x + shx · y, y’ = y Transformed to a shifted parallelogram (Y = Yref) x’ = x + shx · (y-yref), y’ = y (Shx=2) x y x y (1,1) (0,1) (2,1) (3,1) (0,0) (1,0) (0,0) (1,0) (Shx=2) x y x y (2,1) (1,1) (1,1) (0,1) (1/2,0) (3/2,0) (0,0) (1,0) (0,-1) (Shx=1/2, yref=-1)

Shear Y-direction shear relative to line (X = Xref) x’ = x, y’ = shy · (x-xref) + y (1,2) (0,3/2) x y y (1,1) (0,1) (0,1/2) (1,1) x (0,0) (1,0) (-1,0) (Shy=1/2, xref=-1)