DDA Line Drawing Algorithm Solved Example

 

Digital Differential Analyzer (DDA) Line Drawing Algorithm Solved Example

There are three popular line drawing algorithms in computer graphics.

1. DDA Line Drawing Algorithm

2. Bresenham Line Drawing Algorithm

3. Mid Point Line Drawing Algorithm

In this tutorial we will disscuss the DDA line algorithm and solve few numarical examples using DDA algorithm.

DDA Algorithm

Digital Differential Analyzer (DDA) Algorithm is the simplest line drawing algorithm.

Given –

Starting coordinates = (X0, Y0)

Ending coordinates = (Xn, Yn)

A four-step approach is followed to generate the line.

Step 1:

Calculate parameters ΔX, ΔY and M from the given input.

These parameters are calculated as –

ΔX = Xn – X0

ΔY =Yn – Y0

M = ΔY / ΔX

Step 2:

Find the number of steps or points in between the starting and ending coordinates.

 if (absolute (ΔX) > absolute (ΔY))

  Steps = absolute (ΔX);

else

  Steps = absolute (ΔY);

Step 3:

Suppose the current point is (Xp, Yp) and the next point is (Xp+1, Yp+1).

Find the next point by following the below three cases –

Case 1: if (M<1)

Xp+1= Round off (1 + Xp)

Yp+1= Round off (M + Yp)

Case 2: if (M=1)

Xp+1= Round off (1 + Xp)

Yp+1= Round off (1 + Yp)

Case 3: if (M<1)

Xp+1= Round off (1/M + Xp)

Yp+1= Round off (1 + Yp)

Step 4:

Keep repeating Step-03 until the endpoint is reached or the number of generated new points (including the starting and ending points) equals the steps count.

Video Tutorial DDA Algorithm:

1. Solved Example DDA Algorithm

2. Solved Example DDA Algorithm

3. Solved Example DDA Algorithm

Video Tutorial Bresenham Line Drawing algorithm Algorithm:

1. Solved Example Bresenham Line drawing Algorithm

Video Tutorial MidPoint Line Drawing algorithm Algorithm:

1. Solved Example MidPointLine drawing Algorithm

DDA Line Drawing Algorithm Solved Example: If you like the material share it with your friends. Like the Facebook page for regular updates and YouTube channel for video tutorials.

Leave a Comment

Your email address will not be published. Required fields are marked *

Welcome to VTUPulse.com


Computer Graphics and Image Processing Mini Projects -> Click Here

Download Final Year Project -> Click Here

This will close in 12 seconds