1.It drift away from the actual line path because of rounding off float values to integer
2.It causes jaggies or stair-step effect
----------------------------------------------------------------------------------------------------------------
Disadvantage:The accumulation of round of error is successive addition of the floating point increments is used to find the pixel position but it take lot of time to compute the pixel position.----------------------------------------------------------------------------------------------------------------
More Informationhttp://knol.Google.com/k/thiyagaraaj-m/dda-line-algorithm/1lfp8o9xxpx13/78#http://i.thiyagaraaj.com/articles/articles/dda-line-algorithm
----------------------------------------------------------------------------------------------------------------
the standard version of dda given as in one of its steps as
if(abs(dx)>abs(dy)) steps=abs(dx);
else steps=abs(dy);
this part just supports the positive slop with starting point on left side. Take an example of any other end points as {(8,3) to (2,2) or (4,5) to ( 8,2) or (8,3) to (5,5) } where the slop needs to be negative( for the last two cases) only.
can anyone correct me by suggesting the accurate version of DDA? Or is this the actual DDA??.
1. Division logic is needed which switches it towards hardware logic.
2. Floor integer values are used in place of normal integer values which may different result.
3. Floating point arithmetic is needed thus it is line consuming
yes
What is the advantage of bresenham algorithm over dda algorithm?Read more: What_is_the_advantage_of_bresenham_algorithm_over_dda_algorithm
"Simple DDA" does not require special skills for implementation.
These two algorithms are almost completely different. The only real similarity is that they are each designed to use only integer addition/subtraction and multiplication, avoiding expensive division and floating point operations.
DDA uses float numbers and uses operators such as division and multiplication in its calculation. Bresgenham's 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. Since DDA uses rounding off of the pixel position obtained by multiplication or division, causes an accumulation of error in the proceeding pixels whereas in Bresenhams line algorithm the new pixel is calculated with a small unit change in one direction and checking of nearest pixel with the decision variable satisfying the line equation.
DDA Line Drawing AlgorithmStep 1:[Determine The Dx & Dy]Dx=Xb-XaDy=Yb-YaStep 2:[Determine Slope is Gentle or Sharp]If |Dx|>|Dy| thenGentle SlopeM=Dy/DxSet The Starting PointIf Dx>0 ThenC=CELING(Xb)D=Yb+M*(C-Xb)F=FLOOR(Xa)R=FLOOR(D+0.5)H=R-D+MIF M>0 ThenPositive Gentle SlopeM1=M-1Now Step Through The ColumnsWHILE Cabs(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
What is the advantage of bresenham algorithm over dda algorithm?Read more: What_is_the_advantage_of_bresenham_algorithm_over_dda_algorithm
Bresenhams' algorithm is better
DDA algorithm involves floating-point operations, while Bresenham algorithm uses only integer operations. DDA algorithm calculates the exact position of each pixel, while Bresenham algorithm determines the closest pixel to the ideal line path. DDA algorithm can suffer from precision issues due to floating-point calculations, while Bresenham algorithm is more accurate and efficient. DDA algorithm is simpler to implement but slower than Bresenham algorithm. DDA algorithm is susceptible to rounding errors, while Bresenham algorithm is not. DDA algorithm can produce jagged lines due to rounding errors, while Bresenham algorithm generates smoother lines. DDA algorithm is suitable for both lines and circles, while Bresenham algorithm is primarily used for drawing lines. DDA algorithm can handle lines with any slope, while Bresenham algorithm is more efficient for lines with slopes close to 0 or 1. DDA algorithm involves multiplication and division operations, while Bresenham algorithm uses addition and subtraction operations. DDA algorithm is a general line drawing algorithm, while Bresenham algorithm is specialized for line drawing and rasterization.
"Simple DDA" does not require special skills for implementation.
These two algorithms are almost completely different. The only real similarity is that they are each designed to use only integer addition/subtraction and multiplication, avoiding expensive division and floating point operations.
DDA uses float numbers and uses operators such as division and multiplication in its calculation. Bresgenham's 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. Since DDA uses rounding off of the pixel position obtained by multiplication or division, causes an accumulation of error in the proceeding pixels whereas in Bresenhams line algorithm the new pixel is calculated with a small unit change in one direction and checking of nearest pixel with the decision variable satisfying the line equation.
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
The Digital Differential Analyzer (DDA) algorithm calculates the pixels along a line by dividing the distance between the two endpoints, while Bresenham's algorithm uses integer arithmetic to plot the pixels more efficiently. The DDA algorithm can be slower due to floating-point calculations, while Bresenham's algorithm is typically faster and more accurate for drawing lines on a raster display.
dda's
DDA Line Drawing AlgorithmStep 1:[Determine The Dx & Dy]Dx=Xb-XaDy=Yb-YaStep 2:[Determine Slope is Gentle or Sharp]If |Dx|>|Dy| thenGentle SlopeM=Dy/DxSet The Starting PointIf Dx>0 ThenC=CELING(Xb)D=Yb+M*(C-Xb)F=FLOOR(Xa)R=FLOOR(D+0.5)H=R-D+MIF M>0 ThenPositive Gentle SlopeM1=M-1Now Step Through The ColumnsWHILE Cabs(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
DDA stands for Digital Differential Analyzer. With that in mind, simple DDA just means that it is simplified.
were is the dda number on a check