Bitmap/Bresenham's line algorithm: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 2,130:
Num_Pop(31,35)
return</lang>
 
=={{header|Wart}}==
<lang wart>def line(x0 y0 x1 y1)
let steep ((> abs) y1-y0 x1-x0)
if steep
swap x0 y0
swap x1 y1
if (x0 > x1)
swap x0 x1
swap y0 y1
withs (deltax x1-x0
deltay (abs y1-y0)
error deltax/2
ystep (if (y0 < y1) 1 -1)
y y0)
for x x0 (x < x1) ++x
if steep
plot y x
plot x y
error -= deltay
if (error < 0)
y += ystep
error += deltax</lang>
 
=={{header|XPL0}}==
143

edits