Describe the Steps in Dda Algorithm for Circle Drawing
Line Drawing Algorithms-
In computer graphics, popular algorithms used to generate lines are-
- Digital Differential Analyzer (DDA) Line Cartoon Algorithm
- Bresenham Line Cartoon Algorithm
- Mid Point Line Drawing Algorithm
In this article, we will discuss about DDA Algorithm.
DDA Algorithm-
DDA Algorithm is the simplest line drawing algorithm.
DDA Algorithm attempts to generate the points betwixt the starting and ending coordinates.
Procedure-
Given-
- Starting coordinates = (X0, Y0)
- Catastrophe coordinates = (Xdue north, Yn)
The points generation using DDA Algorithm involves the post-obit steps-
Pace-01:
Calculate ΔX, ΔY and M from the given input.
These parameters are calculated as-
- ΔX = Xn – 100
- ΔY =Yn – Y0
- M = ΔY / ΔX
Step-02:
Observe the number of steps or points in between the starting and ending coordinates.
if (absolute (ΔX) > absolute (ΔY))
Steps = accented (ΔX);
else
Steps = absolute (ΔY);
Step-03:
Suppose the current point is (Xp, Yp) and the next betoken is (Tenp+1, Yp+1).
Find the next indicate by post-obit the beneath 3 cases-
Step-04:
Keep repeating Step-03 until the cease indicate is reached or the number of generated new points (including the starting and catastrophe points) equals to the steps count.
PRACTICE PROBLEMS BASED ON DDA ALGORITHM-
Trouble-01:
Calculate the points between the starting point (5, vi) and ending point (8, 12).
Solution-
Given-
- Starting coordinates = (X0, Y0) = (5, half-dozen)
- Ending coordinates = (Tenn, Ynorth) = (8, 12)
Step-01:
Summate ΔX, ΔY and M from the given input.
- ΔX = Xnorthward – X0 = 8 – 5 = 3
- ΔY =Ydue north – Y0 = 12 – 6 = 6
- M = ΔY / ΔX = 6 / iii = 2
Step-02:
Calculate the number of steps.
Every bit |ΔX| < |ΔY| = iii < half dozen, then number of steps = ΔY = 6
Step-03:
Equally M > i, so case-03 is satisfied.
Now, Footstep-03 is executed until Step-04 is satisfied.
| Xp | Yp | Tenp+one | Yp+one | Circular off (Xp+1, Yp+1) |
| 5 | 6 | 5.5 | seven | (vi, 7) |
| 6 | 8 | (6, 8) | ||
| 6.5 | 9 | (7, 9) | ||
| 7 | 10 | (7, 10) | ||
| 7.5 | xi | (8, 11) | ||
| 8 | 12 | (eight, 12) |
Trouble-02:
Calculate the points between the starting point (5, vi) and ending signal (13, x).
Solution-
Given-
- Starting coordinates = (100, Y0) = (5, 6)
- Ending coordinates = (Xnorthward, Yn) = (13, x)
Pace-01:
Calculate ΔX, ΔY and M from the given input.
- ΔX = Tenn – X0 = 13 – five = eight
- ΔY =Yn – Y0 = 10 – 6 = iv
- Yard = ΔY / ΔX = iv / 8 = 0.50
Footstep-02:
Calculate the number of steps.
As |ΔX| > |ΔY| = viii > 4, so number of steps = ΔX = 8
Step-03:
Every bit One thousand < 1, so example-01 is satisfied.
Now, Stride-03 is executed until Step-04 is satisfied.
| Tenp | Yp | Xp+one | Yp+i | Round off (Xp+ane, Yp+1) |
| v | 6 | 6 | 6.5 | (6, 7) |
| seven | seven | (7, 7) | ||
| 8 | 7.5 | (eight, 8) | ||
| 9 | 8 | (9, 8) | ||
| ten | 8.5 | (x, 9) | ||
| eleven | 9 | (eleven, 9) | ||
| 12 | ix.5 | (12, 10) | ||
| thirteen | x | (13, 10) |
Problem-03:
Calculate the points between the starting point (1, 7) and ending point (11, 17).
Solution-
Given-
- Starting coordinates = (Ten0, Y0) = (ane, 7)
- Catastrophe coordinates = (Tennorth, Yn) = (11, 17)
Stride-01:
Calculate ΔX, ΔY and Chiliad from the given input.
- ΔX = Tenn – 100 = 11 – i = 10
- ΔY =Ydue north – Y0 = 17 – vii = 10
- M = ΔY / ΔX = 10 / 10 = ane
Step-02:
Calculate the number of steps.
Every bit |ΔX| = |ΔY| = ten = 10, so number of steps = ΔX = ΔY = 10
Step-03:
As M = 1, so case-02 is satisfied.
Now, Stride-03 is executed until Footstep-04 is satisfied.
| Xp | Yp | Xp+1 | Yp+1 | Round off (10p+1, Yp+1) |
| 1 | 7 | 2 | eight | (2, 8) |
| 3 | ix | (iii, nine) | ||
| 4 | x | (iv, 10) | ||
| v | 11 | (5, 11) | ||
| vi | 12 | (6, 12) | ||
| seven | 13 | (vii, 13) | ||
| eight | fourteen | (8, 14) | ||
| 9 | 15 | (9, 15) | ||
| ten | xvi | (10, sixteen) | ||
| 11 | 17 | (11, 17) |
Advantages of DDA Algorithm-
The advantages of DDA Algorithm are-
- It is a simple algorithm.
- Information technology is like shooting fish in a barrel to implement.
- It avoids using the multiplication operation which is costly in terms of time complexity.
Disadvantages of DDA Algorithm-
The disadvantages of DDA Algorithm are-
- At that place is an extra overhead of using circular off( ) function.
- Using round off( ) function increases time complexity of the algorithm.
- Resulted lines are not shine because of round off( ) function.
- The points generated by this algorithm are non accurate.
To gain better agreement most DDA Algorithm,
Lookout man this Video Lecture
Next Article- Bresenham Line Drawing Algorithm
Go more than notes and other study cloth of Computer Graphics.
Lookout video lectures by visiting our YouTube aqueduct LearnVidFun.
Summary
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 betwixt the starting and ending coordinates.
Author
Akshay Singhal
Publisher Name
Gate Vidyalay
Publisher Logo
bardenalievespecon67.blogspot.com
Source: https://www.gatevidyalay.com/dda-algorithm-line-drawing-algorithms/
0 Response to "Describe the Steps in Dda Algorithm for Circle Drawing"
ارسال یک نظر