Page 73 - DCAP313_LAB_ON_COMPUTER_GRAPHICS
P. 73
Unit 5: Implementing Ellipse Algorithm
Notes
2
2
= b(x+ 2x +1)+ a(y - y + 1 4 ) - ab 2
2
2
2
k
k
k
k
If P k < 0, select E:
E
P k+1 = f(x k + 2, y k – ½)
2 2
2
2
= b (x k + 2) + a (y k – ½) – a b
2
2
= b(x+ 4x +4)+ a(y - y + 1 4 ) - ab 2
2
2
2
2
2
k
k
k
k
E
E
Change of P is : DP = P k+1 - P =b (2x+ 3)
E
2
k
k
k
k
If P k > 0, select SE:
P k+1 = f(x k + 2, y k – 3/2)
SE
= b (x k + 2) + a (y k – 3/2) – a b
2 2
2
2
2
2
= b(x+ 4x +4)a (y - 3y +9/4) - a b 2
2
2
2
2
2
k
k
k
k
SE
SE
Change of P = is DP = P k+1 – P k = b (2x k + 3) – 2a (y k – 1)
SE
2
2
k
k
Calculate the changes of ∆Pk:
If E is selected,
DP k+1 = b (2x k + 5)
2
E
D P = DP k+1 - DP =2b 2
2
E
E
E
k
k
DP k+1 = b (2x k + 5) – 2a (y k – 1)
2
2
SE
D P = DP k+1 - D SE = 2 b 2
SE
SE
2
k
k
If SE is selected,
2
E
DP k+1 = b (2x k + 5)
E
2
E
E
D P = DP k+1 - DP =2b 2
k
k
DP k+1 = b (2x k + 5) – 2a (y k – 2)
SE
2
2
2
D P SE DP SE - DP =2(a +b )
2
SE
2
k = k+1 k
Initial values:
2
x 0 = 0, y 0 = b, P 0 = b + ¼a (1 – 4b)
2
2
E
DP = 3b ,P =3b - 2a(b - 1)
D
2
2
SE
0 0
In region II (dy/dx < –1), all calculations are similar to that in region we except that y is
decremented in each step.
LOVELY PROFESSIONAL UNIVERSITY 67