GEOMETRIC TRANSFORMATIONS Yingcai Xiao

Slides:



Advertisements
Similar presentations
Computer Graphics: 3D Transformations
Advertisements

Transformations Ed Angel Professor Emeritus of Computer Science
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
1 Computer Graphics Chapter 6 2D Transformations.
Two-Dimensional Geometric Transformations
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2008 Some slides from Steve Seitz
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
04 – Geometric Transformations Overview Geometric Primitives –Points, Lines, Planes 2D Geometric Transformations –Translation, Rotation, Scaling, Affine,
Computer Graphics: Programming, Problem Solving, and Visual Communication Steve Cunningham California State University Stanislaus and Grinnell College.
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
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.
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Transformations Angel Angel: Interactive Computer Graphics5E © Addison-Wesley
Geometric Objects and Transformation
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Introduction to Computer Graphics Geometric 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
Review on Graphics Basics. Outline Polygon rendering pipeline Affine transformations Projective transformations Lighting and shading From vertices to.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
CSCI 425/ D Mathematical Preliminaries. CSCI 425/525 2 Coordinate Systems Z X Y Y X Z Right-handed coordinate system Left-handed coordinate system.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
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,
Yingcai Xiao Yingcai Xiao Chapter 3 Computer Graphics Primer.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Computer Graphics Lecture 17 3-D Transformations-I Taqdees A. Siddiqi
Image Warping 2D Geometric Transformations
Transformations. Transformations Introduce standard transformations ◦ Rotation ◦ Translation ◦ Scaling ◦ Shear Derive homogeneous coordinate transformation.
Instructor: Dr. Shereen Aly Taie Basic Two-Dimensional Geometric Transformation 5.2 Matrix Representations and Homogeneous Coordinates 5.3 Inverse.
Objectives Introduce standard transformations Introduce standard transformations Derive homogeneous coordinate transformation matrices Derive homogeneous.
Chapter 11 Three-Dimensional Geometric and Modeling Transformations
CS5500 Computer Graphics March 6, 2006.
Modeling Transformations
Math Fundamentals Maths revisit.
Transformations Objectives
3D Geometric Transformation
3. Transformation
Geometric Transformations Hearn & Baker Chapter 5
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
2D Transformations with Matrices
3D Transformation.
3D Geometric Transformations
Clipping Polygon Clipping Polygon : Area primitive
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Computer Graphics Transformations
Lecture 2 Transformations
Line and Character Attributes 2-D Transformation
CSC461: Lecture 19 Computer Viewing
COMP 175: Computer Graphics February 9, 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Viewing and Perspective Transformations
Transformations Ed Angel
Transformations Ed Angel Professor Emeritus of Computer Science
Geometrical Transformations
Isaac Gang University of Mary Hardin-Baylor
Transformations.
TWO DIMENSIONAL TRANSFORMATION
Translation in Homogeneous Coordinates
Presentation transcript:

GEOMETRIC TRANSFORMATIONS Yingcai Xiao

Roadmap to Geometric Transformations Start with 2D GT Extend to 3D GT Preview mathematics Express GT in four type of notations Algebraic Matrix Logical Visual

Review of Mathematical Preliminaries Mathematical Notations Points: Vectors: directional lines P1(x1,y1) P0(x0,y0)

1. A vector has a direction and a length: Length: |V|=(x2 + y2)1/2 A unit vector: |V| = 1 e.g.: Normalize a vector: 2. Add two vectors 3. Scalar Multiplication

4. Dot product of two vectors scalar , V W  V  W if  = 90 => cos = 0 => V  W = 0. if  < 90 => cos > 0 => V  W > 0. if  > 90 => cos < 0 => V  W < 0. 5.Normal: a unit vector perpendicular to a surface

A point p(xp,yp) is on the line if f(xp,yp) = 0. When b < 0: Lines y = mx+b e.g.: y = x;   ax+by+c=0 Let f(x,y) = ax + by + c A point p(xp,yp) is on the line if f(xp,yp) = 0. When b < 0: p(xp,yp) is above the line if f(xp,yp) < 0. p(xp,yp) is below the line if f(xp,yp) > 0. When b > 0: p(xp,yp) is above the line if f(xp,yp) > 0. p(xp,yp) is below the line if f(xp,yp) < 0.

Parametric Form: P(t)=P0+t(P1-P0); 0 <= t <= 1 P1(x1,y1) P0(x0,y0) P(t)=P0+t(P1-P0)

Where, x(t) = x0 + t * (x1 – x0) y(t) = y0 + t * (y1 – y0) 0 <= t <= 1 x(t) = (1-t) * x0 + t * x1 y(t) = (1-t) * y0 + t * y1

2D Transformations Translate a point The algebraic representation of translation of point P(x,y) by D(dx,dy) is x’= x + dx y’= y + dy Its “matrix” representation is Its logical representation is P’ = P + D Its visual representation is   P’ (x’,y’) P(x,y) D(dx,dy)

To move a shape: translate every vertex of the shape 5 10 X Y Before Translation (4,5) (7,5) After Translation 5 10 X Y (7,1) (10,1)

Scaling (relative to the origin) Scale a point P(x,y) by S(sx, sy) Algebraic: x’=sx* x y’=sy* y Matrix: Logic: P’ = SP or P’ = S(sx, sy)P Scale a line P0P1 (scale each point) P0’=SP0 P1’=SP1

Scale a shape: scale every vertex of the shape. Visual representation 5 10 X Y After Scaling (2,5/4) (7/2,5/4) 5 10 X Y Before Scaling (4,5) (7,5) Uniform Scaling: sx=sy

Rotate (around the origin) Positive angles are measured counterclockwise from x axis to y axis.   Rotate point (x,y) around the origin Algebraic representation: x’ = x * cos - y * sin y’ = x * sin + y * cos Matrix representation: Logic representation: P’ = R P

Visual representation 5 10 X Y 5 10 X Y  Before After Rotate a shape: rotate every vertex of the shape 5 10 X Y (2.1, 4.9) (4.9, 7.8) (5,2) (9,2) Before Rotation After Rotation

Summary Translation: P’ = P + D Scaling: P’ = S P Rotation: P’ = R P Homogeneous Coordinates: P(x,y,w) (x,y) to (x,y,w) : (x,y,w) to (x,y)

y’= y + dy w’=1 x’= x + dx P’’ = T(dx2 , dy2)P’ = T(dx2 , dy2) T(dx1 , dy1) P = T(dx2+dx1, dy2+dy1) P

Scaling P’=S(Sx, Sy)P P’’ = S(Sx2 , Sy2)P’ = S(Sx2 , Sy2)S(Sx1 , Sy1) P = S(Sx2Sx1, Sy2Sy1)P

P’’=R(2)R(1)PP”=R(2+1)P Rotation   P’=R()P P’’=R(2)R(1)PP”=R(2+1)P

Shear Transformation: SHx(a) and SHy(b) P’=SHx(a)P Shear in x against y by a (or an angle). x’ = x+ay y’ = y w’=1

P’=SHy(b)P Shear in y against x by b (or an angle). x’=x y’=y + bx w’=1.

5 10 X Y 5 10 X Y Sheared in x 5 10 X Y Before Shear Sheared in y

Rigid-body Transformation: T and R. change: location, orientation; not change: size, angle between elements. Affine Transformation: S, SH change: size, location, angle; not change: line (parallelism). Note: uniform scaling is between the two. It changes size but not angle. So far, our S, R, SH are all around the origin.

Composition of 2D Transformation Rotate the house around P1 For every vertex (P) on the object: P’ = T(P1)R()T(-P1)P y y x After translation of P1 to origin y x After rotation  y x P1 After translation To P1

Scale and rotate the house around P1 and move it to P2 y x P1 Original house Translate P1 to origin Scale Rotate P2 Translate to final position P2

For every vertex (P) on the object: P’ = T(P2) R()S(Sx,Sy)T(-P1)P.   Swap the order of operations: not permitted, except uniform scaling (sx=sy) can be swapped with rotation.

Window-to-Viewport Transformation world-coordinate: inches, feet etc & screen-coordinate: pixels y World coordinates Window x Screen coordinates Viewport 1 Viewport 2 Window in world coordinates Window translated to origin Window scale to size of viewport Translated by (u,v) to final position Maximum range of screen coordinates

Matrix Representation of 3D Transformation y z Translation: Scaling:

Rotation, around Z-axis: Rotation, around X-axis: Rotation, around Y-axis:

Projection: Project 3D objects on to a 2D surface (0,0,0) d z P( x, y, z ) x P’(xp, yp, zp) xp Projection Plane (View Plane)

xp= x’ / w’ = x / (z/d + 1) yp= y’ / w’ = y / (z/d + 1)

  Foreshortening: The size of the projected object becomes smaller when the object moves away from the eye. z P’1 P’2 P1 P2 Perspective Projection: the projection that has the foreshortening effect.

For computer-aided design (CAD), we can not have foreshortening For computer-aided design (CAD), we can not have foreshortening. A meter long object should always measures to 1 meter regardless where it is. Parallel Projection: d  , lines of sight become parallel P1 z P2 View Plan (0,0,0)

Summary 2D GT Homogeneous coordinates 3D GT Rigid body transformation Affine transformation Perspective Projection & Foreshortening Parallel Projection