WELCOM
E
Presentation Topic:
DDA (Digital Differential Analyzer )
Line Drawing Algorithm
Table of Content
 Introduction
 Understanding The Algorithm
 Procedure
 Practice Problems Based On DDA Algorithm
 Advantages
 Limitations
 Conclusion
Introduction
 The line (vector) generation algorithms which determine the
pixels that should be turned ON are called as digital
differential analyzer (DDA).
 It is a simple and efficient algorithm used to draw lines on a
computer screen.
 It is one of the technique for obtaining a rasterized straight
line.
 This algorithm can be used to draw the line in all the
quadrants.
4
Understanding The Algorithm
 DDA Algorithm is the simplest line drawing algorithm.
 Given the starting and ending coordinates of a line, DDA
Algorithm attempts to generate the points between the
starting and ending coordinates.
5
Procedure
Given-
 Starting coordinates = (X0, Y0)
 Ending coordinates = (Xn, Yn)
6
Procedure (Cont.)
• 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
7
Procedure (Cont.)
• 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);
8
Procedure (Cont.)
• Step-03:
• 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-
9
Procedure (Cont.)
• 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.
10
Practice Problems Based On DDA Algorithm
• Problem-01:
• Calculate the points between the starting point (5, 6) and
ending point (8, 12).
• Solution-
• Given-
 Starting coordinates = (X0, Y0) = (5, 6)
 Ending coordinates = (Xn, Yn) = (8, 12)
11
Practice Problems Based On DDA Algorithm
(cont.)
• Step-01:
• Calculate ΔX, ΔY and M from the given input.
• Δ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
12
• Step-03:
• As M > 1, so case-
03 is satisfied.
• Now, Step-03 is
executed until Step-
04 is satisfied.
Xp Yp Xp+1 Yp+1
Round off
(Xp+1, Yp+1)
5 6 5.5 7 (6, 7)
6 8 (6, 8)
6.5 9 (7, 9)
7 10 (7, 10)
7.5 11 (8, 11)
8 12 (8, 12)
13
Practice Problems Based On DDA Algorithm
(cont.)
14
Practice Problems Based On DDA Algorithm
(cont.)
Advantages
The DDA algorithm is straight-forward to implement.
It only requires basic arithmetic operations like addition
and division.
It can be used to draw lines in both positive and
negative slopes.
DDA draws the line faster than drawing the line by
directly using the line equation.
15
Limitations
 There is an extra overhead of using round off( ) function.
 Using round off( ) function increases time complexity of the
algorithm.
 Resulted lines are not smooth because of round off( )
function.
 The points generated by this algorithm are not accurate.
16
Conclusion
 The DDA line drawing algorithm is a simple and widely
used method to draw lines on raster displays.
 While it has its limitations, it remains a valuable tool for
many applications.
17
Thank You
18

DDA (Digital Differential Analyzer ) Line Drawing Algorithm.pptx

  • 1.
  • 2.
    Presentation Topic: DDA (DigitalDifferential Analyzer ) Line Drawing Algorithm
  • 3.
    Table of Content Introduction  Understanding The Algorithm  Procedure  Practice Problems Based On DDA Algorithm  Advantages  Limitations  Conclusion
  • 4.
    Introduction  The line(vector) generation algorithms which determine the pixels that should be turned ON are called as digital differential analyzer (DDA).  It is a simple and efficient algorithm used to draw lines on a computer screen.  It is one of the technique for obtaining a rasterized straight line.  This algorithm can be used to draw the line in all the quadrants. 4
  • 5.
    Understanding The Algorithm DDA Algorithm is the simplest line drawing algorithm.  Given the starting and ending coordinates of a line, DDA Algorithm attempts to generate the points between the starting and ending coordinates. 5
  • 6.
    Procedure Given-  Starting coordinates= (X0, Y0)  Ending coordinates = (Xn, Yn) 6
  • 7.
    Procedure (Cont.) • 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 7
  • 8.
    Procedure (Cont.) • 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); 8
  • 9.
    Procedure (Cont.) • Step-03: •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- 9
  • 10.
    Procedure (Cont.) • 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. 10
  • 11.
    Practice Problems BasedOn DDA Algorithm • Problem-01: • Calculate the points between the starting point (5, 6) and ending point (8, 12). • Solution- • Given-  Starting coordinates = (X0, Y0) = (5, 6)  Ending coordinates = (Xn, Yn) = (8, 12) 11
  • 12.
    Practice Problems BasedOn DDA Algorithm (cont.) • Step-01: • Calculate ΔX, ΔY and M from the given input. • Δ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 12
  • 13.
    • Step-03: • AsM > 1, so case- 03 is satisfied. • Now, Step-03 is executed until Step- 04 is satisfied. Xp Yp Xp+1 Yp+1 Round off (Xp+1, Yp+1) 5 6 5.5 7 (6, 7) 6 8 (6, 8) 6.5 9 (7, 9) 7 10 (7, 10) 7.5 11 (8, 11) 8 12 (8, 12) 13 Practice Problems Based On DDA Algorithm (cont.)
  • 14.
    14 Practice Problems BasedOn DDA Algorithm (cont.)
  • 15.
    Advantages The DDA algorithmis straight-forward to implement. It only requires basic arithmetic operations like addition and division. It can be used to draw lines in both positive and negative slopes. DDA draws the line faster than drawing the line by directly using the line equation. 15
  • 16.
    Limitations  There isan extra overhead of using round off( ) function.  Using round off( ) function increases time complexity of the algorithm.  Resulted lines are not smooth because of round off( ) function.  The points generated by this algorithm are not accurate. 16
  • 17.
    Conclusion  The DDAline drawing algorithm is a simple and widely used method to draw lines on raster displays.  While it has its limitations, it remains a valuable tool for many applications. 17
  • 18.