(c) SE/FIT/HUT 2002 1
Bài 3:
Các giithutcơs
Le Tan Hung
hunglt@it-hut.edu.vn
0913030731
(c) SE/FIT/HUT 2002 2
Ni dung
Các giithutxénta - Clipping
Các thut toán minkín
Phép mu
Phép x Antialiasing
(c) SE/FIT/HUT 2002 3
Xén ta - Clipping
Nhim v cơ bn trong đồ ha là gicác
phn ca đối tưng la chn nm bên
ngoài đồ ho.
Xén talàvic di chuyn tt ccác đối
tượng hoc các phn ca đối tưng thuc
mô hình ngcnh ra bên ngoài ca sthế
gii thc
Vicloitng đimnh cađốitượng
thường chmnhtlàkhiđốitượng
phnlnnm ngoài cashinth.
Kthut thc hành là cn thiết để nâng
cao tc độ trong thc hin nhim v
Định nghĩa
Clipping đim
xmin x xmax
ymin y ymax
(c) SE/FIT/HUT 2002 4
Clipping đonthng
Lines are defined by their endpoints, so it should be
possible just to examine these (in a similar way to points) and
determine whether or not to clip without considering every
pixel on the line
We often have windows that are either very large, i.e. nearly
the whole scene fits inside, or very small, i.e. most of the
scene lies inside the window
Hence, most lines may be either trivially accepted or rejected
(c) SE/FIT/HUT 2002 5
GiithutCohen Sutherland
Outcode
The Cohen-Sutherland line-clipping algorithm is particularly
fast for “trivial” cases, i.e. lines completely inside or outside
the window.
Non-trivial lines, i.e. ones that cross a boundary of the
window, are clipped by computing the coordinates of the new
boundary endpoint of the line where it crosses the edge of the
window
Each point on all lines are first assigned an “outcode”
defining their position relative to the clipping rectangle