Tranformations: Some Slides Adapted From Octavia Camps
Tranformations: Some Slides Adapted From Octavia Camps
Matrices
An
a11
a21
a31
a12
a22
a32
Sum:
a1m
a2 m
a3m
an1
an 2
An
Bn
Cn
anm
cij
aij
bij
Matrices
Product:
Cn
An m Bm
cij
aik bkj
An n Bn
k 1
Identity Matrix:
1
0
0
1
Bn n An
0
0
IA AI
Matrices
Associative T*(U*(V*p)) = (T*U*V)*p
Distributive T*(u+v) = T*v + T*v
Matrices
Transpose:
Cm
cij
If
AT
AT n
a ji
( A B )T
( AB)T
AT
BT
B T AT
A is symmetric
Matrices
Determinant:
a
det 11
a21
A must be square
a12
a22
a11
a21
a11
det a21
a31
a12
a22
a11a22 a21a12
a12
a22
a32
a13
a23
a33
a11
a22
a32
a23 a21
a12
a33
a31
a23
a33
a13
a21
a31
a22
a32
Matrices
Inverse:
An n A
A must be square
1
n n
a11
a21
a12
a22
1
n n
An
1
a11a22 a21a12
a22
a
21
a
12
a11
Euclidean transformations
2D Translation
P!
2D Translation Equation
ty
P!
P ( x, y )
t (t , t )
x
tx
P' ( x t x , y t y ) P t
10
P!
tx
P'
P ( x, y )
t (t x , t y )
x tx
y ty
1 0 tx
0 1 ty
x
y
1
11
Scaling
P!
12
Scaling Equation
P!
s.y
y
P
x
( x, y )
P' ( sx, sy )
P' s P
s.x
P'
sx
s 0
sy
P' S P
0 s
13
Rotation
P
P!
14
Rotation Equations
Counter- clockwise rotation by an angle
Y!
x ' cos
P!
X!
y'
sin
sin x
cos
P'
R.P
15
16
Degrees of Freedom
x ' cos
y'
R is 2x2
sin
sin x
cos
4 elements
R RT RT R
det(R ) 1
17
Transformations can be
composed
Matrix multiplication is associative.
Combine series of transformations into
one matrix. (example, whiteboard).
In general, the order matters. (example,
whiteboard).
2D Rotations can be interchanged.
Why?
18
cos
-sin
tx
sin
cos
ty
x
y
1
)( )
-b
tx
ty
x
y
1
)( )
19
20
Inverse of a rotation
If R is a rotation, RRT = I.
This is because the diagonals of RRT are the
magnitudes of the rows, which are all 1, because
the rows are unit vectors giving directions.
The off-diagonals are the inner product of
orthogonal unit vectors, which are zero.
21
Stretching Equation
P ( x, y )
P ' ( s x x, s y y )
P!
S y.y
y
P
x
P'
S x.x
sx x
sy y
sx
0
0
sy
x
y
S
P' S P
22
P'
sx x
sy y
sx
sy
x
y
sx
sy sy
0
x
y
23
Linear Transformation
P'
a b
c d
x
y
SVD
sin
cos
cos
sin
sx
0
0
sy
sy
sin
cos
cos
sin
sin
cos
cos
sin
x
y
sx
sy
0
sin
cos
cos
sin
x
y
24
Affine Transformation
P'
a b tx
c d ty
x
y
25
Viewing Position
Express world in new coordinate
system.
If origins same, this is done by taking
inner product with new coordinates.
Otherwise, we must translate.
26
27
Simple 3D Rotation
cos
sin
sin
cos
0
0
0
1
x
y
x
y
x
y
n
28
Full 3D Rotation
cos
sin
0
sin
cos
0
0
0
1
cos
0
sin
0 sin
1
0
0 cos
1
0
0
0
cos
sin
0
sin
cos
RR
1 0 0
0 1 0
0 0 1
29
30
3D Rotation + Translation
Just like 2D case
31
Transformation of lines/normals
2D. Line is set of points (x,y) for which
(x,y).(ab)T=0. Suppose we rotate points
by R. We want a matrix, T, so that:
R*(x,y) .T
32
3D Viewing Position
Rows of rotation matrix correspond to
new coordinate axis.
33
34