CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components.

Slides:



Advertisements
Similar presentations
Points, Vectors, Lines, Spheres and Matrices
Advertisements

CS 691 Computational Photography Instructor: Gianfranco Doretto Image Warping.
Computer Graphics Lecture 4 Geometry & Transformations.
Arbitrary Rotations in 3D Lecture 18 Wed, Oct 8, 2003.
Three Dimensional Modeling Transformations
1 ME 302 DYNAMICS OF MACHINERY Dynamic Force Analysis IV Dr. Sadettin KAPUCU © 2007 Sadettin Kapucu.
2D Geometric Transformations
Chapter 4.1 Mathematical Concepts
Image Warping : Computational Photography Alexei Efros, CMU, Fall 2006 Some slides from Steve Seitz
Chapter 4.1 Mathematical Concepts. 2 Applied Trigonometry Trigonometric functions Defined using right triangle  x y h.
2D/3D Geometric Transformations CS485/685 Computer Vision Dr. George Bebis.
Ch. 2: Rigid Body Motions and Homogeneous Transforms
3D Coordinate Systems and Transformations Revision 1
CSCE 590E Spring 2007 Basic Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
3-D Geometry.
Computer Graphics (Fall 2008) COMS 4160, Lecture 3: Transformations 1
MSU CSE 803 Fall 2008 Stockman1 CV: 3D sensing and calibration Coordinate system changes; perspective transformation; Stereo and structured light.
Linear Algebra Review CSE169: Computer Animation Instructor: Steve Rotenberg UCSD, Winter 2005.
Foundations of Computer Graphics (Fall 2012) CS 184, Lecture 3: Transformations 1
Mathematical Fundamentals
COS 397 Computer Graphics Svetla Boytcheva AUBG, Spring 2013.
Chapter 4.1 Mathematical Concepts
Geometric Transformation. So far…. We have been discussing the basic elements of geometric programming. We have discussed points, vectors and their operations.
Homogeneous Coordinates (Projective Space) Let be a point in Euclidean space Change to homogeneous coordinates: Defined up to scale: Can go back to non-homogeneous.
Geometric Transformations Jehee Lee Seoul National University.
2003CS Hons RW778 Graphics1 Chapter 5: Transforming Objects 5.2 Introduction to Transformations 5.2 Introduction to Transformations –Affine transformations.
Dx = 2 dy = 3 Y X D Translation A translation is applied to an object by repositioning it along a straight-line path.
Part7: Geometric Transformations
Transformations Jehee Lee Seoul National University.
CS 376 Introduction to Computer Graphics 02 / 16 / 2007 Instructor: Michael Eckmann.
Spatial Descriptions and Transformations Sebastian van Delden USC Upstate
©Larry F. Hodges (modified by Amos Johnson) 1 3-D Mathematical Preliminaries & Transformations.
Geometric Camera Models
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
Jinxiang Chai Composite Transformations and Forward Kinematics 0.
Transformations of Objects – 3D
Transformation.
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.
Geometric Transformations
12/24/2015 A.Aruna/Assistant professor/IT/SNSCE 1.
Geometric Transformations Sang Il Park Sejong University Many slides come from Jehee Lee’s.
Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.
3D Transformation A 3D point (x,y,z) – x,y, and z coordinates
Geometric Transformations UBI 516 Advanced Computer Graphics Aydın Öztürk
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.
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.
Affine Geometry.
Foundations of Computer Graphics (Spring 2012) CS 184, Lecture 3: Transformations 1
CSCE 552 Fall 2012 Math By Jijun Tang. Applied Trigonometry Trigonometric functions  Defined using right triangle  x y h.
Transformations of objects
Graphics Lecture 2: Slide 1 Lecture 2 Transformations for animation.
II-1 Transformations Transformations are needed to: –Position objects defined relative to the origin –Build scenes based on hierarchies –Project objects.
CS559: Computer Graphics Lecture 9: 3D Transformation and Projection Li Zhang Spring 2010 Most slides borrowed from Yungyu ChuangYungyu Chuang.
Composite 3D Transformations. Example of Composite 3D Transformations Try to transform the line segments P 1 P 2 and P 1 P 3 from their start position.
Geometric Transformations. Transformations Linear transformations Rigid transformations Affine transformations Projective transformations T Global reference.
Jinxiang Chai CSCE441: Computer Graphics 3D Transformations 0.
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.
2D Transformations What is transformations? The geometrical changes of an object from a current state to modified state. Why the transformations is needed?
Image Warping 2D Geometric Transformations
Modeling Transformation
CSE 167 [Win 17], Lecture 3: Transformations 1 Ravi Ramamoorthi
3. Transformation
Review: Transformations
Review: Transformations
Geometric Camera Models
Viewing and Perspective Transformations
Presentation transcript:

CSE 681 Review: Transformations

CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components relative to each other Viewing transformations placing virtual camera in the world transformation from world coordinates to camera coordinates Perspective projection of 3D coordinates to 2D Animation vary transformations over time to create motion

CSE 681 Transformations - Modeling

CSE 681 Transformations - Viewing WORLD OBJECT CAMERA

CSE 681 Modeling Transformations Transform objects/pointsTransform coordinate system

CSE 681 Affine Transformations Transform P = (x, y, z) to Q = (x’, y’, z’) by M. Affine transformation:

CSE 681 Translation Translation by (t x, t y, t z ): (t x, t y, t z )

CSE 681 Scaling Scaling by (s x, s y, s z ): Uniform v. non-uniform scaling

CSE 681 Rotation Rotation counter-clockwise by angle  around the z-axis: x’ = x cos(  ) – y sin(  ) y’ = x sin(  ) + y cos(  ) z’ = z Proof: x = r cos(  ) y = r sin(  ) x’ = r cos(  +  ) = r cos(  ) cos(  ) – r sin(  ) sin(  ) = x cos(  ) – y sin(  ) y’ = r sin(  +  ) = r cos(  ) sin(  ) + r sin(  ) cos(  ) = x sin(  ) + y cos(  ) x z y   r r

CSE 681 Rotation around x-axis Rotation counter-clockwise by angle  around the x-axis: x’ = x y’ = y cos(  ) – z sin(  ) z’ = y sin(  ) + z cos(  ) y x z 

CSE 681 Rotation around y-axis Rotation counter-clockwise by angle  around the y-axis: y’ = y z’ = z cos(  ) – x sin(  ) x’ = z sin(  ) + x cos(  ) Or x’ = x cos(  ) + z sin(  ) y’ = y z’ = – x sin(  ) + z cos(  ) z y x 

CSE 681 Matrix Multiplication Rotation counter-clockwise by angle  around the z-axis: x’ = x cos(  ) – y sin(  ) y’ = x sin(  ) + y cos(  ) z’ = z Translation by (t x, t y, t z ): x’ = x + t x y’ = y + t y z’ = z + t z Scaling by (s x, s y, s z ): x’ = s x x y’ = s y y z’ = s z z

CSE 681 Homogeneous Coordinates Scaling by (s x, s y, s z ): x’ = s x x y’ = s y y z’ = s z z Represent P by (x, y, z, 1) and Q by (x’, y’, z’, 1). (Homogeneous coordinates.) Translation by (t x, t y, t z ): x’ = x + t x y’ = y + t y z’ = z + t z

CSE 681 Rotation Matrices Rotation counter-clockwise by angle  around the x-axis: x’ = x y’ = y cos(  ) – z sin(  ) z’ = y sin(  ) + z cos(  ) Rotation counter-clockwise by angle  around the z-axis: x’ = x cos(  ) – y sin(  ) y’ = x sin(  ) + y cos(  ) z’ = z Rotation counter-clockwise by angle  around the y-axis: x’ = x cos(  ) + z sin(  ) y’ = y z’ = – x sin(  ) + z cos(  )

CSE 681 Affine Transformation Matrix Affine transformation: x’ = m 11 x + m 12 y + m 13 z + m 14 y’ = m 21 x + m 22 y + m 23 z + m 24 z’ = m 31 x + m 32 y + m 33 z + m 34 Transformation Matrix:

CSE 681 Shearing Shear along the x-axis: x’ = x + hy y’ = y z’ = z x z y

CSE 681 Reflection Reflection across the x-axis: x’ = (-1) x y’ = y z’ = z x z y Reflection is a special case of scaling!

CSE 681 Elementary Transformations Translation Rotation Scaling Shear What about inverses?

CSE 681 Inverse Transformations Translation Rotation Scale Shear

CSE 681 Compose Transformations x z y Scale by (2, 1, 1) Translate by (20, 5, 0) Rotate by 30° counter-clockwise around the z-axis Translate by (0, -50, 0)

CSE 681 Compose Transformation Matrices x z y Scale by (2, 1, 1); Scale Translate by (20, 5, 0); Translate Rotate by 30° counter-clockwise around the z-axis; Rotate Translate by (0, -50, 0). Translate

CSE 681 Compose Transformation Matrices x z y Scale by (2, 1, 1); Translate by (20, 5, 0); Rotate by 30° counter-clockwise around the z-axis; Translate by (0, -50, 0).

CSE 681 Order Matters! Transformations are not necessarily commutative! x z y Translate by (20, 0, 0). Rotate by 30 . x z y Translate by (20, 0, 0).

CSE 681 Order of Transformation Matrices Apply transformation matrices from right to left. Translate by (20, 0, 0). Rotate by 30 . Translate by (20, 0, 0).

CSE 681 Translation and translation? Scaling and scaling? Rotation and rotation? Translation and scaling? Translation and rotation? Scaling and rotation? Which transformations commute?

CSE 681 Elementary Transformations Theorem: Every affine transformation can be decomposed into elementary operations. Elementary transformations: Translation; Rotation; Scaling; Shear. Euler’s Theorem: Every rotation around the origin can be decomposed into a rotation around the x-axis followed by a rotation around the y-axis followed by a rotation around the z-axis. (or a single rotation about an arbitrary axis).

CSE 681 Vectors Vector V = (V x, V y, V z ). Homogeneous coordinates: (V x, V y, V z, 0). Affine transformation:

CSE 681 Vectors Rotation: Scaling: Translation: (Note: No change.)

CSE 681 Transform Parametric Line P0P0 V Q0Q0 W u u P(u) M Q(u) M M

CSE 681 Line Theorem: Affine transformations transform lines to lines. transformed point on a line = point on transformed line

CSE 681 Affine Transformation of Lines x z y x z y

CSE 681 Affine Combinations P Q P’ Q’ a b b a R M R’ M M

CSE 681 Affine Combinations Theorem: Affine transformations preserve affine combinations.

CSE 681 Properties of Affine Transformations Affine transformations map lines to lines; Affine transformations preserve affine combinations; Affine transformations preserve parallelism; Affine transformations change volume by | Det(M) |; Any affine transformation can be decomposed into elementary transformations. Affine transformations [does/does not] preserve angles? Affine transformations [does/does not] preserve the intersection of two lines? Affine transformations [does/does not] preserve distances?

CSE 681 Properties of Transformation Matrices Second column is how (0,1,0,0) transforms Matrix holds how coordinate axes transform and how origin transforms Third column is how (0,0,1,0) transforms First column is how (1,0,0,0) transforms

CSE 681 Properties of Pure Rotation Matrices Rows (columns) are orthogonal to each other A row dot product any other row = 0 Each row (column) dot product times itself = 1 R T = R -1

CSE 681 Coordinate Frame Coordinate frame is given by origin  and three mutually orthogonal unit vectors, i, j, k - defined in (x,y,z) space Mutually orthogonal (dot products): ij = ?; ik = ?; jk = ?. Unit vectors (dot products): ii = ?; jj = ?; kk = ?. x z y i j k 

CSE 681 Orientation Right handed coordinate system:Left handed coordinate system: x z y (Out of page) x z y (Into page)

CSE 681 Orientation x z y i j k  Right handed coordinate system:Left handed coordinate system: Cross product: i x j = ? x z y i j k  How do you test whether (i,j,k) is left handed or right handed?

CSE 681 Coordinate Transformations x z y i j k  Given object data points defined in the (i, j, k,  ) coordinate frame, Given the definition of (i, j, k,  ) in (x, y, z) coordinates, How do you determine the coordinates of the object data points in the (x, y, z, 0) frame?

CSE 681 Coordinate change (Translation) (  x,  y,  z ) x z y a c b (0,0,0) Change from (a,b,c,  ) coordinates to (x,y,z,0) coordinates: 1.Move (a,b,c,  ) to (x,y,z,0) and invert 2.Move data relative from (0,0,0) out to  position by adding 

CSE 681 Coordinate change (Rotation) c (  x,  y,  z ) a b (0,0,0) Change from (a,b,c,  ) coordinates to (x,y,z,0) coordinates: y x z  z-axis rotation by  1.Rotate (a,b,c) by  and invert 2.Rotate data by - 

CSE 681 Object Transformations x z y Given (i,j,k,p) defined in the (x,y,z,0) coordinate frame, Transform points defined in the (i, j, k,  ) coordinate frame to the (x,y,z,0) coordinate frame. Rotate object to get x to line up with i, then translate to  i j k . 10                z y x i j k

CSE 681 Object Transformations x z y i j k  i j k Affine transformation matrix:

CSE 681 Coordinate Transformations x z y i j k  Given (i,j,k,  ) defined in the (x,y,z,0) coordinate frame, Transform points in (i,j,k,0) coordinate frame to (x,y,z,  ) coordinate frame. translate by - , then rotate to align i with x – then invert

CSE 681 Coordinate Transformations x z y i j k  R= T =

CSE 681 Coordinate Transformations x z y i j k  Affine transformation matrix: Apply RT to coordinate system Apply (RT) -1 to data = T -1 R -1

CSE 681 Composition of coordinate change z” 0 x” y” M 1 changes from coordinate frame (x,y,z,  ) to (x’,y’,z’,  ’). M 2 changes from coordinate frame (x’,y’,z’,  ’) to (x’’,y’’,z’’,  ’’). Change from coordinate frame (x,y,z,  ) to (x’’,y’’,z’’,0): ? z’ ’’ x’ y’ z  x y M2M2 M1M1

CSE 681 Composition of transformations - example x y A B B’ 

CSE 681 Transformations of normal vectors n is a unit normal vector to plane . M is an affine transformation matrix. How is n transformed, to keep it perpendicular to the plane, under: translation? rotation by  ? uniform scaling by s? shearing or non-uniform scaling? n 

CSE 681 Non-uniform scale transformation n is a unit normal vector to plane  : (-n x,0) M is a non-uniform scale transformation matrix that only modifies x- coordinates If we just transform the n as a vector, then M n T = n’ But we want n’’ – that has a non-zero y-coordinate value n n’ n

CSE 681 Transformations of normal vectors Planar equation: a x + b y + c z + d = 0. Let N = (a, b, c, d). (Note: (a, b, c) is normal vector) Let P = (x, y, z, 1) be a point in plane . Planar equation: N P = 0. M is an affine transformation matrix. (M T is M transpose.) Let P’ = M P T. Find N’ such that N’ P’ = 0 (transformed planar equation) N P = 0; N P T = 0; N (M -1 M) P T = 0; (N M -1 ) (M P T ) = 0; (N M -1 ) P’ T = 0; So N’ = NM -1 To put in column-vector form, (N’) T = (NM -1 ) T = (M -1 ) T N T So N’ = ((M -1 ) T N T ) T and (M -1 ) T is the transformation matrix to take N T into N’ T Note: If M is a rotation matrix, (M -1 ) T = M. n  P