DDA Algorithm
DDA Algorithm
y = m.x + b
Given that the 2 endpoints of the line segment are (x1 , y1) and (x2 , y2)
Slope, m = y2 - y1
x2 - x 1
y intercept, b = y1 - m.x1
△y = m △x △x = △y
m
● These equations form the basis for determining the deflection voltages in
analog devices.
● For slope magnitudes |m|<1, △x can be set proportional to a small horizontal
deflection, corresponding vertical deflection is then set proportional to △y as
calculated above.
● For slope magnitudes |m|>1, it happens the other way round.
● For lines with m=1, △x=△y, both horizontal and vertical deflection voltages
are equal.
Digital Differential Analyzer (DDA)
LINES PROCESSED FROM LEFT TO RIGHT
△x=1
yk+1 = yk + m
△y=1
xk+1 = xk + 1/m
LINES PROCESSED FROM RIGHT TO LEFT
△x=-1
yk+1 = yk - m
△y=-1
xk+1 = xk - 1/m
LINES PROCESSED FROM LEFT TO RIGHT
△x=1
yk+1 = yk + m
△y=1
xk+1 = xk + 1/m
LINES PROCESSED FROM RIGHT TO LEFT
△x=-1
yk+1 = yk - m
△y=-1
xk+1 = xk - 1/m
Advantages
Advantages
● Faster method
● Eliminates floating point multiplication
● Simplest algorithm and does not require special skills for implementation.
Disadvantages