Is there a modified Bresenham algorithm, where the step from one pixel to the next one isn't allowed to be diagonally, just horizontally or vertically? Or any other algorithm which does that? (PHP preferred)
Right:
0 0 0 1
0 0 1 1
0 1 1 0
1 1 0 0
Wrong:
0 0 0 1
0 0 1 0
0 1 0 0
1 0 0 0
Should be a trivial modification - let's say you're in the quadrant I - i.e. going up and to the right. Instead of doing a diagonal, do an up... and then a right.
Instead of:
for x from x0 to x1
plot(x,y)
error := error + deltaerr
if error ≥ 0.5 then
y := y + 1
error := error - 1.0
Something like this:
for x from x0 to x1
plot(x,y)
error := error + deltaerr
if error ≥ 0.5 then
y := y + 1
plot(x,y)
error := error - 1.0