You are on page 1of 3

Faculty of Computer Science and Engineering

Department of Computer Science

P N BI TP 7
Cu 1:
a.
Bc
1
2
3
4

,
Pixel c chn
(2,1)
(3,2)
(4,2)
(5,3)

,
Cp nht pk

Vy cc im v l: (2,1) - (3,2) (4,2) (5,3).


. i vai tr x,y

b.
>(6, 4)
Bc
1
2
3
4
5
6

,
Pixel c chn
(1,1)
(2,2)
(3,2)
(4,3)
(5,3)
(6,4)

,
Cp nht pk

Do i vai tr, nn cc im v l: (1, 1) - (2, 2) (2, 3) (3, 4) (3, 5) (4,6).


Cu 2: n gin ta xt ng trn tm (0, 0) bn knh R. Chng ta ch cn v 1/8 ng trn, cc
phn cn li c th ly i xng t phn ny.
Gi s ta v 1/8 ng trn bt u t v tr (0, R), gi tr x tng dn t 0 n v tr tha mn x >= y.
Tng t i vi on thng, gi s ta ang v tr (xi, yi). Ti v tr k tip xi+1, gi tr yi+1 s chn 1 trong
2 gi tr yi hoc yi - 1 da vo bin quyt nh

Trong :

Suy ra:

Faculty of Computer Science and Engineering


Department of Computer Science

Suy ra:

T (1) thay

ta c:

int x, y, p;
x = 0;
y = R;
p = 3 - 2 * R;
while (x <= y){
putpixel(x0 + x, y0 + y,color);
putpixel(x0 - x, y0 - y,color);
putpixel(x0 - x, y0 + y,color);
putpixel(x0 + x, y0 - y,color);
putpixel(x0 + y, y0 + x,color);
putpixel(x0 - y, y0 - x,color);
putpixel(x0 - y, y0 + x,color);
putpixel(x0 + y, y0 - x,color);
if (p < 0){
p += 4 * x + 6;
}else{
p += 4 * (x-y) + 10;
y--;
}
x++;
}
Cu 3: Xem gio trnh
Cu 4:

Faculty of Computer Science and Engineering


Department of Computer Science
a. Mipmapping cp n k thut precomputing anti-aliased ca nhiu nh texture, v to cc
texture ny trong mt texture render. Mi texture tip theo trong bn MIP l 1/4 kch thc
texture trc . Mc ch ca k thut nhm lm tng tc render v gim hin tng aliasing
artifacts.
b. S byte ti thiu lu tr tt c cc mc mipmap cn li:

Cu 5:
a. xa=0.3*16=4.8, ya=0.4*16=6.4
Do tm ca texel th (i, j) nm (i+0.5, j + 0.5) do texel gn vi v tr (4.8, 6.4) l (4, 6).
b. Tng t
xb=0.6*16=9.6, yb=0.2*16=3.2
=> chn texel v tr: (9, 3)
Cu 6:
a. Texel v tr: (4.8,6.4)
=> 4 Texel: (4,5);(4,6);(5,5);(5,6)
b. Texel v tr: (9.6,3.2)
=> 4 Texel: (9,2);(9,3);(10,2);(10,3).
-Ht-