While drawing a line on computers they need to perform a set of computation, and it is not that simple as humans can do it in a simple way. So, in computer graphics, there are two algorithms used for drawing a line over the screen that is DDA Digital Differential Analyser algorithm and Bresenham algorithm. The chief difference between them is that the DDA algorithm uses floating point values while Bresenham employs integer with round off functions. Furthermore, the implementation of the DDA algorithm involves multiplication and division while in bresenham algorithm, addition and subtraction are the main operations performed over the integers.
|Published (Last):||13 February 2009|
|PDF File Size:||13.84 Mb|
|ePub File Size:||10.13 Mb|
|Price:||Free* [*Free Regsitration Required]|
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. A DDA is mostly used to draw lines in computer graphics and uses real values while predicting the next pixel values. We will learn how to calculate the destination pixel values from the known pixel value X0, Y0 X0, Y0 as below.
Step Here we have the input X0, Y0 X0, Y0 and we should identify whether the line runs parallel to the x-axis or the y-axis. To find that, let us now calculate the difference between the initial and the destination pixel values. Here is the actual computation in terms of the computer language.
Step This has to be computed till we reach the destination pixel. The DDA algorithm rounds-off the pixel value to the nearest integer value while doing the computation. Here is the code sample of what we have discussed now.
It is also a digital line drawing algorithm and was invented by Bresenham in the year and that is why it has got the same name. Let us look how this algorithm work. With the above computation, let us tabulate the resultant values. The values of y-coordinate are adjusted based on a decision variable and we are just ignoring its computation here. 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. The DDA solves the differential equations with multiplication and division operations. The DDA is capable of drawing circles and curves apart from drawing lines.
Both the algorithms can draw triangles and polygons as well. It uses additions and subtractions. Arithmetic computation values It uses floating point values.
It uses just the integer values. Efficiency Complex arithmetic results in lesser efficiency. Simpler arithmetic results in more efficiency. 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. Accuracy It is lesser in accuracy. It is more accurate. Rounding off It uses real values and never rounds off the values.
It rounds off the values to the nearest integer values. 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. Cost of computations It is expensive as it involves rounding off as well.
Optimized algorithm It is not an optimized algorithm It is an optimized 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!
Cite Ramalan Harifa. July 13, Name required. Email required. Please note: comment moderation is enabled and may delay your comment. There is no need to resubmit your comment. Notify me of followup comments via e-mail. Written by : Ramalan Harifa. User assumes all risk of use, damage, or injury. You agree that we have no liability for any damages.
How to compute the destination point value using DDA? This algorithm calculates accurate values with no rounding off and looks easier as well! Let us now compute the differential values as below.
Type of operation used: The DDA solves the differential equations with multiplication and division operations. This considerably reduces the time taken for its computations and hence it faster than the DDA. Rounding off: Just look at the computation of the DDA here. What does it draw? Which is expensive?
Which is an optimized algorithm? Let us look at the differences in a tabular form. Why the name? Just because it was the digital implementation of the equations, it has got the name. It was invented by J. Bresenham in the year and hence the name.
Computations It involves tougher computations. The computations used are really simpler. Types of operations used It used multiplications and divisions. Author Recent Posts. Ramalan Harifa. Latest posts by Ramalan Harifa see all. Help us improve.
Rate this post! Difference Between Coarse and Fine Adjustment. Cancel Reply. Get New Comparisons in your inbox:. Follow Us. It used multiplications and divisions. Usage of multiplications and division operations takes much time for its computation processes. It is capable of drawing lines, circles, and curves but with lesser accuracy.
Line Generation Algorithm
Bresenhams algorithm is less expensive than DDA algorithm as it uses only addition and subtraction. You are commenting using your WordPress. You are commenting using your Google account. You are commenting using your Twitter account.
Difference between DDA and Bresenham’s Algorithm
A line connects two points. It is a basic element in graphics. To draw a line, you need two points between which you can draw a line. Digital Differential Analyzer DDA algorithm is the simple line generation algorithm which is explained step by step here. The Bresenham algorithm is another incremental scan conversion algorithm. The big advantage of this algorithm is that, it uses only integer calculations.
Difference Between DDA and Bresenham line drawing algorithm
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.
Difference Between DDA and Bresenham Algorithm