“On this page you will find about the benefits of easily Easy Learning Line Drawing algorithem using DDA Algorithm. Line Drawing algorithem using DDA Algorithm a major role in IT department and in the Computer professional . We will explain why easily Easy Learning Line Drawing algorithem using DDA Algorithm is important, how to Learning Line Drawing algorithem using DDA Algorithm, and how to learn it if you're unfamiliar with Line Drawing algorithem using DDA Algorithm. "
What is Line Drawing algorithem using DDA Algorithm and why is it important?
Line Drawing algorithem using DDA Algorithm used in go for easy IT department.Therefore, in everyday learning , Line Drawing algorithem using DDA Algorithm is added to the life help the go to IT profesional job. On this page we have explained in detail in writing what is the solution to How to learning Easy Line Drawing algorithem using DDA Algorithm.
Why is Line Drawing algorithem using DDA Algorithm impotent?
Do not worry if you have any doest not know to computer knowledge while getting job and go to IT field.It will be more effective if we use the tips mentioned. It will be more effective if we use the tips mentioned. The number of sizes to use in the notes is specifically given.
Line Drawing algorithem using DDA Algorithm and Reminders:
You mentioned similar tips on another page about Line Drawing algorithem using DDA Algorithm.
How to know the benefits of easily Easy Learning Line Drawing algorithem using DDA Algorithm:
Line Drawing algorithem using DDA Algorithm
Aim :
TO write a C program to draw a line using DAA algorithm .
Algorithm:
1. start the program
2. Read the staring and ending coordinates Xa, Ya , Zb Yb
3.Find the x-co-ordinate difference and y-dx=xb-xa
4. compare the difference and device the step value
if (dx >dy)
step =dx
else
step = dy
5. Find the increament value of coordinates
xi = dx / step
yi = dy / step
6. Display the starting point using the fuction put pixel (xa, ya, 4)
7. Find the adjecent pixel using the formula xa = xa + xi; ya = ya + yi;
8. Reat the steps full reaching the end points i.e ya = yb and xa = xb
9. stop the program
Program:
#include <stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int gd = DETECT,gm;
float xadj, yadj, xa, ya, xb, yb, dx, dy, step , xi, yi, d,t1,t2;
initgraph(&gd,&gm,"");
d=1;
printf("Enter the starting coordinates:");
scanf ("%f%f'",&xb,&xb,&yb);
dx = xb - xa;
dy = yb - ya;
if (abs(dx)>abs(dy))
step=abs (dx);
else
step = abs (dy);
xi =dx/step;
yi =dy/step;
while (d==1)
{
putpixel(xa, ya, 4);
xadj = xa+ xi;
xa = xadj;
ya = yadj;
if((xa==xb)&&(ya==yb))
d=0;
}
getch();
closegraph();
}
ourput:
Enter the starting coordinates: 100 100
Enter the starting coordinates:200 200
Result:
Thus, a line is drawn succesfully using DAA algorithm in C .
Comments
Post a Comment