0% found this document useful (0 votes)
12 views2 pages

Digital Differential Algorithm

The Digital Differential Algorithm (DDA) is an incremental method for scan converting lines by using previous step results to calculate pixel differences. It accounts for positive and negative slopes, affecting the increment of Δx and Δy values. The DDA line drawing algorithm involves reading coordinates, calculating differences, determining increments, and displaying pixel values iteratively until the endpoint is reached.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Digital Differential Algorithm

The Digital Differential Algorithm (DDA) is an incremental method for scan converting lines by using previous step results to calculate pixel differences. It accounts for positive and negative slopes, affecting the increment of Δx and Δy values. The DDA line drawing algorithm involves reading coordinates, calculating differences, determining increments, and displaying pixel values iteratively until the endpoint is reached.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Digital Differential Algorithm (DDA)

Basic Concept
• It is an incremental method of scan conversion of line.
• In this method, calculation is performed at each step using results of previous
steps.
• In DDA, we analyze difference in pixel points to generate a line.

DDA (Continuation)
Slope Properties
• Slope of a given line can be positive or negative.
• If slope is positive, then Δx and Δy values increase.
• If slope is negative, then Δx and Δy values decrease.
• Positive slope means m > 0.
• Negative slope means m ≤ 0.

DDA Line Drawing Algorithm


Step-by-Step Procedure
1. Read the input of start and end point coordinates
i.e.

𝐴(𝑥1 , 𝑦1 )&𝐵(𝑥2 , 𝑦2 )

2. Calculate differences

𝑑𝑥 = 𝑥2 − 𝑥1
𝑑𝑦 = 𝑦2 − 𝑦1

3. If dx > dy then
𝑘 = 𝑑𝑥

else

𝑘 = 𝑑𝑦

4. Calculate incremental values

𝑑𝑥 = 𝑑𝑥/𝑘
𝑑𝑦 = 𝑑𝑦/𝑘

5. Initialize

𝑋 = 𝑥1 , 𝑌 = 𝑦1

6. Display pixel (X, Y)


7. Update coordinates

𝑋 = 𝑋 + 𝑑𝑥
𝑌 = 𝑌 + 𝑑𝑦

8. Display rounded value of pixel (X, Y)


9. Repeat step 7 and 8 k times
(until end point is reached)

You might also like