Bresenham's algorithm works with the use of a decision parameter. In the case
of positive slope, X value will increase at unit interval of time. And if decision parameter is less than zero then Y value will take previous Y value, otherwise
Y value is Y+1.If P is the decision parameter then initial decision parameter Po is calculated by 2dy-dx, where dx = x2-x1 and dy=y2-
y1,
where the end points of required line is (x1,y1) and (x2,y2).
If P<0 then next P+1 value is calculated by P
+2dy
If p>=0 then next P+1 value is calculated by P+2dy-2dx