Advertisement
ijontichy

bresenham

Mar 24th, 2013
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. plotLine(x0,y0, x1,y1)
  2. dx=x1-x0
  3. dy=y1-y0
  4.  
  5. D = 2*dy - dx
  6. plot(x0,y0)
  7. y=y0
  8.  
  9. for x from x0+1 to x1
  10. if D > 0
  11. y = y+1
  12. plot(x,y)
  13. D = D + (2*dy-2*dx)
  14. else
  15. plot(x,y)
  16. D = D + (2*dy)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement