Introduction to Computer Graphics Geometric Transformations

Slides:



Advertisements
Similar presentations
Transformations Ed Angel Professor Emeritus of Computer Science
Advertisements

COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
Three Dimensional Modeling Transformations
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
1 Computer Graphics Chapter 6 2D Transformations.
25 May May May 2015Week 5-2D Transformations1 2D Transformations By: KanwarjeetSingh.
CMPE 466 COMPUTER GRAPHICS
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
CS 4731: Computer Graphics Lecture 7: Introduction to Transforms, 2D transforms Emmanuel Agu.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
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.
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
Mathematical Fundamentals
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.
Transformation of Graphics
Transformations Dr. Amy Zhang.
CS 480/680 Computer Graphics Transformations Dr. Frederick C Harris, Jr.
2D Transformation of Graphics
Lecture Notes: Computer 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
Part7: Geometric Transformations
Geometric Transformations
Chapter 7 Transformations.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
University of Palestine Faculty of Applied Engineering and Urban Planning Software Engineering Department Introduction to computer vision Chapter 2: Image.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics 2D Transformations. 2 of 74 Contents In today’s lecture we’ll cover the following: –Why transformations –Transformations Translation.
Geometric Objects and Transformation
Transformation.
Computer Graphics 3D Transformations. Translation.
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other 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
GEOMETRIC TRANFORMATIONS Presented By -Lakshmi Sahithi.
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
Affine Geometry.
Instructor: Mircea Nicolescu Lecture 9
Unit 10 Transformations. Lesson 10.1 Dilations Lesson 10.1 Objectives Define transformation (G3.1.1) Differentiate between types of transformations (G3.1.2)
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Computer Graphics I, Fall 2010 Transformations.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Transformations Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
Computer Graphic 2 D Transformation.
CSCE 441 Computer Graphics: 2D Transformations
Modeling Transformation
Forward Projection Pipeline and Transformations CENG 477 Introduction to Computer Graphics.
3. Transformation
2D Transformations By: KanwarjeetSingh
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
Computer Graphics Transformations.
Mobile Robot Kinematics
COMP 175: Computer Graphics February 9, 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
2-D Geometry.
Chapter IV Spaces and Transforms
2D Geometric Transformations
Reflections in Coordinate Plane
Presentation transcript:

Introduction to Computer Graphics Geometric Transformations EEL 5771-001 Introduction to Computer Graphics Geometric Transformations By Kiranmayi Karri U81100483

Outline Transformation Geometric Transformation 2D Transformation References

Transformation What is a transformation? An operation that changes one configuration into another. A geometric transformation maps positions that define the object to other positions Linear transformation means the transformation is defined by a linear function. Why use them? Modeling Moving the objects to the desired location in the environment Multiple instances of a prototype shape

Geometric Transformation In computer graphics many applications need to alter or manipulate a picture, for example, by changing its size, position or orientation. This can be done by applying a geometric transformation to the coordinate points defining the picture. Once the models are prepared, we need to place them in the environment .Objects are defined in their own local coordinate system .We need to translate, rotate and scale them to put them into the world coordinate system .

Types of Transformations Geometric Transformations Translation Rotation Scaling Linear Transformation Non-uniform scales, shears or skews Non-linear Transformation • Twists, bends, warps, morphs

2-D Transformations Translation A common requirement is to move a picture to a new position. Translation transform simply moves every point by a certain amount horizontally and a certain amount vertically. The original object and its translation have the same shape and size, and they face in the same direction.

2D Translation-Matrix Notation A translation moves all points in an object along the same straight-line path to new positions. The path is represented by a vector, called the translation or shift vector. We can write the components: p'x = px + tx p'y = py + ty or in matrix form: P' = P + T

Rotation 2-D Transformations A rotation is a transformation that turns a figure about a fixed point called the center of rotation.  An object and its rotation are the same shape and size, but the figures may be turned in different directions. Another common type of transformation is rotation. This is used to orientate objects. A rotation transform, rotates each point about the origin, (0,0). Every point is rotated through the same angle, called the angle of rotation. For this purpose, angles can be measured either in degrees or in radians. A rotation with a positive angle rotates points in the direction from the positive x-axis to the positive y-axis.

2D Rotation – Matrix Notation A rotation repositions all points in an object along a circular path in the plane centered at the pivot point.

Scaling 2-D Transformations Changing the size of an object is called a scale. We scale an object by scaling the x and y coordinates of each vertex in the object. We have two types of scaling, Uniform and Non-Uniform Scaling Uniform Scaling Uniform scaling is a linear transformation that enlarges or shrinks objects by a scale factor that is the same in all directions. The result of uniform scaling is similar  to the original. Uniform scaling happens, for example, when enlarging or reducing a photograph, or when creating a scale model of a building, car, airplane, etc.

Scaling 2-D Transformations Non Uniform Scaling Is obtained when at least one of the scaling factors is different from the others; a special case is directional scaling or stretching. Non-uniform scaling changes the shape of the object; e.g. a square may change into a rectangle, or into a parallelogram if the sides of the square are not parallel to the scaling axes (the angles between lines parallel to the axes are preserved, but not all angles). It occurs, for example, when a faraway billboard is viewed from an oblique angle, or when the shadow of a flat object falls on a surface that is not parallel to it.

2D Scaling-Matrix Notation

Homogeneous Coordinates Homogeneous coordinates are a way to handle projective geometric spaces easily. These are non-Euclidean geometries that represent non-linear projections, like a perspective projection. Now, they also use an extra coordinate. The transformation between a Cartesian coordinate system and a Homogeneous one is done by dividing all of the components of the Homogeneous coordinates by the last coordinate.

Homogenous Coordinates In Euclidean space (geometry), two parallel lines on the same plane cannot intersect, or cannot meet each other forever. It is a common sense that everyone is familiar with.  However, it is not true any more in projective space. Euclidean space (or Cartesian space) describe our 2D/3D geometry so well, but they are not sufficient to handle the projective space (Actually, Euclidean geometry is a subset of projective geometry). The Cartesian coordinates of a 2D point can be expressed as (x, y).  What if this point goes far away to infinity? The point at infinity would be (∞,∞), and it becomes meaningless in Euclidean space. The parallel lines should meet at infinity in projective space, but cannot do in Euclidean space. Solution to the problem of Euclidean Space is Homogeneous Coordinates Homogeneous coordinates, introduced by August Ferdinand Möbius, make calculations of graphics and geometry possible in projective space. Homogeneous coordinates are a way of representing N-dimensional coordinates with N+1 numbers.  To make 2D Homogeneous coordinates, we simply add an additional variable, w, into existing coordinates. Therefore, a point in Cartesian coordinates, (X, Y) becomes (x, y, w) in Homogeneous coordinates. And X and Yin Cartesian are re-expressed with x, y and w in Homogeneous as;  X = x/w  Y = y/w  For instance, a point in Cartesian (1, 2) becomes (1, 2, 1) in Homogeneous. If a point, (1, 2), moves toward infinity, it becomes (∞,∞) in Cartesian coordinates. And it becomes (1, 2, 0) in Homogeneous coordinates, because of (1/0, 2/0) = (∞,∞). Notice that we can express the point at infinity without using "∞".

Inverse Transformations

Composite 2-D Transformations We can represent any sequence of transformations as a single matrix. No special cases when transforming a point – matrix * vector. Composite transformations – matrix * matrix. Composite transformations: Rotate about an arbitrary point – translate, rotate, translate Scale about an arbitrary point – translate, scale, translate Change coordinate systems – translate, rotate, scale

Composite Transformation Transformation T followed by Transformation Q followed by Transformation R

Order of Composite transformation In composite transformations, the order of transformations is very important. Rotation followed by Translation: Translation followed by Rotation:

Rotation wrt x-axis and y-axis „To rotate about an arbitrary point P (px,py) by θ: „ Translate the object so that P will coincide with the origin: T(-px, -py) „ Rotate the object: R(θ) „ Translate the object back: T(px,py) . „ Translate the object so that P will coincide with the origin: T(-px, -py) „ Rotate the object: R(θ) „ Translate the object back: T(px,py) „

Rotation wrt. Arbitrary point To rotate about P1 (x1,y1), the following sequence of the fundamental transformations are needed: 1.Translate the object by (-x1, -y1)  2.Rotate (Ø) 3.Translate the object by (x1, y1) The matrix representation of these steps is  

Scaling wrt. Arbitrary point To scale about P1 (x1,y1), the following sequence of the fundamental transformations is needed 1.Translate the object by (-x1, -y1) 2.Scale by (Sx, Sy) 3.Translate the object by (x1, y1) This series of steps can be performed as following: 

Composite transformation order In a composite transformation, the order of the individual transformations is very important. Matrix operations are not cumulative. For example, the result of a Graphics → Rotate → Translate → Scale → Graphics operation will be different from the result of a Graphics → Scale → Rotate → Translate → Graphics operation. The main reason that order is significant is that transformations like rotation and scaling are done with respect to the origin of the coordinate system. The result of scaling an object that is centered at the origin is different from the result of scaling an object that has been moved away from the origin. Similarly, the result of rotating an object that is centered at the origin is different from the result of rotating an object that has been moved away from the origin. Scale → Rotate → Translate composite transformation

Composite transformation order Translate → Rotate → Scale composite transformation with Append Translate → Rotate → Scale composite transformation with Prepend

Rigid Motion A rigid motion is the action of taking an object and moving it to a different location without altering its shape or size. Reflections, rotations, translations, and glide reflections are all examples of rigid motions. In fact, every rigid motion is one of these four kinds.

Rigid Motion Reflection Every reflection is completely determined by its axis of reflection. 2. Every reflection is completely determined by a single point-image pair P and P 0 (provided that P 6= P 0 ). 3. The fixed points of a reflection are exactly the points on its axis of reflection. 4. Reflections are improper rigid motions (they reverse clockwise and counterclockwise orientations). 5. Applying the same reflection twice gives the identity motion.

Rigid Motion Rotation Every rotation is completely determined by its rotocenter and the angle of rotation. 2. A 360◦ rotation is equivalent to the identity motion. (So are720◦ , 1040◦ , . . . ) 3. A rotation that is not the identity has exactly one fixed point: the rotocenter. 4. Rotations are proper rigid motions (they preserve clockwise/counterclockwise orientations). 5. A rotation is determined by any two point-image pairs P, P 0 and Q, Q 0

Rigid Motion Translation 1. Every translation is completely determined by a vector of translation, v. 2. In a translation other than the identity, every point gets moved, so there are no fixed points. 3. Translations are proper rigid motions (they preserve clockwise/counterclockwise orientations). 4. A translation is determined by any one point-image pair P, P 0 . 5. The effect of a translation can be reversed by a translation in the opposite direction (with vector −v).

Reflections Reflection is nothing more than a rotation of the object by 180o. In case of reflection the image formed is on the opposite side of the reflective medium with the same size. Therefore we use the identity matrix with positive and negative signs according to the situation respectively.

Reflections

Reflections

Reflections wrt to an arbitrary axis

Shear in x and y -direction A shear along the x direction in 2D changes a rectangle (with lower right corner at the origin) into a parallelogram as follows The transformation has the properties: a) The y coordinate of any point (x,y) is unchanged b) the x coordinate is stretched in a linear way, based on the height of the point above the x axis - i.e. on y. Thus the coordinate change has the form: x' = x + ay y' = y where a is a constant that measures the degree of shearing. If a is negative then the shearing is in the opposite direction.

Matrix Notation A suitable multiplicative matrix description of the transform is given by: SHx(a) = | 1 a 0 | | 0 1 0 | | 0 0 1 | We can similarly introduce a shearing along the y axis, which would have the form: x' = x y' = y + bx and in this case a suitable matrix description is given by: SHy(b) = | 1 0 0 | | b 1 0 |

Raster Methods Raster Graphics Image is represented as a rectangular grid of colored pixels PIXEL = Pictu(X)re ELement Translation If you want to move a point (x0 , y0) to a new position (xt , yt) The transformation would be xt = x0 + dx and yt = y0 + dy For motion dx and dy are the components of the velocity vector dx = cos v and dy = - sin v

Raster Methods Scaling Rotation Multiply the coordinates of each vertex by the scale factor Everything will expand from the center The transformation would be xt = x0 * scale and yt = y0 * scale Rotation Spin and object around it centered around the z-axis Rotate each point the same angle Positive angles are clockwise Negative angles are counterclockwise C++ uses radians (not degrees) xt = x0 * cos() – y0 * sin() yt = y0 * cos() + x0 * sin()

3D Transformation A 3D point (x,y,z) – x,y, and z coordinates We will still use column vectors to represent points Homogeneous coordinates of a 3D point (x,y,z,1) Transformation will be performed using 4x4 matrix

Homogenous coordinates 3D Translation Very similar to 2D transformation Translation transformation Homogenous coordinates

Homogenous coordinates 3D Scaling Very similar to 2D transformation Scaling transformation Homogenous coordinates

3D Rotation 3D rotation is done around a rotation axis Fundamental rotations – rotate about x, y, or z axes Counter-clockwise rotation is referred to as positive rotation (when you look down negative axis)

3D Rotation wrt z-axis Rotation about z – similar to 2D rotation y + x

3D Rotation wrt y-axis Rotation about y: z -> y, y -> x, x->z

3D Rotation wrt x-axis Rotation about x (z -> x, y -> z, x->y) x z y Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters, y x z

3D Rotation about Arbitrary Axes Rotate p about the by the angle Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters, 43

Inverse of 3D Transformations Invert the transformation In general, X= AX’->x’=A-1X T(-tx,-ty,-tz) T(tx,ty,tz)

3D Rotation about Arbitrary Axes Rotate p about the by the angle Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters,

3D Rotation about Arbitrary Axes Translate so that rotation axis passes through the origin Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters,

3D Rotation about Arbitrary Axes Rotation by about z-axis Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters,

3D Rotation about Arbitrary Axes Rotation by about y-axis Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters,

3D Rotation about Arbitrary Axes Rotation by about z-axis Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters,

3D Rotation about Arbitrary Axes Rotation by about y-axis Transformation equations for rotations about the other two coordinate axes can be obtained with a cyclic permutation of the coordinate parameters,

3D Rotation about Arbitrary Axes Translate the object back to original point

3D Shearing

3D Reflection

3D Reflection Transformation

Affine Transformation

3D Coordinate Transformation Transform object description from to p

3D Coordinate Transformation Transform object description from to p

3D Coordinate Transformation Transform object description from to p

3D Coordinate Transformation Transform object description from to y x z

Composite 3D Transformation Similarly, we can easily extend composite transformation from 2D to 3D

Composite 3D Transformation

References http://www.math.tau.ac.il/~dcor/Graphics/cg-slides/geom3d.pdf http://www-inst.eecs.berkeley.edu/~cs184/fa05/lectures/lecture-04.pdf https://www.cg.tuwien.ac.at/courses/CG1/textblaetter/englisch/02%20Geometric%20Transformations%20(engl).pdf http://www.inf.ed.ac.uk/teaching/courses/cg/lectures/lect2cg2x6.pdf http://www.cs.trinity.edu/~jhowland/cs3353/intro/intro/ http://math.hws.edu/graphicsbook/c2/s3.html#graphics2d.3.2 http://cs455.cs.byu.edu/lectureslides/Discussion06.pdf https://cseweb.ucsd.edu/classes/wi03/cse167/lectures/lec9.pdf http://www.cs.cornell.edu/courses/cs4620/2014fa/lectures/10transforms3d.pdf https://www.math.ku.edu/~jmartin/courses/math105-F11/Lectures/chapter11-part3.pdf

References http://www.win.tue.nl/~vanwijk/2IV60/2IV60_3_2D_transformations.pdf http://www.dgp.toronto.edu/~hertzman/418notes.pdf http://nccastaff.bmth.ac.uk/hncharif/MathsCGs/Transformations.pdf http://www.in.tum.de/fileadmin/user_upload/Lehrstuehle/Lehrstuhl_XV/Teaching/SS07/ComputerGraphics/CG-06-Transformations.pdf http://web.cse.ohio-state.edu/~parent/classes/581/Lectures/5.2DtransformsAhandout.pdf https://en.wikipedia.org/wiki/Geometric_transformation http://cs.boisestate.edu/~tcole/cs341/fall04/vg/10ch53d.pdf