Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "CSE 681 Review: Transformations. CSE 681 Transformations Modeling transformations build complex models by positioning (transforming) simple components."— Presentation transcript:

1 CSE 681 Review: Transformations

2 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

3 CSE 681 Transformations - Modeling

4 CSE 681 Transformations - Viewing WORLD OBJECT CAMERA

5 CSE 681 Modeling Transformations Transform objects/pointsTransform coordinate system

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

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

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

9 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

10 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 

11 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 

12 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

13 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

14 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(  )

15 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:

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

17 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!

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

19 CSE 681 Inverse Transformations Translation Rotation Scale Shear

20 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)

21 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

22 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).

23 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).

24 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).

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

26 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).

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

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

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

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

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

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

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

34 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?

35 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

36 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

37 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 

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

39 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?

40 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?

41 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 

42 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 - 

43 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 1 0 0 0 0 0 1 0 0 1 0 i j k

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

45 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

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

47 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

48 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

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

50 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 

51 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

52 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


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

Similar presentations


Ads by Google