How to know the benefits of easily Easy Learning Line Drawing algorithem using DDA Algorithm


“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 .


Line Drawing using Bresenham's Algorithems 

Aim:
To write a c program in C to draw a line using Breseham's algorithm.

Algorithm:

1.start the program 
2.Read the starting and ending coordinates Xa, Ya,Xb,Yb
3.Find the x-coordinate and Y difference 
4. calculate decision parameter 'P' value p=zdy-dx 
5. Fix the starting and ending coordinates 

if (xa>xb)
x start = xa 
y start = ya 
x  end= xb
y end= yb 
else y start = xb 
y end =xa 
y end =ya 

6. Display the starti8ng coordinates using fuction put pixel (xa, ya).
7. Find adjecent pixel using following fomula 
(i) x=n x stant and y= y stant
(ii) white (x<xend) 
x=x+1
is (p<0)
p=p+2* dy 
else p=p+2*(dy-dx)
(iii)put p= pixel (x,y)
 8. Repeat the steps fill reach the end point 
9.stop the program 

program:

#include<stdio.h>
#include<conio.h>
#include<graphics.h>
void main ()
{
int gd = DETECT, gm;
int xa,xb,ya,dx,dy,x,y,xstart , ystart,xend,yend,p;
clscr();
pringf ("Enter the xa & ya value :");
scanf("%d %d",&xa,&ya);
printf("Enter the xb & yb value:");
scanf("%d %d",xb,&yb);
dx=abs(xa-xb);
dy=abs(ya-yb);
p=2*dy-dx;
if(xa<xb)
{
xstart=xa;
ystart=yb;
xend=xb;
yend=yb;
}
else
{
xstart=xb;
ystart=yb;
xend=xa;
yend=xa;
}
putpixel(xstart,ystart,4);
x=xstart;
y=ystart;
while(x<xend)
{
x=x+1;
if(p<0)
p=p+(2*dy);
else
}
putpixel(x,y,1);
}
getch();
closegraph();
}


Output:

Enter the xa & ya value: 200 200
Enter the xb & yb value: 350 450 


Awesome information about  Line Drawing algorithem using DDA Algorithm was given above in this wonderful new blog of yours. It provided information on types, references, pictures, etc






Comments