BRESENHEM CIRCLE DRAWING PROGRAM IN C
BRESENHEM CIRCLE DRAWING PROGRAM IN C
Similar Programs
- Flood Fill program in C
- Triangle Rotation Program
- Text animation program in C
- C program for fixed point scaling and rotation
- C Program for shearing of triangle, line and rectangle
- C program to plot different types of lines
- Scaling program in C
- Font animation program in C
- Midpoint ellipse drawing program in C
- Circle Midpoint program in C
- Translation program in C
- Bresenhem Circle drawing program in C
- String Generation program in C
- Bresenhem Line drawing program in C
- Plotting a pixel in C
- DDA line drawing program in C
- Boundary fill program in C
- Character Generation program in C
- Triangle Rotation program in C
#include<stdio.h>
#include<conio.h>
#include<graphics.h>
#include<math.h>
void main()
{
int gd=DETECT,gm;
int r,x,y,p,xc=320,yc=240;
initgraph(&gd,&gm,"c:\TC\BGI");
cleardevice();
printf("Enter the radius :");
scanf("%d",&r);
x=0;
y=r;
putpixel(xc+x,yc-y,1);
p=3-(2*r);
for(x=0;x<=y;x++)
{
if(p<0)
{
y=y;
p=(p+(4*6)+6);
}
else
{
y=y-1;
p=p+(4*(x-y)+10);
}
putpixel(xc+x,yc-y,4);
putpixel(xc-x,yc-y,4);
putpixel(xc+x,yc+y,4);
putpixel(xc-x,yc+y,4);
putpixel(xc+y,yc-x,4);
putpixel(xc-y,yc-x,4);
putpixel(xc+y,yc+x,4);
putpixel(xc-y,yc+x,4);
}
getch();
closegraph();
}