Computer Graphics 02/10/09Lecture 41 Computer Graphics Lecture 3 Transformations.

Slides:



Advertisements
Similar presentations
Computer Graphics: 2D Transformations
Advertisements

Today Composing transformations 3D Transformations
7.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 7 Introducing SVG Transformations on Elements.
ECE201 Lect-41 Sinusoids (8.1); Phasors (8.3); Complex Numbers (Appendix) Dr. Holbert January 30, 2006.
Lecture 3: Transformations and Viewing. General Idea Object in model coordinates Transform into world coordinates Represent points on object as vectors.
Affine Transformations
Homogeneous Transformations CSE167: Computer Graphics Instructor: Steve Rotenberg UCSD, Fall 2005.
Computer Graphics 2D & 3D Transformation.
Transformations Ed Angel Professor Emeritus of Computer Science
CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Computer Graphics Lecture 4 Geometry & Transformations.
Technische Universität München Fakultät für Informatik Computer Graphics SS 2014 Transformations Rüdiger Westermann Lehrstuhl für Computer Graphik und.
Transformations.
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.
Elementary 3D Transformations - a "Graphics Engine" Transformation procedures Transformations of coordinate systems Translation Scaling Rotation.
Transformations Objectives Understand how transformations work in 2D and 3D Understand the concept of homogenous coordinate system Understand scene graphs.
3-D Geometry.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
Rotations and Translations. Representing a Point 3D A tri-dimensional point A is a reference coordinate system here.
Computer Graphics with OpenGL 3e
Computer Graphics (Fall 2004) COMS 4160, Lecture 3: Transformations 1
Screw Rotation and Other Rotational Forms
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
CAP4730: Computational Structures in Computer Graphics
2D Transformations. World Coordinates Translate Rotate Scale Viewport Transforms Hierarchical Model Transforms Putting it all together.
CS 450: Computer Graphics 2D TRANSFORMATIONS
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
Rotations and Translations
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Transformations Aaron Bloomfield CS 445: Introduction to Graphics
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Transformation & Projection Feng Yu Proseminar Computer Graphics :
Lecture Notes: Computer Graphics.
Geometric Transforms Changing coordinate systems.
Autonomous Navigation for Flying Robots Lecture 2.2: 2D Geometry
CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.
Transformations Jehee Lee Seoul National University.
Geometric Transformations
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
POSITION & ORIENTATION ANALYSIS. This lecture continues the discussion on a body that cannot be treated as a single particle but as a combination of a.
Robot Kinematics: Position Analysis 2.1 INTRODUCTION  Forward Kinematics: to determine where the robot ’ s hand is? (If all joint variables are known)
Two-Dimensional Geometric Transformations ch5. 참조 Subjects : Basic Transformations Homogeneous Coordinates Composite Transformations Other Transformations.
Geometric Transformations Hearn & Baker Chapter 5 Some slides are taken from Robert Thomsons notes.
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
Affine Geometry.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
Computer Graphics Matrices
Honours Graphics 2008 Session 2. Today’s focus Vectors, matrices and associated math Transformations and concatenation 3D space.
Computer Graphics I, Fall 2010 Transformations.
CS 551 / 645: Introductory Computer Graphics Viewing Transforms.
CS 325 Introduction to Computer Graphics 02 / 19 / 2010 Instructor: Michael Eckmann.
4. Affine transformations. Reading Required:  Watt, Section 1.1. Further reading:  Foley, et al, Chapter  David F. Rogers and J. Alan Adams,
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.
Geometric Transformations Hearn & Baker Chapter 5
Computer Graphics CC416 Week 15 3D Graphics.
Computer Graphics Transformations.
2D Transformations with Matrices
Computer Graphics Transformations.
Introduction to Computer Graphics CS 445 / 645
Lecture 2 Transformations
COMP 175: Computer Graphics February 9, 2016
CSC4820/6820 Computer Graphics Algorithms Ying Zhu Georgia State University Transformations.
Transformations 3 University of British Columbia
2D Geometric Transformations
Geometrical Transformations
Presentation transcript:

Computer Graphics 02/10/09Lecture 41 Computer Graphics Lecture 3 Transformations

Computer Graphics 02/10/09Lecture 42 From the last lecture... –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

Computer Graphics 02/10/09Lecture 43 Transformations. Translation. –P=T + P Scale –P=S  P Rotation –P=R  P We would like all transformations to be multiplications so we can concatenate them  express points in homogenous coordinates.

Computer Graphics 02/10/09Lecture 44 Homogeneous coordinates Add an extra coordinate, W, to a point. –P(x,y,W). Two sets of homogeneous coordinates represent the same point if they are a multiple of each other. –(2,5,3) and (4,10,6) represent the same point. At least one component must be non-zero  (0,0,0) is not defined. If W  0, divide by it to get Cartesian coordinates of point (x/W,y/W,1). If W=0, point is said to be at infinity.

Computer Graphics 02/10/09Lecture 45 Translations in homogenised coordinates Transformation matrices for 2D translation are now 3x3.

Computer Graphics 02/10/09Lecture 46 Concatenation. We perform 2 translations on the same point:

Computer Graphics 02/10/09Lecture 47 Concatenation. Matrix product is variously referred to as compounding, concatenation, or composition

Computer Graphics 02/10/09Lecture 48 Concatenation. Matrix product is variously referred to as compounding, concatenation, or composition.

Computer Graphics 02/10/09Lecture 49 Properties of translations. Note : 3. translation matrices are commutative.

Computer Graphics 02/10/09Lecture 410 Homogeneous form of scale. Recall the (x,y) form of Scale : In homogeneous coordinates :

Computer Graphics 02/10/09Lecture 411 Concatenation of scales.

Computer Graphics 02/10/09Lecture 412 Homogeneous form of rotation.

Computer Graphics 02/10/09Lecture 413 Orthogonality of rotation matrices.

Computer Graphics 02/10/09Lecture 414 Other properties of rotation.

Computer Graphics 02/10/09Lecture 415 How are transforms combined? (0,0)‏ (1,1)‏ (2,2)‏ (0,0)‏ (5,3)‏ (3,1)‏ Scale(2,2)‏Translate(3,1)‏ TS = = Scale then Translate Use matrix multiplication: p' = T ( S p ) = TS p Caution: matrix multiplication is NOT commutative!

Computer Graphics 02/10/09Lecture 416 Non-commutative Composition Scale then Translate: p' = T ( S p ) = TS p Translate then Scale: p' = S ( T p ) = ST p (0,0)‏ (1,1)‏ (4,2)‏ (3,1)‏ (8,4)‏ (6,2)‏ (0,0)‏ (1,1)‏ (2,2)‏ (0,0)‏ (5,3)‏ (3,1)‏ Scale(2,2)‏Translate(3,1)‏ Scale(2,2)‏

Computer Graphics 02/10/09Lecture 417 TS = ST = Non-commutative Composition Scale then Translate: p' = T ( S p ) = TS p = = Translate then Scale: p' = S ( T p ) = ST p

Computer Graphics 02/10/09Lecture 418 How are transforms combined? (0,0)‏ (1,1)‏ (0,sqrt(2))‏ (0,0)‏ (3,sqrt(2))‏ (3,0)‏ Rotate 45 deg‏Translate(3,0)‏ Rotate then Translate Caution: matrix multiplication is NOT commutative! Translate then Rotate (0,0)‏ (1,1)‏ (0,0)‏ (3,0)‏ Rotate 45 deg‏ Translate(3,0)‏(3/sqrt(2),3/sqrt(2))‏

Computer Graphics 02/10/09Lecture 419 TR = RT = Non-commutative Composition Rotate then Translate: p' = T ( R p ) = TR p = = Translate then Rotate: p' = R ( T p ) = RT p

Computer Graphics 02/10/09Lecture 420 Types of transformations. Rotation and translation –Angles and distances are preserved –Unit cube is always unit cube –Rigid-Body transformations. Rotation, translation and scale. –Angles & distances not preserved. –But parallel lines are.

Computer Graphics 02/10/09Lecture 421 Transformations of coordinate systems. Have been discussing transformations as transforming points. Always need to think the transformation in the world coordinate system Useful to think of them as a change in coordinate system. Model objects in a local coordinate system, and transform into the world system.

Computer Graphics 02/10/09Lecture 422 Transformations of coordinate systems - Example Concatenate local transformation matrices from left to right Can obtain the local – world transformation matrix p’,p’’,p’’’ are the world coordinates of p after each transformation

Computer Graphics 02/10/09Lecture 423 Transformations of coordinate systems - example pn is the world coordinate of point p after n transformations

Computer Graphics 02/10/09Lecture 424 Quiz I sat in the car, and realized the side mirror is 0.4m on my right and 0.3m in my front I started my car and drove 5m forward, turned 30 degrees to right, moved 5m forward again, and turned 45 degrees to the right, and stopped What is the position of the side mirror now, relative to where I was sitting in the beginning?

Computer Graphics 02/10/09Lecture 425 Solution The side mirror position is locally (0,4,0.3)‏ The matrix of first driving forward 5m is

Computer Graphics 02/10/09Lecture 426 Solution The matrix to turn to the right 30 and 45 degrees (rotating -30 and -45 degrees around the origin) are

Computer Graphics 02/10/09Lecture 427 Solution The local-to-global transformation matrix at the last configuration of the car is The final position of the side mirror can be computed by TR 1 TR 2 p which is around ( , )‏

Computer Graphics 02/10/09Lecture 428 This is convenient for character animation / robotics In robotics / animation, we often want to know what is the current 3D location of the end effectors (like the hand)‏ Can concatenate matrices from the origin of the body towards the end effecter

Computer Graphics 02/10/09Lecture 429 Transformations of coordinate systems.

Computer Graphics 02/10/09Lecture 430 3D Transformations. Use homogeneous coordinates, just as in 2D case. Transformations are now 4x4 matrices. We will use a right-handed (world) coordinate system - ( z out of page ). z (out of page)‏ y x

Computer Graphics 02/10/09Lecture 431 Translation in 3D. Simple extension to the 3D case:

Computer Graphics 02/10/09Lecture 432 Scale in 3D. Simple extension to the 3D case:

Computer Graphics 02/10/09Lecture 433 Rotation in 3D Need to specify which axis the rotation is about. z-axis rotation is the same as the 2D case.

Computer Graphics 02/10/09Lecture 434 Rotating About the x-axis R x (  )‏

Computer Graphics 02/10/09Lecture 435 Rotating About the y-axis R y (  )‏

Computer Graphics 02/10/09Lecture 436 Rotation About the z-axis R z (  )‏

Computer Graphics 02/10/09Lecture 437 Rotation in 3D For rotation about the x and y axes:

Computer Graphics 02/10/09Lecture 438 Rotation about an arbitrary axis About (u x, u y, u z ), a unit vector on an arbitrary axis x' y' z' 1 = xyz1xyz1 u x u x (1-c)+c u y u x (1-c)+u z s u z u x (1-c)-u y s u z u x (1-c)-u z s u z u x (1-c)+c u y u z (1-c)+u x s 0 u x u z (1-c)+u y s u y u z (1-c)-u x s u z u z (1-c)+c 0 where c = cos θ & s = sin θ Rotate(k, θ)‏ x y z θ u

Computer Graphics 02/10/09Lecture 439 Transform Left-Right, Right-Left Transforms between world coordinates and viewing coordinates. That is: between a right-handed set and a left- handed set.

Computer Graphics 02/10/09Lecture 440 Shearing

Computer Graphics 02/10/09Lecture 441 Calculating the world coordinates of all vertices For each object, there is a local-to-global transformation matrix So we apply the transformations to all the vertices of each object We now know the world coordinates of all the points in the scene

Computer Graphics 02/10/09Lecture 442 Normal Vectors We also need to know the direction of the normal vectors in the world coordinate system This is going to be used at the shading operation We only want to rotate the normal vector Do not want to translate it

Computer Graphics 02/10/09Lecture 443 Normal Vectors - (2)‏ We need to set elements of the translation part to zero

Computer Graphics 02/10/09Lecture 444 Viewing Now we have the world coordinates of all the vertices Now we want to convert the scene so that it appears in front of the camera

Computer Graphics 02/10/09Lecture 445 View Transformation We want to know the positions in the camera coordinate system We can compute the camera-to-world transformation matrix using the orientation and translation of the camera from the origin of the world coordinate system M c→w

Computer Graphics 02/10/09Lecture 446 View Transformation We want to know the positions in the camera coordinate system v w = M c→w v c v c = M c → w v w = M w→c v w Point in the world coordinate Point in the camera coordinate Camera-to-world transformation

Computer Graphics 02/10/09Lecture 447 Summary. Using homogeneous transformation, translation, rotation and scaling can all be represented by multiplication of a 4x4 matrix Multiplication from left-to-right can be considered as the transformation of the coordinate system Need to multiply the camera matrix from the left at the end Reading: Foley et al. Chapter 5, Appendix 2 sections A1 to A5 for revision and further background (Chapter 5)‏