Title: Review:%20Transformations
1ReviewTransformations
2Transformations
- 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
3Transformations - Modeling
4Transformations - Viewing
CAMERA
OBJECT
WORLD
5Modeling Transformations
Transform coordinate system
6Affine Transformations
- Transform P (x, y, z) to Q (x, y, z) by M.
- Affine transformation
7Translation
- Translation by (tx, ty, tz)
(tx, ty, tz)
8Scaling
Uniform v. non-uniform scaling
9Rotation
- 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(?)
10Rotation 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
11Rotation 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
12Matrix 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
13Homogeneous 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
14Rotation 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
15Affine 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
16Shearing
- Shear along the x-axis
- x x hy
- y y
- z z
17Reflection
- Reflection across the x-axis
- x (-1) x
- y y
- z z
Reflection is a special case of scaling!
18Elementary Transformations
- Translation
- Rotation
- Scaling
- Shear
What about inverses?
19Inverse Transformations
Translation
Scale
Rotation
Shear
20Compose Transformations
21Compose Transformation Matrices
22Compose Transformation Matrices
- Rotate by 30 counter-clockwise around the
z-axis
- Translate by (0, -50, 0).
23Order Matters!
- Transformations are not necessarily commutative!
- Translate by (20, 0, 0).
- Rotate by 30?.
- Rotate by 30?.
- Translate by (20, 0, 0).
24Order 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).
25Which transformations commute?
- Translation and translation?
- Scaling and scaling?
- Rotation and rotation?
- Translation and scaling?
- Translation and rotation?
- Scaling and rotation?
26Elementary 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).
27Vectors
- Vector V (Vx, Vy, Vz).
- Homogeneous coordinates (Vx, Vy, Vz, 0).
- Affine transformation
28Vectors
- Rotation
- Scaling
- Translation
- (Note No change.)
29Transform Parametric Line
V
P(u)
u
P0
M
M
u
W
Q0
30Line
transformed point on a line point on
transformed line
Theorem Affine transformations transform lines
to lines.
31Affine Transformation of Lines
y
y
x
x
z
z
32Affine Combinations
Q
b
R
a
P
M
b
M
Q
a
P
33Affine Combinations
- Theorem Affine transformations preserve affine
combinations.
34Properties 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?
35Properties 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
36Properties 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
37Coordinate 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 ?.
38Orientation
Right handed coordinate system
Left handed coordinate system
y
(Into page)
z
x
(Out of page)
39Orientation
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?
40Coordinate 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?
41Coordinate change (Translation)
b
(?x, ?y, ?z)
a
(0,0,0)
c
Change from (a,b,c,?) coordinates to (x,y,z,0)
coordinates
- Move (a,b,c, ?) to (x,y,z,0) and invert
- Move data relative from (0,0,0) out to ? position
by adding ?
42Coordinate change (Rotation)
x
y
?
z-axis rotation by ?
(0,0,0)
z
Change from (a,b,c,?) coordinates to (x,y,z,0)
coordinates
- Rotate (a,b,c) by ? and invert
- Rotate data by -?
43Object 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 ?
44Object Transformations
Affine transformation matrix
45Coordinate 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
46Coordinate Transformations
T
R
47Coordinate Transformations
Apply RT to coordinate system Apply (RT)-1 to
data T-1R-1
48Composition 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) ?
49Composition of transformations - example
B
B
y
q
A
x
50Transformations 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?
51Non-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
52Transformations 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