Showing posts with label Computer Graphics. Show all posts
Showing posts with label Computer Graphics. Show all posts

Monday, September 24, 2012

Bresenham's line drawing code in c

# include <stdio.h>
# include <conio.h>
# include <graphics.h>

void main()
{
int dx,dy,x,y,p,x1,y1,x2,y2;
int gd,gm;

clrscr();

printf("\n\n\tEnter the co-ordinates of first point : ");
scanf("%d %d",&x1,&y1);
printf("\n\n\tEnter the co-ordinates of second point : ");
scanf("%d %d",&x2,&y2);

Bresenham Circle drawing 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;