DDA vs Bresenham Algorithm
DDA and Bresenham Algorithm are terms you would have come across when studying computer graphics. Before explaining the difference between these two term, let’s see what is DDA and what is Bresenham Algorithm. The invention of computer made things simple and one of them being solving of differential equations. Earlier it was done by mechanical differential analyzer that was slow and full of errors but DDA or Digital differential Analyzer is the application of analyzer in digital form which is accurate and fast. Differential analyzer is used to make lines between two points so that a straight line or polygon with n number of sides can be seen on the screen. Distance between two points or a pixel is described by a differential equation where coordinates of the starting point and that of ending point are specified in the software. This can be achieved by DDA and Bresenham Algorithm.
What is DDA?
DDA is used in drawing straight line to form a line, triangle or polygon in computer graphics. DDA analyzes samples along the line at regular interval of one coordinate as the integer and for the other coordinate it rounds off the integer that is nearest to the line. Therefore as the line progresses it scan the first integer coordinate and round the second to nearest integer. Therefore a line drawn using DDA for x coordinate it will be x_{0} to x_{1} but for y coordinate it will be y=ax+ b and to draw function it will be Fn(x, y rounded off).
What is Bresenham Algorithm?
Bresenham Algorithm was developed by J.E.Bresenham in 1962 and it is much accurate and much more efficient than DDA. It scans the coordinates but instead of rounding them off it takes the incremental value in account by adding or subtracting and therefore can be used for drawing circle and curves. Therefore if a line is to be drawn between two points x and y then next coordinates will be( x_{a+1}, y_{a}) and (x_{a+1}, y_{a+1}) where a is the incremental value of the next coordinates and difference between these two will be calculated by subtracting or adding the equations formed by them.
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.
