Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- plotLine(x0, y0, x1, y1)
- dx = abs(x1 - x0)
- sx = x0 < x1 ? 1 : -1
- dy = -abs(y1 - y0)
- sy = y0 < y1 ? 1 : -1
- error = dx + dy
- while true
- plot(x0, y0)
- if x0 == x1 && y0 == y1 break
- e2 = 2 * error
- if e2 >= dy
- error = error + dy
- x0 = x0 + sx
- end if
- if e2 <= dx
- error = error + dx
- y0 = y0 + sy
- end if
- end while
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement