Digital Differential Analyzer (DDA) is a scan conversion line algorithm where a line is to be plotted on any graphical devices based on its two end points. The equation of line is: y = mx + c (Eq.1) where m = dx/dy. Different types of the line are already discussed (Click Here to view). Here we discuss how to plot a line on a Raster Device following the DDA Algorithm.

**Case-I: Line Type-IV**

Let us consider (X_{K}, Y_{K}) as the initial point and the next point is to be calculated in the Type-IV line. Two candidate points are there: (X_{K+1}, Y_{K}) and (X_{K+1}, Y_{K}+1). So the goal is to achieve whether the value of Y_{K+1} = Y_{K} or Y_{K}+1.

For the initial point and next probable point we can rewrite the Eq.1 as follows:

Y_{K} = m X_{K} + c ... (Eq.2)

Y_{K+1} = m X_{K+1} + c ... (Eq.3)

For Line Type-IV we know,

X_{K+1} = X_{K} + 1 ... (Eq.4)

Putting the value of Eq.4 in Eq.3 we get,

Y_{K+1}

= m (X_{K} + 1) + c

= mX_{K} + m + c

= m x {(Y_{K} - c)/m} + m + c (Put the value of X_{K} from Eq.2)

= Y_{K} – c + m + c

= Y_{K} + m

So, Y_{K} + 1 = Y_{K} + m ... (Eq.5)

**Case-2: Line Type-V**

Let us consider (X_{K}, Y_{K}) as the initial point and the next point is to be calculated in the Type-V line. Two candidate points are there: (X_{K}, Y_{K}+1) and (X_{K}+1, Y_{K}+1). So the goal is to achieve whether the value of X_{K+1} = X_{K} or X_{K}+1.

For the initial point and next probable point we can rewrite the Eq.1 as follows:

Y_{K} = m X_{K} + c ... (Eq.2)

Y_{K+1} = m X_{K+1} + c ... (Eq.3)

For Line Type-V we know,

Y_{K+1} = Y_{K} + 1 ... (Eq.6)

Putting the value of Eq.6 in Eq.3 we get,

Y_{K}+1 = m X_{K+1} + c

m X_{K+1 = }Y_{K}+1- c

m X_{K+1 = }m X_{K} + c + 1 – c (Put the value of Y_{K} from Eq.2)

m X_{K+1 = }m X_{K} + 1

So we can say that,

X_{K+1 } = X_{K} + 1/m ... (Eq.7)

**Case-III: Line Type-VI**

Let us consider (X_{K}, Y_{K}) as the initial point and the next point is to be calculated in the Type-IV line. Two candidate points are there: (X_{K+1}, Y_{K}) and (X_{K+1}, Y_{K}-1). So the goal is to achieve whether the value of Y_{K+1} = Y_{K }or Y_{K}-1.

For the initial point and next probable point we can rewrite the Eq.1 as follows:

Y_{K} = m X_{K} + c ... (Eq.2)

Y_{K+1} = m X_{K+1} + c ... (Eq.3)

For Line Type-VI we know,

X_{K+1 }= X_{K }+ 1 ... (Eq.8)

Putting the value of Eq.8 in Eq.3 we get,

Y_{K}+1

= m (X_{K} + 1) + c

= mX_{K }+ m + c

= m x {(Y_{K} - c)/m} + m + c (Put the value of X_{K} from Eq.2)

= Y_{K} – c + m + c

= Y_{K} + m

So, Y_{K}+1 = Y_{K} + m ... (Eq.9)

There is no structural difference between Eq.9 with Eq.5 except the value of m is negative in the Eq.9. So similarly if we generate Eq.10 for Line Type-VII, then also we will get the similar line as Eq.7.

**Algorithm: DDA**

**Input: ** x1, y1, x2, y2

**Output: **Plot the line

**Variable Used: **m, x, y

**Steps:**

1. m=( y2-y1 )/(x2-x1);

2. plot(x1,y1);

3. if(mod(m)>1)

a. y=y1;

b. for(x=x1+1; x<=x2; x++)

i. y=y+m;

ii. plot(x,y)

4. else if(mod(m)<1)

a. x=x1;

b. for(y=y1; y<=y1; y++)

i. x=x+1/m;

ii. plot(x,y);

**Follow us on ***Facebook_Page***, ***Youtube_Channel*** and Join us on ***Facebook_Group*

She is a co-founder of "Day On My Plate". Furthermore she is an academician in Dept. of Computer Science & Engineering. She likes to voyage all over the world in search of unrevealed experiences. She is passionate in reading novels and writing articles. Hope you all are enjoying her articles.

To study the PN junction diode characteristics under Forward bias conditions
To study the input and output characteristics of a BJT in Common Emitter configuration
Tutorial on Study Input Characteristics of Bipolar Transistor in CE mode
The Study of Optical Fibre and Digital Communication Trainer(OFT) and setting up a fibre optic analog link