100% found this document useful (1 vote)
175 views

DDA Line Drawing Algorithm

The DDA line generating algorithm is a scan conversion algorithm that plots lines by incrementing either the x or y coordinate by 1 and calculating the corresponding coordinate using the line equation. It increments y for steep lines with slopes greater than 1, and increments x for shallow lines with slopes less than 1. The algorithm uses flooring to round coordinate values since the slope m can be a floating point value. DDA provides faster line plotting than using the y=mx+c equation or raster scanning, but rounding introduces errors that decrease accuracy.

Uploaded by

shubham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
100% found this document useful (1 vote)
175 views

DDA Line Drawing Algorithm

The DDA line generating algorithm is a scan conversion algorithm that plots lines by incrementing either the x or y coordinate by 1 and calculating the corresponding coordinate using the line equation. It increments y for steep lines with slopes greater than 1, and increments x for shallow lines with slopes less than 1. The algorithm uses flooring to round coordinate values since the slope m can be a floating point value. DDA provides faster line plotting than using the y=mx+c equation or raster scanning, but rounding introduces errors that decrease accuracy.

Uploaded by

shubham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 2

DDA LINE GENERATING ALGORITHM:

Digital Differential Analyzer is scan conversion line algorithm based on calculations on dx


or dy.
In this method for finding next coordinate,
- we increment one part i.e x or y coordinate by 1 and find its corresponding remaining
coordinate using the equation.
Now the question arises which coordinate to increment and which to derive from the
equationthis can be decided by slope of the line
1)Now if the slope is steep it will map very less points on x-axis but a lot of points on yaxis thus here we increment y(next)=y(old)+1 and x(next) is obtained form the equation
discussed ahead,
2).Similiarly for line with low slope it will map less points on y-axis but has a lot of
points on x-axis thus here we increment x(next)=x(old)+1 and y(next) is obtained form the
equation discussed ahead .

Consider a line l with positive slope,


Then there are two cases:
For m>1 (case 1)

i.e. dy>dx

x(new)=x(old)+1;
y(new)=y(old)+m;
putpixel(x(new),y(new));

for m<1(case 2)

i.e.dy<dx

y(new)=y(old)+1;
1

x(new)=x(old)+ ;
putpixel(x(new),y(new));
IN the above eqns as m can have floating values we have to round off the x(new) and y(new)
values.
Thus here we floor the values using floor() function in C/C++.

Advantages:

It provides faster method than using the y=mx+c eqn for plotting

It is faster than raster scan


Disadvantages:

The round off operations causes roundoff erros which may cause deviation from actual
line path thus hinders the accuracy.

You might also like