Digital Differential Analyzer Circle Drawing Algorithm

Line Cartoon Algorithms-

In computer graphics, pop algorithms used to generate lines are-

  1. Digital Differential Analyzer (DDA) Line Drawing Algorithm
  2. Bresenham Line Drawing Algorithm
  3. Mid Bespeak Line Drawing Algorithm

In this commodity, we volition hash out about DDA Algorithm.

DDA 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 betwixt the starting and catastrophe coordinates.

Procedure-

Given-

  • Starting coordinates = (Ten0, Y0)
  • Ending coordinates = (Xnorthward, Yn)

The points generation using DDA Algorithm involves the following steps-

Step-01:

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

These parameters are calculated equally-

  • ΔX = Xnorthward – X0
  • ΔY =Yn – Y0
  • M = ΔY / ΔX

Step-02:

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

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

Steps = accented (ΔX);

else

Steps = accented (ΔY);

Step-03:

Suppose the electric current bespeak is (10p, Yp) and the next point is (Xp+1, Yp+i).

Detect the next point past following the beneath three cases-

Stride-04:

Go on repeating Stride-03 until the terminate point is reached or the number of generated new points (including the starting and ending points) equals to the steps count.

PRACTICE Issues BASED ON DDA ALGORITHM-

Problem-01:

Calculate the points betwixt the starting point (v, six) and ending point (8, 12).

Solution-

Given-

  • Starting coordinates = (X0, Y0) = (v, six)
  • Catastrophe coordinates = (Xnorthward, Ydue north) = (eight, 12)

Pace-01:

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

  • ΔX = Xn – X0 = 8 – five = iii
  • ΔY =Ynorthward – Y0 = 12 – 6 = 6
  • M = ΔY / ΔX = six / three = 2

Step-02:

Calculate the number of steps.

As |ΔX| < |ΔY| = 3 < 6, then number of steps = ΔY = half-dozen

Stride-03:

Every bit M > 1, and so case-03 is satisfied.

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

Xp Yp Xp+1 Yp+1 Round off (Xp+one, Yp+1)
5 half-dozen 5.5 7 (half-dozen, seven)
6 8 (half-dozen, eight)
6.five 9 (7, 9)
7 10 (7, 10)
7.5 eleven (8, 11)
8 12 (viii, 12)

Problem-02:

Calculate the points between the starting point (v, six) and ending signal (thirteen, ten).

Solution-

Given-

  • Starting coordinates = (100, Y0) = (5, 6)
  • Catastrophe coordinates = (Xn, Yn) = (13, 10)

Stride-01:

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

  • ΔX = Xn – X0 = 13 – 5 = viii
  • ΔY =Yn – Y0 = 10 – 6 = four
  • 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

Footstep-03:

As M < 1, and then example-01 is satisfied.

At present, Stride-03 is executed until Step-04 is satisfied.

Xp Yp 10p+one Yp+1 Round off (Tenp+ane, Yp+ane)
5 6 half-dozen 6.5 (vi, seven)
seven 7 (seven, 7)
8 7.v (8, viii)
9 8 (nine, 8)
ten 8.5 (10, ix)
11 9 (11, nine)
12 ix.5 (12, x)
13 10 (13, x)

Problem-03:

Summate the points between the starting point (ane, 7) and ending betoken (11, 17).

Solution-

Given-

  • Starting coordinates = (100, Y0) = (1, 7)
  • Ending coordinates = (10north, Ynorth) = (11, 17)

Stride-01:

Summate ΔX, ΔY and Yard from the given input.

  • ΔX = Xnorth – X0 = xi – 1 = 10
  • ΔY =Ynorthward – Y0 = 17 – 7 = ten
  • M = ΔY / ΔX = 10 / 10 = ane

Step-02:

Calculate the number of steps.

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

Stride-03:

As M = 1, and so instance-02 is satisfied.

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

Xp Yp 10p+1 Yp+1 Round off (Xp+1, Yp+1)
i seven 2 8 (ii, eight)
3 ix (three, 9)
4 10 (4, 10)
5 11 (v, 11)
6 12 (6, 12)
vii thirteen (7, 13)
8 14 (8, 14)
9 15 (ix, 15)
10 16 (10, 16)
11 17 (xi, 17)

Advantages of DDA Algorithm-

The advantages of DDA Algorithm are-

  • It is a unproblematic algorithm.
  • It is piece of cake to implement.
  • It avoids using the multiplication performance which is costly in terms of fourth dimension complexity.

Disadvantages of DDA Algorithm-

The disadvantages of DDA Algorithm are-

  • There is an extra overhead of using round off( ) function.
  • Using round off( ) function increases fourth dimension complexity of the algorithm.
  • Resulted lines are not smooth because of round off( ) role.
  • The points generated by this algorithm are not accurate.

To gain better understanding about DDA Algorithm,

Watch this Video Lecture

Adjacent Article- Bresenham Line Drawing Algorithm

Get more notes and other report material of Computer Graphics.

Scout video lectures by visiting our YouTube channel LearnVidFun.

Summary

DDA Algorithm | Line Drawing Algorithms

Article Name

DDA Algorithm | Line Drawing Algorithms

Description

Line Drawing Algorithms- In computer graphics, DDA Line Drawing Algorithm is the simplest line drawing algorithm. DDA Line Drawing Algorithm attempts to generate the points between the starting and ending coordinates.

Author

Akshay Singhal

Publisher Proper noun

Gate Vidyalay

Publisher Logo

cobbclawaste.blogspot.com

Source: https://www.gatevidyalay.com/dda-algorithm-line-drawing-algorithms/

0 Response to "Digital Differential Analyzer Circle Drawing Algorithm"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel