Professional Documents
Culture Documents
Lab Report 3, Computer Graphics BCA 5th Sem
Lab Report 3, Computer Graphics BCA 5th Sem
Theory:
The midpoint circle drawing algorithm is a graphics algorithm used to draw a circle. It works by
calculating points of the circle using symmetry properties of the circle and incrementally
updating a decision parameter to determine the next points. It's efficient because it uses integer
arithmetic and avoids using costly floating-point operations.
Algorithm:
1. Initialize the center (x_center, y_center) and the radius r of the circle.
Source Code
#include <stdio.h>
#include <graphics.h>
int x = 0, y = r;
int P = 1 - r;
while (x < y) {
if (P < 0)
P += 2 * x + 3;
else {
P += 2 * (x - y) + 5;
y--;
}
x++;
int main() {
getch();
closegraph();
return 0;
Output