Bài giảng Đồ họa hiện thực ảo - Bài 4a: Các phép biến đổi Đồ hoạ - Lê Tấn Hùng

Bài 4 Các phép biến đổi Đồ hoạ  
Affine Transformations  
I KHái nim cơ bn  
Le Tan Hung  
Email: hunglt@it-hut.edu.vn  
II Các phép biến đổi  
III Hta độ đồng nht  
1
(c) SE/FIT/HUT 2002  
Mô hình hoá - Modelling  
„ mô hình - model :  
„ Modeling - Mô hình hoá  
„ Thc thcơ s-  
object  
primitives  
„ như circles, lines polygons  
hay cubes  
„ Cnh - A scene  
„ mô hình hoá cnh - Scene  
Modeling  
A scene with several instances of the object  
2
(c) SE/FIT/HUT 2002  
Ví d  
„ At each frame of the animation, the  
object is transformed, in this case by a  
rotation. It could also be transformed  
by changing its size (scaling), or its  
shape (deforming
(translation).  
„ Further animation effects can be  
achieved by not changing the object,  
but the way it is viewed (i.e. the  
window to viewport transformation) at  
each frame (e.g. b
(c) SE/FIT/HUT 2002  
Phép biến đổi - Transformations  
„ Trong kthut đồ ho3 bước: modeling, rendering,  
displaying  
„ Vi Modeling:  
world  
coordinate  
modeling  
viewing  
coordinate  
(eye coordinate)  
Modeling  
Viewing  
coordinate  
transformation  
transformation  
„ Phép biến đổi - Transformation  
„ Biến đi mô hình hoá - Modeling transformations  
„ Biến đi to góc nhìn - Viewing transformations  
„ Biến đi to Hot cnh - Animation  
4
(c) SE/FIT/HUT 2002  
Transformations - Modeling  
world  
5
(c) SE/FIT/HUT 2002  
Viewing  
Transformations - Viewing  
„ Viewing  
„ Transformations - Viewing  
„ Trong phép biến đổi này :  
CAMERA  
OBJECT  
„ Mt mô hình có thquan sát  
trên các góc cnh khác nhau  
(e.g. faraway, near, looking  
down, looking up)  
WORLD  
6
(c) SE/FIT/HUT 2002  
Phép biến đổi Affine  
Affine Transformations?  
„ Phép biến đổi Affine  
„ Ví d: phép biến đổi ta độ vi ch2 đim đầu cui ca  
đon thng to thành 2 đim mi mà khi ni chúng vi  
nhau to thành đon thng mi.  
„ Các đim nm trên đon thng scó kết quđim  
nm trên đon thng mi vi cùng phép biến đổi thông  
qua phép ni suy.  
7
(c) SE/FIT/HUT 2002  
Phân loi - Transformations  
Example: OBJECT TRANSFORMATION  
„ Có 2 cách nhìn trên phép  
biến đổi  
.4, 2  
„ Object Transformation:  
1,1  
„ Coordinate  
Transformation  
„ Mi phương pháp có ưu  
nhược đim riêng vbn  
cht tương đồng nhau  
(1,1)  
(1,1)  
(c) SE/FIT/HUT 2002  
Modeling Transformations  
Transform objects/points  
Transform coordinate system  
9
(c) SE/FIT/HUT 2002  
2D Object Transformations  
„ A 2D object transformation alters each point P into a  
new point Q using a specific formula or algorithm.  
„ It therefore alters the co-ordinates of P (Px,Py) into  
new values which specify point Q (Qx,Qy)  
„ This can be expressed using some function T, that  
(c) SE/FIT/HUT 2002  
Matrix Representation  
„ If affine transformation T maps P onto Q, then Q is related to P as  
follows:  
„
„
„ where a, = bc  
„ This gives rise to the following matrix representation:  
Q
P
t
  a b      
x
x
x
   
   
     
+
=
„ i.e.  
     
Py t y  
Q
c d  
y
   
     
(c) SE/FIT/HUT 2002  
Các phép biến đổi hình hc hai chiu  
„ Phương pháp biu din đối tượng P = [ x y ]  
a b  
c d  
„ Phép biến đổi vtrí đim  
T =  
„ Thc thi phéúng trên toàn bộ đối  
tượng  
y
pW  
pM  
x
z
12  
(c) SE/FIT/HUT 2002  
y
Phép biến đổi  
„ Phép bt biến  
x
z
„ Phép biến đổi tl- Scaling  
„ A scaling change factors, Sx and Sy  
„ Phép biến dng  
„ A shearing shears an object in a particular direction, (in 2D, it’s either in the x  
or in the y direc
13  
(c) SE/FIT/HUT 2002  
Phép quay- Rotation  
y
( x’, y’ )  
ρ
θ
( x, y )  
ρ
α
x
14  
(c) SE/FIT/HUT 2002  
Thuc tính cơ bn ca phép biến đổi  
Affine Transformations  
„ Preservation of lines:  
„ Affine transformations map lines to lines;  
„ Preservation of parallelism  
„ Preservation of proportional distances  
Det(M) |;  
15  
(c) SE/FIT/HUT 2002  
Kết hp các phép biến đổi  
Composition of Affine Transforms  
„ Any affine transformation can be  
decomposed into elementary  
transformations.  
„ Mi phép biến i phc tp u có  
thto thành tcác phép biến đi cơ  
snhư:  
„ Dch chuyn - Translation  
„ Tl- Scaling  
„ Quay- Rotation  
„ Biến dng - Shearing  
(c) SE/FIT/HUT 2002  
affine combinations  
„ It is rare that we want to perform just one elementary  
transformation.  
„ Usually an application requires that we build a complex  
transformation out of several elementary ones  
„ e.g. translate an object, rotate it, and scale it, all in one move  
transformation  
also an affine transformation  
(c) SE/FIT/HUT 2002  
Thuc tính  
T
„ Tác động lên tp các đim đặc trưng ca đối tượng to  
thành phép biến đổi cho đối tượng  
points  
18  
(c) SE/FIT/HUT 2002  
Đim gc - Pivotal points  
Cho phép quay và tlRotation and Scaling  
„ The simple versions of rotation and scaling have been based around the origin.  
„ This means that when we rotate or scale, the object will also move, with  
respect to the origin  
„ Translate all points through (-c1,-c2)  
„ Rotate all points about the origin by  
„ Translate all points back through (c1,c2)  
(c1,c2)  
(0,0)  
(c) SE/FIT/HUT 2002  
Pivotal points  
„ Often we wish to rotate or scale with respect to some pivotal  
point, not the origin  
„ Most significantly, we often wish to rotate or scale an object  
about its centre, or midpoint  
„ In this way, the object’s location does not change  
„ To do this, we relate the rotation or scaling about the pivotal  
„ We first translate all points so that V coincides with the origin  
„ We then rotate or about the origin  
„ then all points are translated back, so that V is restored to its original  
location  
(c) SE/FIT/HUT 2002  
Tải về để xem bản đầy đủ
pdf 41 trang yennguyen 13/04/2022 3800
Bạn đang xem 20 trang mẫu của tài liệu "Bài giảng Đồ họa hiện thực ảo - Bài 4a: Các phép biến đổi Đồ hoạ - Lê Tấn Hùng", để tải tài liệu gốc về máy hãy click vào nút Download ở trên

File đính kèm:

  • pdfbai_giang_do_hoa_hien_thuc_ao_bai_4a_cac_phep_bien_doi_do_ho.pdf