Jump to content

Bitmap/Bresenham's line algorithm: Difference between revisions

m
correct potential edge case failure
m (minor tweaks to make more usable elsewhere on rc)
m (correct potential edge case failure)
Line 2,342:
while(true) do
self:set(x1, y1, c or 0xFFFFFFFF)
if (x1==x2 and y1==y2) then break end
if (err break> -dx) then
end
local er2 = err
if (er2 > -dx) then
err, x1 = err-dy, x1+sx
if (er2x1==x2 >and -dxy1==y2) then
self:set(x1, y1, c or 0xFFFFFFFF)
break
end
end
if (er2err < dy) then
err, y1 = err+dx, y1+sy
end
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.