Documente Academic
Documente Profesional
Documente Cultură
1
Transformari grafice 2D
Y P(x,y)
P(x’,y’)
O X
2
Transformari grafice 2D
P(x,y)
Y
Y’
O
O’ X
X’
3
Transformari geometrice 2D
Translatia
Scalarea fata de origine
Rotatia fata de origine
Oglindirea
Forfecarea
4
Utilizarea transformarilor geometrice
Obiete = set de varfuri
Aplicarea unei succesiuni de transformari => aceleasi modificari intregului set de varfuri
x
Reprezentare punct y - reprezentare prin vectori coloana
Translatia
Vector de translatie
ty
tx
6
Translatia
tx P’
Y
ty
P(x, y)
P’(x’, y’)
P
O X
x’ = x + tx x' x tx Matricea de
y’ = y + ty y' y ty translatie
T(tx,ty)
Sunt pastrate lungimile, unghiurile
7
Scalarea fata de origine – Scalare uniforma
sx 2
sy 2
(1, 1) (2, 2)
(3, 1) (6, 2)
sx, sy – factori de scalare pe axa ox, respectiv oy
sx 3
sy 1
sx 1
sy 2
sx = 2,
sy = 0.5
10
Rotatia fata de origine
Rotatie pozitiva
u – unghi de rotatie
11
Rotatia fata de origine
P’(x’, y’)
u P(x,y)
v
x = cos(v) y = sin(v)
x’ = cos(u+v) y’ = sin(u+v)
Transformari afine:
13
Transformari compuse
6
5
4
3
2
1
0
1 2 3 4 5 6 7 8 9 10
14
Reprezentare matriceala (4)
15
Coordonate omogene
16
Coordonate omogene
• Reprezentarea unui punct in coordonate omogene nu este unica
• (3, 2, 1), (6, 4, 2) sau (9, 6, 3) sunt reprezentari posibile ale punctului (3, 2) in coordonate omogene
x
y - reprezentare prin vectori coloana
1
Translatia : x' x tx
y' y ty
x' 1 0 tx x
y' 0 1 ty y
1 0 0 1 1
18
Reprezentare matriceala
x' sx 0 0 x
y' 0 sy 0 y
1 0 0 1 1
Matricea de scalare S(sx,sy)
19
Reprezentare matriceala
20
Transformari geometrice elementare
• Translatia: x' x
y' T(tx, ty) y
1 1
x' x
• Rotatia fata de origine y' R(u) y
1 1 21
Compunerea transformarilor
6
Translatie cu tx=6, 5
4
ty=0 si rotatie si 45º 3
2
1
0
1 2 3 4 5 6 7 8 9 10
Y 6
5
Rotatie cu 45º si 4
3
translatie cu tx=6, ty=0 2
1
0
1 2 3 4 5 6 7 8 9 10
X
22
Transformari geometrice elementare - inverse
1) T(6, 3)
2) T(-6, -3)
23
Transformari geometrice elementare - inverse
24
Scalarea fata de un punct fix F
F(xf, yf)
25
Scalarea fata de un punct fix F
T(-xf, -yf)
F(xf, yf)
F(xf, yf)
26
Scalarea fata de un punct fix F
x' x
y' T(xf, yf) S(sx, sy) T(-xf, - yf) y
1 1
27
Rotatia fata de un punct fix F
F(xf, yf)
x’ = x
y’ = -y
x' 1 0 0 x
y' 0 - 1 0 y
1 0 0 1 1
Matricea de oglindire
Ox = Ox-1 29
Oglingirea
Oglindirea fata de axa oy
x' - 1 0 0 x
x’ = -x y' 0 1 0 y
y’ = y
1 0 0 1 1
Oy = Oy-1 30
Oglingirea
Oglindirea fata de origine
x' - 1 0 0 x
y' 0 -1
0 y
x’ = -x 1 0 0 1 1
y’ = -y
OO = OO-1 31
Transformari geometrice
• Oglindirea fata de o dreapta oarecare d
x ' x
y' T(x1, y1) R(u) O R(-u) T(-x1, - y1) y
x
1 1
Forfecarea fata de ox
f factor de forfecare de-a lungul axei ox
x
x' x y * fx
y' y
fx
x' 1 fx 0 x
y' 0 1 0 y
1
0 0 1
1
33
Transformari geometrice
x' x
y' y x * fy
fy
x' 1 0 0 x
y' f 1 0 y
y
1 1
0 0 1
34
Transformari geometrice
Forfecarea fata de ambele axe
y y
fx
1 1
fy
O 1 x O 1 x
x' x y * fx
y' y x * fy
x' 1 fx 0 x
y' f 1 0 y
y
1 0 0 1
1
35
Transformari 2D ale sistemelor de coordonate
y'
• Translatia y
y’ P
y
O' x’
x'
ty
O
tx x x
x' x tx
y' y ty
36
Transformari 2D ale sistemelor de coordonate
Scalarea
xoy – sistem de coordonate cu unitatea de masura m
x’o’y’ – sistem de coordonate cu unitatea de masura mm
• Rotatia
y y
y'
P P
x'
v
u
O
x
O x
y y
y'
P P
x'
v
u
O
x
O x
• Oglindirea fata de ox
y
y
x x
O
O
y'
x’ = x
y’ = -y
40
Transformari 2D ale sistemelor de coordonate
• Oglindirea fata de oy
y y
x x' x
O O
x’ = -x
y’ = y
41
Transformari 2D ale sistemelor de coordonate
42
Transformarea de instantiere
y
O x
O
2 x C(300,200) 100
(0,-1)
4 y
sistem de coordonate
Sistem de
asociat suprafetei de
Sistem
sistem de
de coordonate afisare
coordonate
obiect
coordonate
global
obiect
Transformarea de
instantiere
43
Transformarea de instantiere
y
O x
100
(-2,1) (2,1)
O C(300,200) 100
2 x
(0,-1)
4 y
sistem de coordonate
Sistem de coordonate Sistem global
de coordonate
sistem de coordonate
obiect
obiect global
Scalare: sx = 100/4 = 25, sy = 100/2 = 50
Scalare uniforma: sx = sy = min(sx, sy) = 25
Oglindire fata de axa x
Translatie astfel incat O -> C
tx = 300 – 0 = 300, ty= 200 – 0 = 200
44
Transformarea de instantiere
y
O x
100
(-2,1) (2,1)
O C(300,200) 100
2 x
(0,-1)
4 y
sistem de coordonate
Sistem de coordonate Sistem global
de coordonate
sistem de coordonate
obiect
obiect global
45
Transformarea de instantiere
transformarea x’ = x * 25 + 300
de instantiere Y’ = -y * 25 + 200
46
Transformarea fereastra-poarta
instantiere
poarta
fereastra
47
48
Transformarea fereastra-poarta
Face trecerea din sistem de coordonate 2D real in
sistemul de coordonate asociat dispozitivului de
afisare
Fereastra – zona dreptunghiulara cu laturile
paralele cu axele sistemului de coordonate real ce
incadreaza imaginea reprezentata in spatiul 2D
real
Poarta – zona dreptunghiulara cu laturile paralele
cu axele sistemului de coordonate dispozitiv (in
care se va face afisarea)
49
Transformarea fereastra-poarta
Fereastra
50
Transformarea fereastra-poarta
y y
transformarea
(0.5,1) fereastra (200,200) (400,200)
(1,1)
poarta
transformarea
(0.5,1) fereastra (200,200) (400,200)
(1,1)
poarta
52
Transformarea fereastra-poarta
Afisare pe ecran – poarta (0,0) – (400,200)
y
(100,0) (300,0) x
(0.5,1) (1,1)
(200,200) (400,200)
(0,0) (1,0) x y
(0,0)
53
54
55
Transformarea fereastra-poarta
Afisare pe ecran
(0,0) (100,0) (300,0) x (200,0) x
y
(200,200) (400,200) (100,200) (300,200)
y y
xp xf * sx tx
yp yp min yp max ( yf * sy ty)
56
Transformarea fereastra-poarta
xp xf * sx tx
yp yp min yp max ( yf * sy ty )
yf * sy yp min yp max ty
sx 0 tx
M 0 sy yp min yp max ty
0 0 1
57