Thursday, May 28, 2009

DDA LINE DRAWING ALGORITHM

DDA LINE DRAWING ALGORITHM (Digital Differential Algorithm)

1. Get the co-ordinates of line segment (x1, y1) and (x2, y2)


2. dx = x2-x1


3. dy = y2-y1


4. if abs (dx) > abs (dy) |then
Step=abs(dy)
Else
Step=abs(dy)
End if
5. xin = dy / step


6. yin==dy / step


7. x = x1


8. y = y1


9. print x, y


10. for (k=1; k<=step; k++)
x = x + xin
y = y + yin
print x, y


STOP

1 comment: