DDA Algorithm in Computer Graphics

1. Read the line endpoints (x1, y1) and (x2, y2)
2. Δx=| x2 – x1 |
Δy=| y2 – y1 |
3. if(Δx≥ Δy) then
length=Δx
else
length=Δy
4. Select the raster unit,
Δx= (x2 – x1)/length
Δy= (y2 – y1)/length
5. x= x+0.5*sign(Δx)
y= y+0.5*sign(Δy)
Sign function algorithm work in all quotient. It returns (-1,0) depending on whether it agreement is
< 0, =0, > 0 respectively.
6. Now plot the points i=1,
while(i≤ length)
{
Plot(integer(x), integer(y))
x=x+Δx
y=y+Δy
i=i+1
}
7. STOP

Recommended Posts:

Computer Graphics
    1. Display Devices in Graphics
    2. Raster Scan Display
    3. Random Scan Display
    4. Input Devices
    5. Output Devices
    6. Types of Printer
    7. Pixel and Resolution in Graphics
    8. Aspect Ratio
    9. Refresh Rate and Interlacing
    10. Digital Differential Analyzer (DDA) Algorithm
    11. Bresenham’s Line Algorithm
    12. Bresenham’s Circle Drawing Algorithm
    13. Difference Between DDA and Bresenham’s Line Algorithm
    14. MidPoint Circle Drawing Algorithm
    15. Anti-Aliasing in Graphics