Best Answer

DDA Line Drawing Algorithm

Step 1:[Determine The Dx & Dy]

Dx=Xb-Xa

Dy=Yb-Ya

Step 2:[Determine Slope is Gentle or Sharp]

If |Dx|>|Dy| then

Gentle Slope

M=Dy/Dx

Set The Starting Point

If Dx>0 Then

C=CELING(Xb)

D=Yb+M*(C-Xb)

F=FLOOR(Xa)

R=FLOOR(D+0.5)

H=R-D+M

IF M>0 Then

Positive Gentle Slope

M1=M-1

Now Step Through The Columns

WHILE C<=F

C Programming Coding For DDA Algorithmvoid linedda(int xa,int ya,int xb,int yb) {

int dx=xb-xa,dy=yb-ya,steps,k;

float xincrement,yincrement,x=xa,y=ya;

if(abs(dx)>abs(dy)) steps=abs(dx);

else steps=abs(dy);

xincrement=dx/(float)steps;

yincrement=dy/(float)steps;

putpixel(round(x),round(y),2)

for(k=0;k

y+=yincrement;

putpixel(round(x),round(y),2);

}

}

More Informationhttp://knol.Google.com/k/thiyagaraaj-m/dda-line-algorithm/1lfp8o9xxpx13/78#

http://i.thiyagaraaj.com/articles/articles/dda-line-algorithm

Study guides

☆

Q: DDA line algorithm

Write your answer...

Submit

Still have questions?

Related questions

What is the advantage of bresenham algorithm over dda algorithm?Read more: What_is_the_advantage_of_bresenham_algorithm_over_dda_algorithm

yes

Bresenhams' algorithm is better

dda is not much efficient whereas bresnham algothm is much efficient than dda.

dda algorithm,bresenham's algorithm,midpoint algorithm..These are the few that are useful in my opinion.

Difference Between DDA and Bresenham Algorithm• DDA uses floating points where as Bresenham algorithm use fixed points.• DDA round off the coordinates to nearest integer but Bresenham algorithm does not.• Bresenham algorithm is much accurate and efficient than DDA.• Bresenham algorithm can draw circles and curves with much more accuracy than DDA.• DDA uses multiplication and division of equation but Bresenham algorithm uses subtraction and addition only.

"Simple DDA" does not require special skills for implementation.

automobile programming language implementation by algorithm

DDA is one of the algorithms used to draw lines via linear interpolation of variables in computer graphics. DDA stands for Digital Differential Analyzer.

Advantages of DDA Algorithm:1. It is the simplest algorithm and it does not require special skills for implementation.2. It is a faster method for calculating pixel positions than the direct use of equation y=mx + b. It eliminates the multiplication in the equation by making use of raster characteristics, so that appropriate increments are applied in the x or y direction to find the pixel positions along the line path.

First off, DDA uses float numbers and operators. While Bresenham's line drawing algorithm uses ints and only additions and subtraction.

DDA uses float numbers and uses operators such as division and multiplication in its calculation. Bresenhams algorithm uses ints and only uses addition and subtraction. Due to the use of only addition subtraction and bit shifting (multiplication and division use more resources and processor power) bresenhams algorithm is faster than DDA in producing the line. Im not sure, though if i remember right, they still produce the same line in the end. One note concerning efficiency: Fixed point DDA algorithms are generally superior to Bresenhams algorithm on modern computers. The reason is that Bresenhams algorithm uses a conditional branch in the loop, and this results in frequent branch mispredictions in the CPU. Fixed point DDA also has fewer instructions in the loop body (one bit shift, one increment and one addition to be exact. In addition to the loop instructions and the actual plotting). As CPU pipelines become deeper, mispredictions penalties will become more Severe.

People also asked