decision parameter
The simplest way to draw a line on a computer is by using this code, which works but is slow due to the integer divisions and multiplications being used
// A naive way of drawing line
void naiveDrawLine(x1, x2, y1, y2)
{
m = (y2 - y1) / (x2 - x1);
for (x = x1; x <= x2; x++) {
// Assuming that the round function finds
// closest integer to a given float.
y = round(mx + c);
print(x, y);
}
}
The algorithm always moves across the X axis by 1 unit each time. Then we work out if we need to step up Y by 1 or remain on the Y axis.
Choosing this point depends on which Y value is closest to the original line.
The decision parameter tracks the slope error and if it becomes bigger than 0.5 Y is stepped up by 1.