[Go to site: main page, start]

0% found this document useful (0 votes)
62 views1 page

DDA Algorithm for Line Drawing

The DDA algorithm is an incremental method for scan conversion of lines. It performs calculations at each step using results from previous steps. It takes the starting and ending x,y coordinates of a line as input. It then calculates the change in x and y, sets the step size as the larger of the two changes, and calculates the change amounts per step. It then iterates, incrementing x and y by the per step change amounts and setting pixels, until the ending coordinate is reached.

Uploaded by

yp02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
62 views1 page

DDA Algorithm for Line Drawing

The DDA algorithm is an incremental method for scan conversion of lines. It performs calculations at each step using results from previous steps. It takes the starting and ending x,y coordinates of a line as input. It then calculates the change in x and y, sets the step size as the larger of the two changes, and calculates the change amounts per step. It then iterates, incrementing x and y by the per step change amounts and setting pixels, until the ending coordinate is reached.

Uploaded by

yp02
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DDA Algorithm:-

It stands for Digital Differential Step 9:


Analyzer. It is an incremental method x = x + Xin
of scan conversion of line. In this y = y + Yin
method calculation is performed at Set pixel [Round(x), Round(y)]
each step but by using results of
previous steps. Step 10:
Repeat step 9 until
Step-1: x=x2
Start Algorithm
Step 11:
Step-2: End algorithm
Declare x1, y1, x2, y2, dx, dy, x, y
Ex:
Step-3:
Enter value of x1, y1, x2, y2

Step-4:
dx = x2 – x1,

Step-5:
dy = y2 – y1

Step-6:
If [ABS (dx) > ABS (dy)]
Then step = abs (dx)
Else step = abs (dy)

Step-7:
Xin = dx/step & Yin = dy/step
Assign x = x1 & y = y1
Step 8:
Set pixel (x,y)

You might also like