0% found this document useful (0 votes)
32 views

DDA Algorithm

The document explains the Digital Differential Analyzer (DDA) algorithm for generating points on a digital line between given start and end points. It describes the key steps of calculating the change in X and Y, the slope, and number of steps, then generating each subsequent point based on the slope comparison cases until the end is reached.

Uploaded by

thoughts0976
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views

DDA Algorithm

The document explains the Digital Differential Analyzer (DDA) algorithm for generating points on a digital line between given start and end points. It describes the key steps of calculating the change in X and Y, the slope, and number of steps, then generating each subsequent point based on the slope comparison cases until the end is reached.

Uploaded by

thoughts0976
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 8

[Type text]

DDA Algorithm-
DDA Algorithm is the simplest line drawing algorithm.

Given-

Starting coordinates = (X0, Y0)

Ending coordinates = (Xn, Yn)

The points generation using DDA Algorithm involves the following steps-

Step-01:

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

These parameters are calculated as-

ΔX = Xn – X0

ΔY =Yn – Y0

M = ΔY / ΔX

Step-02:

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-03:

Suppose the current point is (Xp, Yp) and the next point is (Xp+1, Yp+1).
[Type text]

Find the next point by following the below three cases

Step-04:

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

PRACTICE PROBLEMS BASED ON DDA ALGORITHM-

Problem-01:

Calculate the points between the starting point (5, 6) and ending point (8, 12).

Solution-

Starting coordinates = (X0, Y0) = (5, 6)

Ending coordinates = (Xn, Yn) = (8, 12)

Step-01:

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


[Type text]

ΔX = Xn – X0 = 8 – 5 = 3

ΔY =Yn – Y0 = 12 – 6 = 6

M = ΔY / ΔX = 6 / 3 = 2

Step-02:

Calculate the number of steps.

As |ΔX| < |ΔY| = 3 < 6, so number of steps = ΔY = 6

Step-03:

As M > 1, so case-03 is satisfied.

Now, Step-03 is executed until Step-04 is satisfied.

Calculate the points between the starting point (5, 6) and ending point (13, 10).
[Type text]

Starting coordinates = (X0, Y0) = (5, 6)

Ending coordinates = (Xn, Yn) = (13, 10)

Step-01:

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

ΔX = Xn – X0 = 13 – 5 = 8

ΔY =Yn – Y0 = 10 – 6 = 4

M = ΔY / ΔX = 4 / 8 = 0.50

Step-02:

Calculate the number of steps.

As |ΔX| > |ΔY| = 8 > 4, so number of steps = ΔX = 8

Step-03:

As M < 1, so case-01 is satisfied.

Now, Step-03 is executed until Step-04 is satisfied.


[Type text]

Problem-03:

Calculate the points between the starting point (1, 7) and ending point (11, 17).

Solution-

Given-

Starting coordinates = (X0, Y0) = (1, 7)

Ending coordinates = (Xn, Yn) = (11, 17)

Step-01:

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

ΔX = Xn – X0 = 11 – 1 = 10

ΔY =Yn – Y0 = 17 – 7 = 10

M = ΔY / ΔX = 10 / 10 = 1

Step-02:

Calculate the number of steps.

As |ΔX| = |ΔY| = 10 = 10, so number of steps = ΔX = ΔY = 10


[Type text]

Step-03:

As M = 1, so case-02 is satisfied.

Now, Step-03 is executed until Step-04 is satisfied.


[Type text]
[Type text]

You might also like