CS-184: Computer Graphics
Lecture #4: 2D Transformations
- Prof. James O’Brien
University of California, Berkeley
V2008-F-04-1.0
1
CS-184: Computer Graphics Lecture #4: 2D Transformations Prof. - - PowerPoint PPT Presentation
CS-184: Computer Graphics Lecture #4: 2D Transformations Prof. James OBrien University of California, Berkeley V2008-F-04-1.0 1 Today 2D Transformations Primitive Operations Scale, Rotate, Shear, Flip, Translate Homogenous
University of California, Berkeley
V2008-F-04-1.0
1
2
Scale, Rotate, Shear, Flip, Translate
2
3
An operation that changes one configuration into another
A geometric transformation maps positions that define the object to
Linear transformation means the transformation is defined by a linear function... which is what matrices are good for.
3
4
Images from Conan The Destroyer, 1984
4
5
5
6
6
7
7
8
M.C. Escher, from Ghostscript 8.0 Distribution
8
9
9
10
10
11
11
12
12
13
Origin, 0
13
14
Rotate Translate Scale Shear -- not really “basic” U n i f
m / i s
r
i c N
n i f
m / a n i s
r
i c
14
15
15
16
Rotate
x .707 -.707 .707 .707 y x
45 degree rotation
16
17
17
18
18
19
0.5 0 0 1.5 x y x y
x 0.5 0 0 0.5 y x y
Scale Uniform/isotropic Non-uniform/anisotropic
y x
19
20
Not axis-aligned...
20
21
Shear
xy yx
x 1 1 0 1 y x y
21
22
22
23
Translate
y x
23
24
24
25
T
T
not the same Q
25
26
26
27
“Apply A to p and then apply B to that result.”
27
28
shear x y x y y x x shear shear
28
29
y x
y x
29
30
y x y x
30
31
31
32
32
33
Translate (-C)
33
34
Translate (-C) Rotate (θ)
34
35
Translate (-C) Rotate (θ) Translate (C)
35
36
36
37
37
38
38
39
39
40
40
41
41
42
42
43
43
44
44
45
45
46
46
47
47
48
48
49
49
50
50
51
51
52
52
53
53
54
ˆ z
ˆ x
ˆ y
54
55
ˆ z
ˆ x
ˆ y
55
56
ˆ z
ˆ x
ˆ y
56
57
57
58
z
y
x
58
59
59
60
60
61
61
62
62
63
q· p = (zqsp +zpsq +zp ×zq , spsq −zp ·zq)
q∗ = (−z,s)
63
64
r = (ˆ
64
65
65
66
66
67
67
68
zz zy zx yz yy yx xz xy xx
68