2D transformations and homogeneous coordinates Dr Nicolas Holzschuch University of Cape Town Modified.

Slides:



Advertisements
Similar presentations
Today Composing transformations 3D Transformations
Advertisements

Points, Vectors, Lines, Spheres and Matrices
Transformations Ed Angel Professor Emeritus of Computer Science
1 3D Vector & Matrix Chapter 2. 2 Vector Definition: Vector is a line segment that has the direction. The length of the line segment is called the magnitude.
Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
Picture Manipulation The manipulation of (already created) pictures. May be applied to vector graphics or bitmaps. We will consider bitmaps and introduce.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Transformations Week 2,
Transformations II Week 2, Wed Jan 17
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
2D Geometric Transformations
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.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2005 Some slides from Steve Seitz
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Graphics Programming Graphics Programming: Transformations.
CAP4730: Computational Structures in Computer Graphics
1 Computer Graphics Week7 -2D Rotation. 3-Rotation A shape can be rotated about any of the three axes. A rotation about the z-axis will actually rotate.
Introduction to 3D Graphics Lecture 3: General Camera Model Anthony Steed University College London.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices n New stuff Homogenous co-ordinates 3D transformations as matrices.
Image Warping (Szeliski 3.6.1) cs129: Computational Photography James Hays, Brown, Fall 2012 Slides from Alexei Efros and Steve Seitz
Rasterizing primitives: know where to draw the line Dr Nicolas Holzschuch University of Cape Town Modified.
CS 480/680 Computer Graphics Representation Dr. Frederick C Harris, Jr. Fall 2012.
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
Warping CSE 590 Computational Photography Tamara Berg.
Lecture Notes: Computer Graphics.
Geometric Transforms Changing coordinate systems.
Lecture 3 Transformations.
Defining complex objects Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki.
Spatial Descriptions and Transformations Sebastian van Delden USC Upstate
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
3D transformations Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki
1 Computer Graphics Week9 -3D Geometric Transformation.
Transformational Geometry CS418 Computer Graphics John C. Hart.
© 97 N. Holzschuch 3D objects representation and data structure Dr Nicolas Holzschuch University of Cape Town
Projections and Perspectives Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki.
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
Lecture 3 Transformations. 2D Object Transformations The functions used for modifying the size, location, and orientation of objects or of the camera.
ARCH 655 Parametric Modeling in Design Wei Yan, Ph.D., Associate Professor College of Architecture, Texas A&M University Lecture 5 Matrices and Transforms.
Multimedia Programming 07: Image Warping Keyframe Animation Departments of Digital Contents Sang Il Park.
3-D Transformational Geometry CS418 Computer Graphics John C. Hart.
Fall 2004CS-321 Dr. Mark L. Hornick 1 2-D Transformations World Coordinates Local/Modelling Coordinates x y Object descriptions Often defined in model.
Computer Graphics Matrices
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
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.
Coordinate Systems and Transformations
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.
Computer Graphics I, Fall 2010 Transformations.
Computer Graphics Lecture 16 Fasih ur Rehman. Last Class Homogeneous transformations Types of Transformations – Linear Transformations – Affine Transformations.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Clipping Polygons Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki
Image Warping 2D Geometric 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.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Modeling Transformations
Clipping Polygon Clipping Polygon : Area primitive
Introduction to Computer Graphics CS 445 / 645
Transformations 3 University of British Columbia
COMP 175: Computer Graphics February 21, 2016
3D Transformation CS380: Computer Graphics Sung-Eui Yoon (윤성의)
Geometrical Transformations
Transformations.
3D transformations Dr Nicolas Holzschuch University of Cape Town
Transformations 2 University of British Columbia
Projections and Perspectives
Presentation transcript:

2D transformations and homogeneous coordinates Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki

Map of the lecture Transformations in 2D: –vector/matrix notation –example: translation, scaling, rotation Homogeneous coordinates: –consistent notation –several other good points (later) Composition of transformations Transformations for the window system

Transformations in 2D In the application model: –a 2D description of an object (vertices) –a transformation to apply Each vertex is modified: x’ = f(x,y) y’ = g(x,y) Express the modification

Translations Each vertex is modified: x’ = x+t x y’ = y+t y Before After

Translations: vector notation Use vector for the notation: –makes things simpler A point is a vector: A translation is merely a vector sum: P’ = P + T

Scaling in 2D Coordinates multiplied by the scaling factor: x’ = s x x y’ = s y y Before After

Scaling in 2D, matrix notation Scaling is a matrix multiplication: P’ = S P

Rotating in 2D New coordinates depend on both x and y x’ = cos  x - sin  y y’ = sin  x + cos  y Before After 

Rotating in 2D, matrix notation A rotation is a matrix multiplication: P’= R P

2D transformations, summary Vector-matrix notation simplifies writing: –translation is a vector sum –rotation and scaling are matrix-vector multiplication I would like a consistent notation: –that expresses all three identically –that expresses combination of these also identically How to do this?

Homogeneous coordinates Introduced in mathematics: –for projections and drawings –used in artillery, architecture –used to be classified material (in the 1850s) Add a third coordinate, w A 2D point is a 3 coordinates vector:

Homogeneous coordinates (2) Two points are equal if and only if: x’/w’ = x/w and y’/w’= y/w w=0: points at infinity –useful for projections and curve drawing Homogenize = divide by w. Homogenized points:

Translations with homogeneous

Scaling with homogeneous

Rotation with homogeneous

Composition of transformations To compose transformations, multiply the matrices: –composition of a rotation and a translation: M = RT all transformations can be expressed as matrices –even transformations that are not translations, rotations and scaling

Rotation around a point Q Rotation about a point Q: –translate Q to origin ( T Q ), –rotate about origin ( R  ) –translate back to Q ( - T Q ). P’= ( - T Q )R  T Q P

Beware! Matrix multiplication is not commutative The order of the transformations is vital –Rotation followed by translation is very different from translation followed by rotation –careful with the order of the matrices! Small commutativity: –rotation commute with rotation, translation with translation…

From World to Window Inside the application: –application model –coordinates related to the model –possibly floating point On the screen: –pixel coordinates –integer –restricted viewport: umin/umax, vmin/vmax

From Model to Viewport xminxmax ymin ymax

From Model to Viewport Model is (xmin,ymin)-(xmax,ymax) Viewport is (umin,vmin)-(umax,vmax) Translate by (-xmin,-ymin) Scale by Translate by (umin,vmin) M = T’ST umax-umin xmax-xmin vmax-vmin ymax-ymin, ()

From Model to Viewport Model Coordinates Pixel Coordinates

Mouse position: inverse problem Mouse click: coordinates in pixels We want the equivalent in World Coord –because the user has selected an object –to draw something –for interaction How can we convert from window coordinates to model coordinates?

Simply inverse the matrix: Mouse click: inverse problem Pixels coordinates Model Coordinates

2D transformations: conclusion Simple, consistent matrix notation –using homogeneous coordinates –all transformations expressed as matrices Used by the window system: –for conversion from model to window –for conversion from window to model Used by the application: –for modeling transformations