Function line_drawing::bresenham [] [src]

pub fn bresenham(
    start: (isize, isize),
    end: (isize, isize)
) -> Vec<(isize, isize)>

A simple wrapper around bresenham-rs that includes the end point.

If all you need is this function then just using bresenham-rs would probably be easier. See sorted_bresenham for a sorted version.

Example:

extern crate line_drawing;
use line_drawing::bresenham; 

fn main() {
    for (x, y) in bresenham((0, 0), (5, 6)) {
        print!("({}, {}), ", x, y);
    }
}
(0, 0), (0, 1), (1, 2), (2, 3), (3, 4), (4, 5), (5, 6),