# DDA Algorithm - DDA Line Drawing Algorithm

By:   Last Updated:

Computer Graphics and Multimedia Application: Q1.What is DDA? or DDA Algorithm? Q2.Advantages and Disadvantages of DDA? (Computer graphics and multimedia application All Notes)

## Q1. What do you mean by DDA in the scan-conversion line? or DDA Algorithm? DDA Line Drawing Algorithm?

Ans. DDA stands for a digital differential analyzer. DDA is a scan-conversion line algorithm based on calculating either 𐤃y or 𐤃x. We sample the line at unit intervals in one coordinate and determine corresponding integer values nearest the line path for other co-ordinates.

Consider first line with positive slope, if the slope is less than or equal to 1, we sample at unit x internal (𐤃x = 1) and compute each successive y value as :

yk+1 = yk + m

Subscript k takes integer values starting from 1, for the first point and increases by 1 unit the final endpoint is reached. Since m can be any real number between 0 and 1, the calculated y values must be rounded to the nearest integer.

For line with a positive slope greater than 1, we reverse the role of x and y .i.e.we sample at unit y interval (𐤃y = 1) and calculate each succeeding x value as :

xk+1 = xk + 1/m

Both equations is based on the assumption that lines are to be processed from the left endpoint to the right endpoint. If this processing is reversed, so that the starting endpoint is at right, then either we have 𐤃x = -1 and

yk+1 = yk - m

or, when the slope is greater than 1, we have 𐤃y = -1 with

xk+1 = xk - 1/m

This algorithm is summarised in the following procedure, which accepts as input two endpoint pixel positions. The horizontal and vertical difference between the endpoint position are assigned to parameters dx and dy.

The DDA algorithm is a faster method for calculating pixel positions. It eliminates the multiplication by making use of raster and characteristics, so that appropriate increment is applied in the x or y direction to step to pixel position along the path line.

The accumulation of roundoff error in successive additions of the floating-point increment, however, can cause the calculated pixel positions to draft way from the true line path for the long line segment.

Ans. The advantages of DDA are as follows:
(a) Faster than the direct use of the line equation.
(b) It does not do any floating point multiplication.

The disadvantages of DDA are as follows:
(a) It drift away from the actual line path because of rounding it float value integer.
(b) It causes stain-step effect.
(c) Floating point addition is still needed.
(d) Precision loss because of rounding off.
(e) Pixels drift farther apart if line is relatively larger.

[ Topic= DDA Algorithm, DDA Line Drawing Algorithm ]

(click on it or search "allbcaweb" on Facebook)
Instagram = @allbcaweb
(click on it or search "allbcaweb" on Instagram)
(click on it or search "allbcaweb" on Twitter)
Email= allbca.com@gmail.com