Professional Documents
Culture Documents
Spring 2009, # 2
2D Graphical Primitives
d1 d2
x, y
-x, y 1
2 slope = -1
-x, -y x, -y
Computer Graphics, Spring 2009, Lecture Notes # 2 4
Midpoint Algorithm: Ellipse
Condition for dy/dx = -1 : occurs at (x0,y0)
where x0∗(ry)2 = y0∗(rx)2
At this point we switch from incrementing x
to decrementing y!
Algorithm:
while ( x∗(ry)2 < y∗(rx)2 ) ∆x = 1;
while ( y > 0 ) ∆y = -1;
p2k+1 = FE(xk+1+0.5,yk+1-1)
X
0 1 2 3 4 5 6 7 8
Y Y
7 7
6 6
5 5
4 4
3 3
2 2
1 1
0 0
X X
0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
drawn desired
Computer Graphics, Spring 2009, Lecture Notes # 2 13
Area preservation