Describe the Implementation of Midpoint Circle Algorithm

1 month ago

The Implementation of Midpoint Circle Algorithm


 void circleMidpoint (int xCenter, int yCenter, int radius)

 {

int x = 0; int y = radius;

 int p = 1 - radius;

void circlePlotPoints (int, int, int, int);

 /* Plot first set of points */

 circlePlotPoints (xCenter, yCenter, x, y);

 while (x < y) { x++ ; if (p < 0) p +=2*x +1;

else

 {

y--; p +=2* (x - Y) + 1;

}

circlePlotPoints(xCenter, yCenter, x, y)

 }

 }

 void circlePlotPolnts (int xCenter, int yCenter, int x, int y)

 {

 setpixel (xCenter + x, yCenter + y ) ;

setpixel (xCenter - x. yCenter + y);

setpixel (xCenter + x, yCenter - y);

setpixel (xCenter - x, yCenter - y ) ;

 setpixel (xCenter + y, yCenter + x);

setpixel (xCenter - y , yCenter + x);

setpixel (xCenter t y , yCenter - x);

setpixel (xCenter - y , yCenter - x);

}  

75
Views
Rajiv Bikram
Oct 20, 2021
More related questions

Questions Bank

View all Questions

Top