These examples show how the TLinearDDA functions are used to obtain the pixels which most closely correspond to a line's specified start and end points.
Line A has a start point (3,10) and end point (22,6). The x-delta is therefore 22-3+1=20. The y-delta is 10-6+1=5. 5 goes into 20 exactly four times, so each step of the pixel line has four pixels in it.

SingleStep() begins with aPosition set to
the start pixel aStart. The move is in the direction from
aStart to aFinish. Thus for line A the values given
after each use of SingleStep() are:
start point (3,10)
second point (4,10)
third point (5,10)
fourth point (6,10)
fifth point (7,11), etc.
SingleScanline() repeatedly moves one scan line at a
time up/down the pixel line, giving the co-ordinates of the left most and right
most pixels of the pixel line that are on the scan line moved to. It begins on
the scan line containing aStart. The move is in the direction from
aStart to aFinish.
For line A the values given after each use of
SingleScanline() are:
|
For line B the values given after each use of
SingleScanline() are:
|
NextStep() repeatedly moves along the pixel line one
step of pixels at a time, giving the pixel coordinates of the start of each
step. It begins on the step of pixels containing aStart. The move
is in the direction from aStart to aFinish.
For line A the values given after each use of NextStep()
are:
|
For line B the values given after each use of NextStep()
are:
|