C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 1/29 Geometric Transformations Readings: Chapters 5-6.

Slides:



Advertisements
Similar presentations
COMPUTER GRAPHICS 2D TRANSFORMATIONS.
Advertisements

Computer Graphics Lecture 4 Geometry & Transformations.
Geometric Transformations
Informationsteknologi Wednesday, November 7, 2007Computer Graphics - Class 51 Today’s class Geometric objects and transformations.
CMPE 466 COMPUTER GRAPHICS
Math 1Hofstra University – CSC171A1 Modeling Objects by Polygonal Approximations Define volumetric objects in terms of surfaces patches that surround the.
HCI 530 : Seminar (HCI) Damian Schofield. HCI 530: Seminar (HCI) Transforms –Two Dimensional –Three Dimensional The Graphics Pipeline.
1 CSCE 441 Computer Graphics: 2D Transformations Jinxiang Chai.
2.1 si SI31 Advanced Computer Graphics AGR Lecture 2 Basic Modelling.
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
©College of Computer and Information Science, Northeastern UniversityJune 26, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture 11.
Course Website: Computer Graphics 3: 2D Transformations.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Stuff Andries van Dam September 12, 2006 Transformations 1/33 Transformations.
Transformations CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
Computer Graphics with OpenGL 3e
Geometric Transformations
2D Transformations Unit - 3. Why Transformations? In graphics, once we have an object described, transformations are used to move that object, scale it.
3D Graphics Goal: To produce 2D images of a mathematically described 3D environment Issues: –Describing the environment: Modeling (mostly later) –Computing.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Geometric Objects and Transformations Geometric Entities Representation vs. Reference System Geometric ADT (Abstract Data Types)
1 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
Hierarchical Transformations Hierarchical Models Scene Graphs
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
C O M P U T E R G R A P H I C S Stuff Jian Chen January 15, 2010 Transformations 1/28 Geometric Transformations By Andries van Dam.
COMP 175: Computer Graphics March 10, 2015
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Objectives Review some advanced topics, including Review some advanced topics, including Chapter 8: Implementation Chapter 8: Implementation Chapter 9:
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam September 14, 2004 Transformation 1/32 Transformations.
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.
Mathematical Foundations Sections A-1 to A-5 Some of the material in these slides may have been adapted from university of Virginia, MIT and Åbo Akademi.
Lecture Notes: Computer Graphics.
Geometric Transforms Changing coordinate systems.
Geometric Transformations Jehee Lee Seoul National University.
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.
1 Scene Graphs ©Anthony Steed Scene Graph Overview n Building Scene Structures n Traversal n Examples n Instancing and Re-Use n More Transformations.
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
1 Scene Graphs Week 4.2 ©Anthony Steed
16/5/ :47 UML Computer Graphics Conceptual Model Application Model Application Program Graphics System Output Devices Input Devices API Function.
Transformation.
Introduction to Computer Graphics Geometric Transformations
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.
David Luebke1/10/2016 CS 551 / 645: Introductory Computer Graphics David Luebke
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
January 19, y X Z Translations Objects are usually defined relative to their own coordinate system. We can translate points in space to new positions.
Affine Geometry.
Computer Graphics Matrices
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
Honors Geometry.  We learned how to set up a polygon / vertex matrix  We learned how to add matrices  We learned how to multiply matrices.
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.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Geometric Transformations Ceng 477 Introduction to Computer Graphics Computer Engineering METU.
CSCE 441 Computer Graphics: 2D Transformations
Modeling Transformation
Transformations. Modeling Transformations  Specify transformations for objects  Allows definitions of objects in own coordinate systems  Allows use.
Transforms.
Computer Graphics Transformations.
Computer Graphics Transformations.
COMP 175: Computer Graphics February 9, 2016
2D Geometric Transformations
Geometric Objects and Transformations (II)
Presentation transcript:

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 1/29 Geometric Transformations Readings: Chapters 5-6

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 2/29 Announcement Proj 1 posted on 2/2, due two weeks from today.

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 3/29 Translate [1,3] by [7,9] Scale [2,3] by 5 in the X direction and 10 in the Y direction Rotate [2,2] by 90 ° ( π /2) What is the result for each of the following two cases applied to the house in the figure. Exercises Case 1: Translate by x=6, y=0 then rotate by 45º Case 2: Rotate by 45 and then translate by x=6, y=0

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 4/29 Translate [1,3] by [7,9] Scale [2,3] by 5 in the X direction and 10 in the Y direction Rotate [2,2] by 90 ° ( π /2) Examples

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 5/29 Scene graph (DAG) construction from primitives Object motion (this lecture) Camera motion (next lecture on viewing) ROBOT transformation upper bodylower body headtrunkarm base Scenegraph (see Sceneview assignment) stanchion “is composed of hierarchy” Why do we need geometric Transformations (T,R,S) in Graphics? More on scenegraphs on Slide 18

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 6/29 2D Transformations

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 7/29 Component-wise addition of vectors v’ = v + t where and x’ = x + dx y’ = y + dy To move polygons: translate vertices (vectors) and redraw lines between them Preserves lengths (isometric) Preserves angles (conformal) Translation is thus "rigid-body" dx = 2 dy = 3 Y X Side effect: House shifts position relative to origin 2D Translation (Points designate origin of object's local coordinate system)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 8/29 Component-wise scalar multiplication of vectors v’ = Sv where and Does not preserve lengths Does not preserve angles (except when scaling is uniform) 2D Scaling Side effect: House shifts position relative to origin

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 9/29 v’ = R θ v where and x’ = x cos Ө – y sin Ө y’ = x sin Ө + y cos Ө A rotation by 0 angle, i.e. no rotation at all, gives us the identity matrix Preserves lengths in objects, and angles between parts of objects Rotation is rigid-body Y X D Rotation Side effect: House shifts position relative to origin Rotate by  about the origin

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 10/29 Suppose object is not centered at origin and we want to scale and rotate it. Solution: move to the origin, scale and/or rotate in its local coordinate system, then move it back. This sequence suggests the need to compose successive transformations… 2D Rotation and Scale are Relative to Origin Object’s local coordinate system origin

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 11/29 Translation, scaling and rotation are expressed as: Composition is difficult to express – translation is not expressed as a matrix multiplication Homogeneous coordinates allows expression of all three transformations as 3x3 matrices for easy composition w is 1 for affine transformations in graphics Note: This conversion does not transform p. It is only changing notation to show it can be viewed as a point on w = 1 hyperplane translation: scale: rotation: v’ = v + t v’ = Sv v’ = Rv Homogenous Coordinates becomes

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 12/29 For points written in homogeneous coordinates, translation, scaling and rotation relative to the origin are expressed homogeneously as: 2D Homogeneous Coordinate Transformations

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 13/29 Avoiding unwanted translation when scaling or rotating an object not centered at origin: – translate object to origin, perform scale or rotate, translate back. How would you scale the house by 2 in “its” y and rotate it through 90° ? Remember: matrix multiplication is not commutative! Hence order matters! (Refer to class website: resources/SIGGRAPH2001_courseNotes_source/tr ansformation for camera transformation) Matrix Compositions: Using Translation

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 14/29 Matrix Multiplication is NOT Commutative Translate by x=6, y=0 then rotate by 45º Rotate by 45º then translate by x=6, y= Y X

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 15/29 3D Transformations

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 16/29 Translation Scaling (right-handed coordinate system) x y z 3D Basic Transformations (1/2)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 17/29 Rotation about X-axis (right-handed coordinate system) Rotation about Y-axis Rotation about Z-axis 3D Basic Transformations (2/2)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 18/29 More transformation matrices

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 19/29 “Skew” a scene to the side: Squares become parallelograms - x coordinates skew to right, y coordinates stay same Degree between axes becomes Ө Like pushing top of deck of cards to the side – each card shifts relative to the one below Notice that the base of the house (at y=1) remains horizontal, but shifts to the right. Y X NB: A skew of 0 angle, i.e. no skew at all, gives us the identity matrix, as it should Skew/Shear/Translate (1/2) 2D non-homogeneous 2D homogeneous

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 20/29 Scene graph manipulation

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 21/29 3D scenes are often stored in a scene graph: – Open Scene Graph – Sun’s Java3D™ – X3D ™ (VRML ™ was a precursor to X3D) Typical scene graph format: – objects (cubes, sphere, cone, polyhedra etc.) – stored as nodes (default: unit size at origin) – attributes (color, texture map, etc.) and transformations are also nodes in scene graph (labeled edges on slide 2 are an abstraction) Transformations in Scene Graphs (1/3)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 22/29 ROBOT upper bodylower body headtrunk arm stanchion base 1. Leaves of tree are standard size object primitives 2. We transform them 3. To make sub-groups 4. Transform subgroups 5. To get final scene Closer look at Scenegraph from slide 2 … Transformations in Scene Graphs (2/3)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 23/29 Transformations affect all child nodes Sub-trees can be reused, called group nodes – instances of a group can have different transformations applied to them (e.g. group3 is used twice– once under t1 and once under t4) – must be defined before use object nodes (geometry) transformation nodes group nodes group3 obj3obj4 t5t6 t4 root t0 group1 t1t2 obj1group3 t3 group2 group3obj2 Transformations in Scene Graphs (3/3)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 24/29 Transformation nodes contain at least a matrix that handles the transformation; – may also contain individual transformation parameters To determine final composite transformation matrix (CTM) for object node: – compose all parent transformations during prefix graph traversal – exact detail of how this is done varies from package to package, so be careful Composing Transformations in a Scene Graph (1/2)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 25/29 Example: - for o1, CTM = m1 - for o2, CTM = m2* m3 - for o3, CTM = m2* m4* m5 - for a vertex v in o3, position in the world (root) coordinate system is: CTM v = (m2*m4*m5)v g: group nodes m: matrices of transform nodes o: object nodes m5 m1m2 m3 m4 o1 o2 o3 g1 g2 g3 Composing Transformations in a Scene Graph (2/2)

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 26/29 Exercises

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 27/29 Create a transform matrix that takes points in the rectangle [x l, x h ] x [y l, y h ] to the rectangle [x l ’, x h ’], [y l ’, y h ’] (Shirley Figure 6.18) E1: Windowing transforms =

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 28/29 Create a transform matrix that takes a point in the (X,Y) coordinate system to the point in the (U, V) coordinate system; and vice versa (Shirley Figure 6.20) E2: Transformation between two coordinate systems

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 29/29 Take-home exercise E3: Rotation about arbitrary axis

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 30/29 (right-handed coordinate system) Rotation axis specification

C O M P U T E R G R A P H I C S Stuff CMSC 435 / 634 Transformations 31/29 Rotation about arbitrary axis