Function line_drawing::supercover [] [src]

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

Like walk_grid but takes diagonal steps if the line passes directly over a corner.

See this section of the article for an interactive demonstration.

This algorithm should always be symetrical.

Example:

extern crate line_drawing;
use line_drawing::supercover; 

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