0% found this document useful (0 votes)
149 views2 pages

Computer Graphics & Image Processing Laboratory: Lab: 5 Midpoint Ellipse Drawing Algorithm

This document describes the midpoint ellipse drawing algorithm. It scans the center point and radii of the ellipse, then uses a loop to iteratively calculate and check a decision parameter to determine which pixel points around the ellipse perimeter to draw, accounting for changes in the x and y radii. It draws all 8 octant points at each iteration before incrementing x or y and updating the decision parameter accordingly.

Uploaded by

Anik Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views2 pages

Computer Graphics & Image Processing Laboratory: Lab: 5 Midpoint Ellipse Drawing Algorithm

This document describes the midpoint ellipse drawing algorithm. It scans the center point and radii of the ellipse, then uses a loop to iteratively calculate and check a decision parameter to determine which pixel points around the ellipse perimeter to draw, accounting for changes in the x and y radii. It draws all 8 octant points at each iteration before incrementing x or y and updating the decision parameter accordingly.

Uploaded by

Anik Sen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Computer Graphics & Image

Processing Laboratory
Lab : 5
Midpoint Ellipse Drawing Algorithm
Scan(xc, yc, a, b); tmp1=(x+0.5)*(x+0.5);
x = 0, y = b;
tmp2=(y-1)*(y-1);
a_sqr=a*a; b_sqr=b*b;
fx=2*b_sqr*x; fy=2*a_sqr*y; d=b_sqr*tmp1+a_sqr*tmp2-
d=b_sqr-(a_sqr*b)+(a_sqr*0.25); (a_sqr*b_sqr);
do do {
{ putpixel(x_center+x,y_center+y,1);
putpixel(x_center+x,y_center+y,1);
putpixel(x_center-x,y_center-y,1); putpixel(x_center-x,y_center-y,1);
putpixel(x_center+x,y_center-y,1); putpixel(x_center+x,y_center-y,1);
putpixel(x_center-x,y_center+y,1); putpixel(x_center-x,y_center+y,1);
if(d<0) {
if(d>=0)
d=d+fx+b_sqr;
} d=d-fy+a_sqr;
else { else{
y=y-1; d=d+fx-fy+b_sqr; x=x+1;d=d+fx-fy+a_sqr;
fy=fy-(2*a_sqr);
fx=fx+(2*b_sqr);
}
x=x+1; fx=fx+(2*b_sqr); }
delay(10); y = y-1; fy = fy-(2*a_sqr);
} while(fx<fy); }while(y>0);

You might also like