Beruflich Dokumente
Kultur Dokumente
(
2
Transformation (2/3)
Translation
Mo#in" an o%)ect
*cale
+han"in" the
si,e of an o%)ect
-cto%er 2.' 2/10 3
t
t
x
w
old
w
new
h
old
h
new
x
new
= x
old
+ t
x
; y
new
= y
old
+ t
y
s
x
=w
new
/w
old
s
y
=h
new
/h
old
x
new
= s
x
x
old
y
new
= s
y
y
old
Transformation (3/3)
To rotate a line
or pol"on' &e
must rotate
each of its
#ertices
*hear
-cto%er 2.' 2/10 0
(x')
Original Data y Shear x Shear
What is a 2D Linear
Transform!
. y and x vectors and a scalar for
, ) y ( T ) x ( aT ) y x a ( T : Definition
+ +
-cto%er 2.' 2/10 .
( ) )
y
,
x
2 ( )
y
,
x
2 (
y y
),
x
x (
2
: say 2, by x, in Scale
1
1
0
0
1 0
1
0
+ +
+
Example
1xample
-cto%er 2.' 2/10 2
) ,
0 0
( y x
) ,
0 0
2 ( y x
) ,
1 1
( y x ) ,
1 1
2 ( y x
y
x
x
y
) ,
0 0
2 ( y x
) ,
1 1
2 ( y x
( ) y y
x x
1 0
1 0
,
2
2 +
+
y
) ,
0 0
( y x
) ,
1 1
( y x
( ) y y
x
x
1 0
1
0
), ( 2 +
+
( ) y y
x
x
1 0
1
0
), ( +
+
x
y
( ) y y
x
x
1 0
1
0
), ( 2 +
+
( ) y y
x
x
1 0
1
0
), ( +
+
y
x
( ) y y
x x
1 0
1 0
,
2
2 +
+
Scale in x by 2
( ) y y
x x
1 0
1 0
), ( 2 +
+
( ) y y
x x
1 0
1 0
), ( 2 +
+
Transformations: Translation (1/2)
3 translation is a
strai"ht line
mo#ement of an
o%)ect from one
position to another4
3 point (x') is
transformed to the
point (x5'5) %
addin" the
translation
distances T
x
and T
$
-cto%er 2.' 2/10 6
x = x + T
x
y = y + T
y
Transformations: Translation(2/2)
mo#in" a point
% a "i#en t
x
and
t
amount
e4"4 point 7 is
translated to
point 75
mo#in" a line
% a "i#en t
x
and
t
amount
translate each of
the 2 endpoints
-cto%er 2.' 2/10 8
) 10 , 5 ( P
) 10 , 15 ( P
1
]
1
1
]
1
0
10
y
x
t
t
T
) 20 , 5 ( 1 P
) 10 , 5 ( 2 P ) 10 , 5 ( 1 P
) 0 , 5 ( 2 P
1
]
1
1
]
1
10
0
y
x
t
t
T
Transformations: Rotation (1/)
o%)ect can %e
rotated around
an ar%itrar
point (x
r
'
r
)
;no&n as
rotation or
pivot point
%$
-cto%er 2.' 2/10 12
x' = x
r
+ (x - x
r
) cos() - (y - y
r
) sin ()
y' = y
r
+ (x - x
r
) sin ()+(y - y
r
) cos()
Transformations: S"aling (1/#)
-cto%er 2.' 2/10 10
x
2
= s
x
x
1
y
2
= s
y
y
1
Transformations: S"aling (!/#)
*imple scalin" :
relati#e to (/'/)
Ceneral form$
-cto%er 2.' 2/10 1.
y s y
x s x
y
x
) , ( 1 y x P
) , ( 1 y x P
) ! , 2 ( 1 P
) 1 , ! ( 2 P
) ! , " ( 1 P
) 1 , # ( 2 P
Ex: s
x
$ 2 an% s
y
$1
Transformations: S"aling (/#)
Df the point (x
f
'
f
) is to %e the @xed point' the
transformation is$
x9 A x
f
E (x : x
f
) *
x
9 A
f
E ( :
f
) *
E (1 : *
)
f
&hich is a com%ination of a scalin" a%out the
ori"in and a translation4
-cto%er 2.' 2/10 12
Transformations: S"aling (#/#)
-cto%er 2.' 2/10 16
Transformation as Matrices
-cto%er 2.' 2/10 18
S"ale:
x = s
x
x
y = s
y
y
Rotation:
x = xcos - ysin
y = xsin + ycos
Translation:
x = x + t
x
y = y + t
y
1
]
1
1
]
1
1
]
1
y s
x s
y
x
s
s
y
x
y
x
0
0
1
]
1
1
]
1
1
]
1
cos sin
sin cos
cos sin
sin cos
y x
y x
y
x
1
]
1
+
+
1
]
1
+
1
]
1
y
x
y
x
t y
t x
y
x
t
t
Transformations: Shear (1/2)
*hear in x:
-cto%er 2.' 2/10 1<
1
]
1
1
]
1
1
]
1
y
ay x
y
x a
Sh
x
1 0
1
) 0 , 1 (
) 1 , ( a
) 1 , 0 (
) 0 , 1 (
) 1 , 1 (
Transformations: Shear (2/2)
*hear in $
-cto%er 2.' 2/10 2/
) 1 , 0 (
) 0 , 0 (
) , 1 ( b
) 1 , 0 (
) 0 , 1 (
) 0 , 0 (
) 1 , 1 (
1
]
1
1
]
1
1
]
1
y bx
x
y
x
b
Sh
y
1
0 1
Shear in x then in y
-cto%er 2.' 2/10 21
) 1 , 0 (
) 0 , 0 (
) 1 , 0 (
) 0 , 0 (
) 1 , 0 (
) 0 , 0 (
) 0 , 1 (
) 0 , 1 (
) , (1 b ab +
) , ( 1 a
) , ( 1 ab a
) , ( 1 1 b ab a + + +
) , ( 1 1 a +
) 1 , 0 (
) 0 , 0 (
) 1 , 1 ( b +
) 1 , 1 (
) , 1 ( b
Shear in y then in x
-cto%er 2.' 2/10 22
) 1 , 0 (
) 0 , 0 (
) 1 , 0 (
) 1 , 0 (
) 0 , 0 (
) 0 , 1 ( ) 0 , 1 (
) , (1 b +
) , ( 1 a
) , ( 1 ab a +
) , ( 1 1 ab b a + + +
) , ( 1 1 a +
) 1 , 0 (
) 0 , 0 (
) 1 , 1 ( b +
) 1 , 1 (
) , 1 ( b
&omogeneo's "oor%inate
1
) , (
y
x
P
y x
1
1
1
]
1
1 0 0
0 0
0 0
, y
x
y x
s
s
S
1
1
1
]
1
1 0 0
0 cos sin
0 sin cos
R
1
1
1
]
1
1 0 0
1 0
0 1
, y
x
y x
t
t
T
Hasic Transformation (1/3)
Translation
-cto%er 2.' 2/10 2.
Hasic Transformation (2/3)
=otation
-cto%er 2.' 2/10 22
_
,
P x y x y
t t
t t PS t ( , , ) ( , , )
cos sin
sin cos ( ) 1 1
0
0
0 0 1
Hasic Transformation (3/3)
*calin"
-cto%er 2.' 2/10 26
+omposite Transformation
-cto%er 2.' 2/10 28
S'ppose (e (ishe%
to perform m'ltiple
transformations on a
point:
P
2
T
3,1
P
1
P
3
S
2, 2
P
2
P
4
R
30
P
3
M R
30
S
2,2
T
3,1
P
4
MP
1
1xample of +omposite
Transformation(1/3)
) =(t)
3 rotation a%out an ar%itrar point (x
f
'
f
) % and
an"le t anti:cloc;&ise has matrix$
T(:x
f
':
f
) =(t) T(x
f
'
f
)
-cto%er 2.' 2/10 2<
1xample of +omposite
Transformation(2/3)
=eIection a%out the :axis=eIection a%out the x:
axis
-cto%er 2.' 2/10 3/
1
1
1
]
1
1 0 0
0 1 0
0 0 1
1
1
1
]
1
1 0 0
0 1 0
0 0 1
1xample of +omposite
Transformation(3/3)
-cto%er 2.' 2/10 31
Refle"tion a)o't the origin Refle"tion a)o't the line y$x
1
1
1
]
1
1 0 0
0 1 0
0 0 1
1
1
1
]
1
1 0 0
0 0 1
0 1 0
3D Transformation
-cto%er 2.' 2/10 32
J
>
?
?
>
J
Hasic 3D Transformations
Translation
*cale
=otation
*hear
' , E t
,
)
*7 A (s
x
x' s
' s
,
,)
-cto%er 2.' 2/10 30
1
1
1
1
]
1
1 0 0 0
1 0 0
0 1 0
0 0 1
z
y
x
t
t
t
1
1
1
1
]
1
1
z
y
x
1
1
1
1
]
1
1 0 0 0
0 0 0
0 0 0
0 0 0
z
y
x
s
s
s
1
1
1
1
]
1
1
z
y
x
3D =otation (1/0)
7ositi#e =otations are de@ned as follo&s$
3xis of rotation is Direction of positi#e
rotation is
x to ,
, to x
, x to
-cto%er 2.' 2/10
204481 Foundation of Computer Grap
hics
3.
3D =otation (2/0)
1 0 0 0
0 cos sin 0
0 sin cos 0
0 0 0 1
1
1
1
1
]
1
1
z
y
x
y
z
) 0 , 1 , 0 (
) 1 , 0 , 0 (
3D =otation (3/0)
($)7
-cto%er 2.' 2/10 36
1
1
1
1
]
1
1 0 0 0
0 cos 0 sin
0 0 1 0
0 sin 0 cos
1
1
1
1
]
1
1
z
y
x
x
z
) 0 , 0 , 1 (
) 1 , 0 , 0 (
3D =otation (0/0)
1 0 0 0
0 1 0 0
0 0 cos sin
0 0 sin cos
1
1
1
1
]
1
1
z
y
x
3D *hear
x *hear$ *F
x
7
-cto%er 2.' 2/10 3<
1
1
1
1
]
1
1 0 0 0
0 1 0 0
0 1 0
0 0 1
y
x
sh
sh
1
1
1
1
]
1
1
z
y
x
x
z
y
x
z
y
=otation 3%out 3n 3r%itar
3xis (1/3)
14 Translate one end of
the axis to the
ori"in
24 =otate a%out the :
axis and an"le
34 =otate a%out the x:
axis throu"h an
an"le
-cto%er 2.' 2/10 0/
Z
P
1
P
2
Y
X
b
a
c
u
1
u
2
u
3
U
=otation 3%out 3n 3r%itar
3xis (2/3)
-cto%er 2.' 2/10 01
Z
P
1
P
2
Y
X
b
a
c
u
1
u
2
u
3
U
Z
Y
X
b
a
c
u
1
u
2
u
3
U
Z
Y
a
u
2
X
04 When L is ali"ned &ith the ,:axis' appl the ori"inal rotation' = ='
a%out the ,:axis4
.4 3ppl the in#erses of the transformations in re#erse order4
=otation 3%out 3n 3r%itar
3xis (3/3)
-cto%er 2.' 2/10 02
T
:1
=
($) =
x
(:%) = =
x
(%) =
(:$) T 7