Difference between DDA and Bresenham’s Algorithm
The Digital Differential Algorithm (DDA) and the Bresenhams’s Algorithm are the digital lines drawing algorithms and are used in computer graphics to draw pictures. Previously, we were using analytical analyzers to compute the pixels and thereby line drawings were made possible. But these analytical methods are not as accurate as the digital methods that with the usage of these digital algorithms now and as with every field, we have been inventing higher quality methods in computer graphics as well. The invention of these algorithms is a perfect example. Before we proceed, let us look at the concept behind these algorithms. Though it seems out of the scope of our discussion, it is essential to point out the basic differences between the two. If you are really familiar with the algorithms, you can jump to the actual differences located at the end of this page.
What is Digital Differential Algorithm (DDA)?
A DDA is mostly used to draw lines in computer graphics and uses real values while predicting the next pixel values. Let us assume the initial pixel value as (X0, Y0) (X0, Y0) and the destination pixel as (X1, Y1) (X1, Y1). We will learn how to calculate the destination pixel values from the known pixel value (X0, Y0) (X0, Y0) as below.
 How to compute the destination point value using DDA?
Step1: Here we have the input (X0, Y0) (X0, Y0) and we should identify whether the line runs parallel to the xaxis or the yaxis. To find that, let us now calculate the difference between the initial and the destination pixel values.
dx = X1 – X0
dy = Y1 – Y0
Step2: Now, we have identified the difference and we should draw the line along the xaxis if ‘dx’ is zero otherwise, we should draw the line parallel to the yaxis. Here is the actual computation in terms of the computer language.
if (absolute (dx) > absolute (dy))
Steps = absolute (dx);
else
Steps = absolute (dy);
Step3: Now, it’s time to identify the actual ‘x’ coordinate or the ‘y’ coordinates pixel values in order to draw the line.
X increment = dx / (float) steps;
Y increment = dy / (float) steps;
Step4: This has to be computed till we reach the destination pixel. The DDA algorithm roundsoff the pixel value to the nearest integer value while doing the computation. Here is the code sample of what we have discussed now.
For (int v=0; v < Steps; v++)
{
x = x + X increment;
y = y + Y increment;
putpixel (Round(x), Round(y));
}
We are done with drawing the line using the DDA and let us move on to the Bresenham’s now!
What is Bresenham’s Algorithm?
It is also a digital line drawing algorithm and was invented by Bresenham in the year 1962 and that is why it has got the same name. This algorithm is more accurate and it used subtraction & addition to computing the pixel value while drawing the line. The accuracy of the Bresenham’s algorithm is reliable while drawing curves & circles as well. Let us look how this algorithm work.
Step1: The Bresenham’s algorithms assume the initial pixel coordinate as (x_{a+1}, y_{a}).
Step2: It automatically computes the next pixel value as (x_{a+1}, y_{a+1}), Here ‘a’ is the incremental value and the algorithm computes it by adding or subtracting the equations that it had formed.
This algorithm calculates accurate values with no rounding off and looks easier as well!
 Numerical Example of Bresenham’s Algorithm:
Let us now consider the points (0,0) and (8, 4) and let us draw a line between these points using the Bresenham’s algorithm.
Given data, (x1, y1) = (0, 0) and (x2, y2)= (8,4).
Let us now compute the differential values as below.
∆x=x2x1=80=8
Therefore, the incremental value for x = ∆x / x2 = 8/8 = 1.
∆y=y2y1=40=4
Therefore, the incremental value for y = ∆y / y2 = 4 / 4 = 1.
Decision Variable=e=2*(∆y)(∆x)
Therefore, e= 2*(4)(8) = 88 =0
With the above computation, let us tabulate the resultant values. The values of ycoordinate are adjusted based on a decision variable and we are just ignoring its computation here.
Pixel  x  y  Decision variable 
(0,0)  0  0  0 
(1,0)  1  0  A value 
(2,1)  2  1  0 
(3,1)  3  1  A value 
(4,2)  4  2  0 
(5,2)  5  2  A value 
(6,3)  6  3  0 
(7,3)  7  3  A value 
(8,4)  8  4  0 
Differences between DDA & Bresenham’s Algorithm:
 Arithmetic Calculation:
The DDA uses real values in its computations with the usage of floating points. The next pixel or point values are determined with differential equations
X increment = dx / (float) steps
Y increment = dy / (float) steps
Here no fixed constants are used but in Bresenham’s algorithm fixed points are used in arithmetic computations. The Bresenham’s algorithm uses Integer arithmetic, unlike the DDA.
 Type of operation used:
The DDA solves the differential equations with multiplication and division operations. You could notice the same here, X increment = dx / (float) steps. The Bresenham’s algorithm uses addition and subtraction operations and you can notice the same here in its next pixel value computation equation (x_{a+1}, y_{a+1}). The arithmetic is simpler in Bresenham’s when compared to the DDA.
 Efficiency:
As we have discussed earlier, Bresenham’s algorithm uses simpler arithmetic than the DDA and it results in efficient results.
 Speed: As DDA uses floating point integers along with multiplication & division operations, it is comparatively slower whereas Bresenham’s algorithm uses just integer arithmetic along with additions & subtractions alone. This considerably reduces the time taken for its computations and hence it faster than the DDA.
 Accuracy: Though DDA uses floating point values, the accuracy of DDA is not as better as the Bresenham’s. A variety of factors affect this concept and therefore, Bresenham’s is more accurate than the DDA.
 Rounding off: Just look at the computation of the DDA here.
X increment = dx / (float) steps
You could notice the ‘float’ and therefore it does not round off the values whereas the Bresenham’s algorithm rounds off the values to the nearest integer. Therefore, the values used are simpler in Bresenham’s algorithm.
 What does it draw?
The DDA is capable of drawing circles and curves apart from drawing lines. The Bresenham’s algorithm is also capable of drawing all those mentioned above and its accuracy is really higher than that of the DDA. Similarly, the Bresenham’s algorithm could come up with efficient curves than that produced by the DDA. Both the algorithms can draw triangles and polygons as well.
 Which is expensive?
As DDA includes rounding off as well, it is expensive than the usage of Bresenham’s algorithm.
 Which is an optimized algorithm?
From our above discussion, it is very clear that the Bresenham’s algorithm is an optimized one in terms speed, cost, and usage of operations.
Let us look at the differences in a tabular form.
S.No  Differences in  Digital Differential Algorithm  Bresenham’s Algorithm 
1.  Why the name?  Just because it was the digital implementation of the equations, it has got the name.  It was invented by J.E. Bresenham in the year 1962 and hence the name. 
2.  Computations  It involves tougher computations.  The computations used are really simpler. 
3.  Types of operations used  It used multiplications and divisions. The sample differential equations used here are Xincrement = dx / (float) steps,
Yincrement = dy / (float) steps.

It uses additions and subtractions. The sample computation here can be denoted like (x_{a+1}, y_{a+1}). 
4.  Arithmetic computation values  It uses floating point values.  It uses just the integer values. 
5.  Efficiency  Complex arithmetic results in lesser efficiency.  Simpler arithmetic results in more efficiency. 
6.  Speed  Usage of multiplications and division operations takes much time for its computation processes.  Usage of addition and subtraction operations takes lesser time than the DDA. 
7.  Accuracy  It is lesser in accuracy.  It is more accurate. 
8.  Rounding off  It uses real values and never rounds off the values.  It rounds off the values to the nearest integer values. 
9.  Drawing capability  It is capable of drawing lines, circles, and curves but with lesser accuracy. We can even draw triangles and polygons with this algorithm.  It is capable of drawing lines, circles, and curves with greater efficiency. Triangles and polygons are also possible to be drawn with this algorithm. 
10.  Cost of computations  It is expensive as it involves rounding off as well.  The usage of Bresenham’s algorithm is cheaper than the DDA. 
11.  Optimized algorithm  It is not an optimized algorithm  It is an optimized algorithm. 
We have dealt with every possible difference between the DDA and the Bresenham’s algorithm. It might even seem to be repetitive but there is some valid reason for mentioning those points again and you would come to know when you understand it completely. If you still feel that there exists an ambiguity, please leave us a comment. Let us learn together by sharing the proper knowledge!
Search DifferenceBetween.net :
Email This Post : If you like this article or our site. Please spread the word. Share it with your friends/family.
Leave a Response
References :
[0]http://www.ques10.com/p/14667/writeddalinealgorithmcompareddawithbresen1/
[1]https://www.scribd.com/doc/294542555/ExampleonBresenhamslinedrawingalgorithm
[2]https://stackoverflow.com/questions/24679963/precisesubpixellinedrawingalgorithmrasterizationalgorithm
[3]https://commons.wikimedia.org/wiki/File:Bresenham_line.png