Mod 2 Dda Line Drawing Algorithm
Mod 2 Dda Line Drawing Algorithm
Rasterization-Process of
determining which pixels give the
best approximation to a desired line
on the screen.
Scan Conversion-Digitizing a
picture definition given in an
application program into a set of
pixel intensity values for storage in
the frame buffer.
Scan Line
number
4
3
2
1
0
0
Pixel Column
number
y2
y1
x1
x2
P2
x> y
P1
Yk+1= Yk + m
y=m x
Yk+1- Yk =m x
Yk+1- Yk =m (x =1)
yk+1 = yk m
xk+1= xk-1/m
Slope >1
Slope <1
Steps
P1 ( xa,ya) and P2 (xb,yb) are the two end points.
2. Horizontal and vertical differences between the
endpoint positions are computed & assigned to
two parameters namely dx and dy.
3. The difference with greater magnitude
determines the value of increments to be done.
That means the number of times sampling has to
be done. This value is assigned to a parameter
called steps.
P1
(xa,ya)
P2
(xb,yb)
P2 (xb, yb)
dy = yb - ya
Advantages
DDA algorithm is a faster method for
calculating the pixel positions than the direct
use of line equation.
It eliminates multiplication by making use of
raster characteristics.
Disadvantages
DDA algorithm runs slowly because it
requires real arithmetic (floating point
operations) and rounding operations.