Table Of ContentLineartransformations
Affinetransformations
Transformationsin3D
Graphics 2011/2012, 4th quarter
Lecture 5
Linear and affine transformations
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Vector transformation: basic idea
Multiplication of an n×n matrix with a vector
(i.e. a n×1 matrix):
(cid:18) (cid:19)(cid:18) (cid:19) (cid:18) (cid:19)
a a x a x+a y
In 2D: 11 12 = 11 12
a a y a x+a y
21 22 21 22
a a a x a x+a y+a z
11 12 13 11 12 13
In 3D: a21 a22 a23y = a21x+a22y+a23z
a a a z a x+a y+a z
31 32 33 31 32 33
The result is a (transformed) vector.
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Example: scaling
To scale with a factor two with respect
to the origin, we apply the matrix
(cid:18) (cid:19)
2 0
0 2
to a vector:
(cid:18) (cid:19)(cid:18) (cid:19) (cid:18) (cid:19) (cid:18) (cid:19)
2 0 x 2x+0y 2x
= =
0 2 y 0x+2y 2y
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Linear transformations
A function T : Rn → Rm is called a
linear transformation if it satisfies
u+v
1 T((cid:126)u+(cid:126)v) = T((cid:126)u)+T((cid:126)v) for all v
(cid:126)u,(cid:126)v ∈ Rn.
u
2 T(c(cid:126)v) = cT((cid:126)v) for all (cid:126)v ∈ Rn and
all scalars c.
T(u+v)
T(v)
Or (alternatively), if it satisfies
T(c (cid:126)u+c (cid:126)v) = c T((cid:126)u)+c T((cid:126)v)
1 2 1 2
for all (cid:126)u,(cid:126)v ∈ Rn and all scalars c ,c . T(u)
1 2
(cid:32) Linear transformations can be represented by matrices
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Example: scaling
We already saw scaling by a factor of 2.
In general, a matrix
(cid:18) (cid:19)
a 0
11
0 a
22
scales the i-th coordinate of a vector by the factor a (cid:54)= 0, i.e.
ii
(cid:18) (cid:19)(cid:18) (cid:19) (cid:18) (cid:19) (cid:18) (cid:19)
a 0 x a x+0y a x
11 11 11
= =
0 a y 0x+a y a y
22 22 22
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Example: scaling
Scaling does not have to be
uniform. Here, we scale with a
factor one half in x-direction,
and three in y-direction:
(cid:18)1 0(cid:19)(cid:18)x(cid:19) (cid:18)1x(cid:19)
2 = 2
0 3 y 3y
Q: what is the inverse of this
matrix?
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Example: scaling
Using Gaussian elimination to
calculate the inverse of a
matrix:
(cid:18) 1 0 1 0 (cid:19)
2
0 3 0 1
(cid:32)
(Gaussian elimination)
(cid:18) (cid:19)
1 0 2 0
0 1 0 1
3
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Example: projection
We can also use matrices to
do orthographic projections,
for instance, onto the Y-axis:
(cid:18) (cid:19)(cid:18) (cid:19) (cid:18) (cid:19)
0 0 x 0
=
0 1 y y
Q: what is the inverse of this
matrix?
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Example: reflection
Reflection in the line y = x
boils down to swapping x- and
y-coordinates:
(cid:18) (cid:19)(cid:18) (cid:19) (cid:18) (cid:19)
0 1 x y
=
1 0 y x
Q: what is the inverse of this
matrix?
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Definition
Lineartransformations Examples
Affinetransformations Findingmatrices
Transformationsin3D Compositionsoftransformations
Transposingnormalvectors
Example: shearing
Shearing in x-direction
“pushes things sideways”:
(cid:18) (cid:19)(cid:18) (cid:19) (cid:18) (cid:19)
1 1 x x+y
=
0 1 y y
We can also “push things
upwards” with
(cid:18) (cid:19)(cid:18) (cid:19) (cid:18) (cid:19)
1 0 x x
=
1 1 y x+y
Graphics2011/2012,4thquarter Lecture5:linearandaffinetransformations
Description:Linear transformations A ne transformations Transformations in 3D De nition Examples Finding matrices Compositions of transformations Transposing normal vectors