Review:%20Transformations - PowerPoint PPT Presentation

About This Presentation
Title:

Review:%20Transformations

Description:

Review: Transformations CSE 681 * Use this with rhs of world to lhs of amera * Multiply matrices together. Real advantage of matrix multiplication/homogeneous ... – PowerPoint PPT presentation

Number of Views:150
Avg rating:3.0/5.0
Slides: 53
Provided by: wenger
Learn more at: https://cse.osu.edu
Category:

less

Transcript and Presenter's Notes

Title: Review:%20Transformations


1
ReviewTransformations
2
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
Transformations - Modeling
4
Transformations - Viewing
CAMERA
OBJECT
WORLD
5
Modeling Transformations
  • Transform objects/points

Transform coordinate system
6
Affine Transformations
  • Transform P (x, y, z) to Q (x, y, z) by M.
  • Affine transformation

7
Translation
  • Translation by (tx, ty, tz)

(tx, ty, tz)
8
Scaling
  • Scaling by (sx, sy, sz)

Uniform v. non-uniform scaling
9
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(?)
10
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(?)

z
?
y
x
11
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(?)

x
?
z
y
12
Matrix Multiplication
Scaling by (sx, sy, sz) x sx x y sy y z
sz z
  • Rotation counter-clockwise by angle ? around the
    z-axis
  • x x cos(?) y sin(?)
  • y x sin(?) y cos(?)
  • z z

Translation by (tx, ty, tz) x x tx y y
ty z z tz
13
Homogeneous Coordinates
Represent P by (x, y, z, 1) and Q by (x, y, z,
1). (Homogeneous coordinates.)
Translation by (tx, ty, tz) x x tx y y
ty z z tz
  • Scaling by (sx, sy, sz)
  • x sx x
  • y sy y
  • z sz z

14
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
y-axis x x cos(?) z sin(?) y y z x
sin(?) z cos(?)
Rotation counter-clockwise by angle ? around the
z-axis x x cos(?) y sin(?) y x sin(?)
y cos(?) z z
15
Affine Transformation Matrix
  • Affine transformation
  • x m11 x m12 y m13 z m14
  • y m21 x m22 y m23 z m24
  • z m31 x m32 y m33 z m34
  • Transformation Matrix

16
Shearing
  • Shear along the x-axis
  • x x hy
  • y y
  • z z

17
Reflection
  • Reflection across the x-axis
  • x (-1) x
  • y y
  • z z

Reflection is a special case of scaling!
18
Elementary Transformations
  • Translation
  • Rotation
  • Scaling
  • Shear

What about inverses?
19
Inverse Transformations
Translation
Scale
Rotation
Shear
20
Compose Transformations
21
Compose Transformation Matrices
22
Compose Transformation Matrices
  • 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
Order Matters!
  • Transformations are not necessarily commutative!
  • Translate by (20, 0, 0).
  • Rotate by 30?.
  • Rotate by 30?.
  • Translate by (20, 0, 0).

24
Order of Transformation Matrices
  • Apply transformation matrices from right to left.
  • Translate by (20, 0, 0).
  • Rotate by 30?.
  • Rotate by 30?.
  • Translate by (20, 0, 0).

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

26
Elementary Transformations
  • Elementary transformations
  • Translation
  • Rotation
  • Scaling
  • Shear.
  • Theorem Every affine transformation can be
    decomposed into elementary operations.

Eulers 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
Vectors
  • Vector V (Vx, Vy, Vz).
  • Homogeneous coordinates (Vx, Vy, Vz, 0).
  • Affine transformation

28
Vectors
  • Rotation
  • Scaling
  • Translation
  • (Note No change.)

29
Transform Parametric Line
V
P(u)
u
P0
M
M
u
W
Q0
30
Line
transformed point on a line point on
transformed line
Theorem Affine transformations transform lines
to lines.
31
Affine Transformation of Lines
y
y
x
x
z
z
32
Affine Combinations
Q
b
R
a
P
M
b
M
Q
a
P
33
Affine Combinations
  • Theorem Affine transformations preserve affine
    combinations.

34
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
Properties of Transformation Matrices
First column is how (1,0,0,0) transforms
  • Second column is how (0,1,0,0) transforms

Third column is how (0,0,1,0) transforms
Matrix holds how coordinate axes transform and
how origin transforms
36
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
  • RT R-1

37
Coordinate Frame
y
j
?
i
k
x
z
  • 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 ?.

38
Orientation
Right handed coordinate system
Left handed coordinate system
y
(Into page)
z
x
(Out of page)
39
Orientation
Right handed coordinate system
Left handed coordinate system
k
j
i
?
Cross product i x j ?
Cross product i x j ?
How do you test whether (i,j,k) is left handed or
right handed?
40
Coordinate Transformations
  • 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
Coordinate change (Translation)
b
(?x, ?y, ?z)
a
(0,0,0)
c
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
Coordinate change (Rotation)
x
y
?
z-axis rotation by ?
(0,0,0)
z
Change from (a,b,c,?) coordinates to (x,y,z,0)
coordinates
  1. Rotate (a,b,c) by ? and invert
  2. Rotate data by -?

43
Object Transformations
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 ?
44
Object Transformations
Affine transformation matrix
45
Coordinate Transformations
Given (i,j,k,f) 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
Coordinate Transformations
T
R
47
Coordinate Transformations
Apply RT to coordinate system Apply (RT)-1 to
data T-1R-1
48
Composition of coordinate change
y
y
M1
y
?
z
M2
x
x
?
z
0
z
x
  • M1 changes from coordinate frame (x,y,z,?) to
    (x,y,z,?).
  • M2 changes from coordinate frame (x,y,z,?) to
    (x,y,z,?).
  • Change from coordinate frame (x,y,z,?) to
    (x,y,z,0) ?

49
Composition of transformations - example
B
B
y
q
A
x
50
Transformations of normal vectors
n
?
  • 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?

51
Non-uniform scale transformation
n
  • n is a unit normal vector to plane ? (-nx,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 nT
    n
  • But we want n that has a non-zero
    y-coordinate value

52
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. (MT is M
    transpose.)
  • Let P M PT.
  • Find N such that N P 0 (transformed planar
    equation)
  • N P 0
  • N PT 0
  • N (M-1 M) PT 0
  • (N M-1) (M PT) 0
  • (N M-1) PT 0
  • So N NM-1
  • To put in column-vector form, (N)T (NM-1)T
    (M-1)TNT
  • So N ((M-1)T NT)T and (M-1)T is the
    transformation matrix to take NT into NT
  • Note If M is a rotation matrix, (M-1)T M.

n
?
P
Write a Comment
User Comments (0)
About PowerShow.com