Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Laboratory Manual

CS and IT Department

SACHDEVA INSTITUTE OF
TECHNOLOGY
FARAH, MATHURA.

Computer Graphics Lab


Manual

[Lab NCS-453]

List of Experiments
Q.1 W A P To implement DDA( digital
circle.

differential analyzer)

//in the name of GOD


#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main()
{
int gd=DETECT,gm;
int x1=30,x2=90,y1=40,y2=100,dx,dy,n,c,step,xi,yi;
initgraph(&gd,&gm,"C:\\TC\\BGI ");
dx=x2-x1;
dy=y2-y1;
if(dx>dy)
{
step=dx;
}

algorithms for line and

else
{
step=dy;
}
xi=dx/step;
yi=dy/step;
while((x1<=x2)&&(y1<=y2))
{
x1=x1+xi;
y1=yi+yi;

putpixel(x1,y1,9);
}
getch();
}

OUTPUT

You might also like