SUBJECT : COMPUTER GRAPHICS
 In Computer Graphics the first basic line drawing
algorithm is Digital Differential Analyzer (DDA)
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.
 In computer graphics, a digital differential analyzer
(DDA) is hardware or software used for
interpolation of variables over an interval between
start and end point. DDAs are used for rasterization
of lines, triangles and polygons. They can be
extended to non linear functions, such as
perspective correct texture mapping, quadratic
curves, and traversing voxels.
DIGITAL DIFFERENTIAL ANALYZER (DDA)
ALGORITHM.
COMPUTER HAS TO TAKE CARE OF 2 THINGS:
 Pixels
- Which pixels to plot.
 Computations
- Computations required to calculate pixel positions
SLOPE INTERCEPT LINE EQ:
 y = mx + b
 m = slope
 b = is the y intercept, is called as “slope intercept line
equation.”
 Therefore
 Slope(m) = dy/dx
 Slope(m) = y2 - y1 / x2 - x1
 b= y1 – m.x1 (y intercept)
(DDA) ALGORITHM
 Walk through the line, starting at (x0,y0)
 Constrain x, y increments to values in [0,1] range
 Case a: x is incrementing faster (m < 1)
 Step in x=1 increments, compute and round y
 Case b: y is incrementing faster (m > 1)
 Step in y=1 increments, compute and round x
DDA LINE DRAWING ALGORITHM (CASE A: M
< 1)
 x = x0 y = y0
 (x, round(y)
 Here y = y0+m.x
 x=1
 Similarly
 x=x0+1 y=y0+m
 m<1 = x↑↑ more than y or dy/dx<1
 Until x == x1
DDA LINE DRAWING ALGORITHM (CASE B: M
> 1)
 m>1 = this implies y↑↑ more than x or dy/dx >1
 x k+1=x k+1/m y k+1= y k+1
 x = x0 y = y0
 Plot (round(x), y)
x = x+1/m y= y+ 1
 … Until y == y1
ADVANTAGES
 1. It is the simplest algorithm and it does not require
special skills for implementation.
 2. It is a faster method for calculating pixel positions
than the direct use of equation y=mx + b. It
eliminates the multiplication in the equation by
making use of raster characteristics, so that
appropriate increments are applied in the x or y
direction to find the pixel positions along the line
path.
DISVANTANGES
 1. Floating point arithmetic in DDA algorithm is still
time-consuming.
 2. The algorithm is orientation dependent. Hence
end point accuracy is poor.
Dda algorithm