Professional Documents
Culture Documents
=
y
x
y x ) , (
=
8 . 4
1 . 2
) 8 . 4 , 1 . 2 (
Matrix * Vector
=
+ =
+ =
1 0
0 1
'
'
'
'
I
dy cx y
by ax x
y
x
d c
b a
y
x
=
+ + =
+ + =
+ + =
1 0 0
0 1 0
0 0 1
'
'
'
'
'
'
I
iz hy gx z
fz ey dx y
cz by ax x
z
y
x
i h g
f e d
c b a
z
y
x
Matrix * Matrix
+ +
+ +
=
=
1 0
0 1
?
*
,
d c
b a
dw cy dz cx
bw ay bz ax
B A
w z
y x
B
d c
b a
A
Does A*B = B*A?
What does the identity do?
Practice
? *
? *
5 . 2 3
1 5 . 0
,
5 1
3 2
?
3
2
,
5 1
3 2
=
=
=
=
=
I A
B A
B A
AX
X A
Translation
Translation - repositioning an object along a
straight-line path (the translation
distances) from one coordinate location to
another.
(x,y)
(x,y)
(t
x
,t
y
)
Translation
Given:
We want:
Matrix form:
T P P
t
t
y
x
y
x
t y y
t x x
t t T
y x P
y
x
y
x
y x
+ =
+ =
+ =
=
=
'
'
'
'
'
) , (
) , (
1 . 4 '
4 . 3 '
2 . 8
1 . 7
1 . 4
7 . 3
'
'
2 . 8 1 . 4 '
1 . 7 7 . 3 '
) 2 . 8 , 1 . 7 (
) 1 . 4 , 7 . 3 (
=
=
+ =
+ =
=
=
y
x
y
x
y
x
T
P
Translation Examples
P=(2,4), T=(-1,14), P=(?,?)
P=(8.6,-1), T=(0.4,-0.2), P=(?,?)
P=(0,0), T=(1,0), P=(?,?)
Which one is it?
(x,y)
(x,y)
(t
x
,t
y
)
(x,y)
(t
x
,t
y
)
Recall
A point is a position specified with
coordinate values in some reference frame.
We usually label a point in this reference
point as the origin.
All points in the reference frame are given
with respect to the origin.
Applying to Triangles
(t
x
,t
y
)
What do we have here?
You know how to:
Scale
Scale - Alters the size of an object.
Scales about a fixed point
(x,y)
(x,y)
Scale
Given:
We want:
Matrix form:
P S P
y
x
s
s
y
x
y s y
x s x
s s S
y x P
y
x
y
x
y x
=
=
=
=
=
'
0
0
'
'
'
'
) , (
) , (
6 . 6 '
2 . 4 '
2 . 2
4 . 1
3 0
0 3
'
'
2 . 2 * 3 '
4 . 1 * 3 '
) 3 , 3 (
) 2 . 2 , 4 . 1 (
=
=
=
=
=
=
y
x
y
x
y
x
S
P
Non-Uniform/Differential Scalin
(x,y)
(x,y)
S=(1,2)
Rotation
Rotation - repositions an object along a
circular path.
Rotation requires an 5 and a pivot point
Rotation
) cos( '
) cos( '
sin
cos
) (
) , (
5 + =
5 + =
=
=
=
=
o
o
o
o
r y
r x
r y
r x
R
y x P
P R P
y
x
y
x
y x y
y x x
r r y
r r x
=
+ =
=
+ =
=
'
cos sin
sin cos
'
'
cos sin '
sin cos '
cos sin sin cos '
sin sin cos cos '
o o
o o
Example
P=(4,4)
5=45 degrees
What is the difference? Revisited
V(-0.6,0) V(0,-0.6) V(0.6,0.6)
Translate (1.2,0.3)
V(0,0.6) V(0.3,0.9) V(0,1.2)
Translate (1.2,0.3)
V(0.6,0.3) V(1.2,-0.3) V(1.8,0.9)
V(0,0.6) V(0.3,0.9) V(0,1.2)
Rotations
V(-0.6,0) V(0,-0.6) V(0.6,0.6)
Rotate -30 degrees
V(0,0.6) V(0.3,0.9) V(0,1.2)
Combining Transformations
Q: How do we
specify each
transformation?
Specifying 2D Transformations
Translation
T(t
x
, t
y
)
Translation distances
Scale
S(s
x
,s
y
)
Scale factors
Rotation
R()
Rotation angle
Combining Transformations
Using translate, rotation, and scale, how do
we get:
Combining Transformations
Note there are two ways to combine rotation
and translation. Why?
Lets look at the equations
=
1 0 0
0 cos sin
0 sin cos
cos sin
sin cos
1 0 0
0 0
0 0
0
0
,
1 0 0
1 0
0 1
,
R
s
s
s
s
s s S
t
t
t
t
y
x
t t T
y
x
y
x
y x
y
x
y
x
y x
Homogenous Coordinates
We need to do something to the vertices
By increasing the dimensionality of the
problem we can transform the addition
component of Translation into
multiplication.
=
=
=
=
=
=
=
2
2
2
14
7
2
6
3
2
14
6
7
3
. ,
1
2
4
2
4
. Ex Ex
h
h
h
y
y
h
x
x
h
y
x
y
x
P
h
h
h
h
Homogenous Coordinates
Homogenous Coordinates - term used in
mathematics to refer to the effect of this
representation on Cartesian equations. Converting
a pt(x,y) and f(x,y)=0 -> (x
h
,y
h
,h) then in
homogenous equations mean (v*x
h
,v*y
h
,v*h) can
be factored out.
What you should get: By expressing the
transformations with homogenous equations and
coordinates, all transformations can be expressed
as matrix multiplications.
Final Transformations -
Compare Equations
)
) )
)
) )
)
) ) P R P P R P
y
x
y
x
y
x
y
x
R
P s s S P P s s S P
y
x
s
s
y
x
y
x
s
s
y
x
s s S
P t t T P P t t T P
y
x
t
t
y
x
y
x
t
t
y
x
t t T
y x y x
y
x
y
x
y x
y x y x
y
x
y
x
y x
- = - =
=
- = - =
=
- = + =
1 1 0 0
0 cos sin
0 sin cos
1
'
'
cos sin
sin cos
'
'
, ,
1 1 0 0
0 0
0 0
1
'
'
0
0
'
'
,
, ,
1 1 0 0
1 0
0 1
1
'
'
'
'
,
Combining Transformations
- - = - = - =
1
'
'
1 0 0
1 0
0 1
1 0 0
0 cos sin
0 sin cos
1
"
"
1
'
'
1 0 0
0 cos sin
0 sin cos
1
"
"
1 1 0 0
1 0
0 1
1
'
'
) 60 ( ), 2 , 4641 . 0 ( ), 4 , 3 (
" ' " , '
y
x
t
t
y
x
y
x
y
x
y
x
t
t
y
x
R T P
P B A P P B P P A P
y
x
y
x
+
=
1 1 0 0
cos sin
sin cos
1
"
"
1 1 0 0
0 cos sin
0 sin cos
1 0 0
1 0
0 1
1
"
"
1 1 0 0
cos sin cos sin
sin cos sin cos
1
"
"
y
x
t
t
y
x
y
x
t
t
y
x
y
x
t t
t t
y
x
y
x
y
x
y x
y x
How would we get:
How would we get:
Coordinate Systems
Object Coordinates
World Coordinates
Eye Coordinates
Object Coordinates
World Coordinates
Screen Coordinates
Coordinate Hierarchy
Object #1
Object Coordinates
Transformation
Object #1 ->
World
Object #2
Object Coordinates
Transformation
Object #2 ->
World
Object #3
Object Coordinates
Transformation
Object #3 ->
World
World Coordinates
Transformation
World->Screen
Screen Coordinates
Lets reexamine assignment 2b
Transformation Hierarchies
For example:
Transformation Hierarchies
Lets examine:
Transformation Hierarchies
What is a better way?
Transformation Hierarchies
What is a better way?
Transformation Hierarchies
We can have transformations be
in relation to each other
Blue
Object Coordinates
Transformation
Blue -> Red
Red
Object Coordinates
Transformation
Red -> Green
Green
Object's Coordinates
Transformation
Green -> World
World Coordinates
More Complex Models