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 niệm cơ bản  
Le Tan Hung  
II Các phép biến đổi  
III Hệ tọa độ đồng nhất  
1
(c) SE/FIT/HUT 2002  
Mô hình hoá - Modelling  
„ mô hình - model :  
„ Modeling - Mô hình hoá  
„ Thực thể cơ sở -  
object  
primitives  
„ như circles, lines polygons  
hay cubes  
„ Cảnh - A scene  
„ mô hình hoá cảnh - 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 kỹ thuật đồ hoạ 3 bước: modeling, rendering,  
displaying  
„ Với 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 tạo Hoạt cảnh - 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  
„ Một mô hình có thể quan sát  
trên các góc cạnh 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 tọa độ với chỉ 2 điểm đầu cuối của  
đoạn thẳng tạo thành 2 điểm mới mà khi nối chúng với  
nhau tạo thành đoạn thẳng mới.  
„ Các điểm nằm trên đoạn thẳng sẽ có kết quả là điểm  
nằm trên đoạn thẳng mới với cùng phép biến đổi thông  
qua phép nội suy.  
7
(c) SE/FIT/HUT 2002  
Phân loại - 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  
„ Mỗi phương pháp có ưu  
nhược điểm riêng về bản  
chất 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 học hai chiều  
„ Phương pháp biểu diễn đối tượng P = [ x y ]  
a b  
c d  
„ Phép biến đổi vị trí điểm  
T =  
„ Thực 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 bất biến  
x
z
„ Phép biến đổi tỉ lệ - Scaling  
„ A scaling change factors, Sx and Sy  
„ Phép biến dạng  
„ 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  
Thuộc tính cơ bản của 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 hợp các phép biến đổi  
Composition of Affine Transforms  
„ Any affine transformation can be  
decomposed into elementary  
transformations.  
„ Mọi phép biến i phc tp u có  
thể tạo thành từ các phép biến đổi cơ  
sở như:  
„ Dịch chuyển - Translation  
„ Tỉ lệ - Scaling  
„ Quay- Rotation  
„ Biến dạng - 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  
Thuộc tính  
T
„ Tác động lên tập các điểm đặc trưng của đối tượng tạo  
thành phép biến đổi cho đối tượng  
points  
18  
(c) SE/FIT/HUT 2002  
Điểm gốc - Pivotal points  
Cho phép quay và tỉ lệ Rotation 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 20180 Free
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