Saturday, March 12, 2011

CG - Midpoint ellipse algorithm

Midpoint ellipse algorithm is a method for drawing ellipses in computer graphics. This method is modified from Bresenham's algorithm. The advantage of this modified method is that only addition operations are required in the program loops. This leadsto simple and fast implementation in all processors.

An ellipse with center at the origin and axes parallel to the x - y axes has the formula
f(x, y) = (x.x/a.a  +  y.y/b.b) -1=0

where a and b are the radii, and where f is positive if a point (x,y) lies outside the ellipse, is negative
if a point is inside the ellipse, and is zero if a point is on the ellipse.


Let us consider one quarter of an ellipse. The curve is divided into two regions. In
region I, the slope on the curve is greater than -1 while in region II less than -1.
dy/dx = -1
Region II
Region I
a
b
x
y
m = -1




No comments:

Post a Comment