Crate bresenham [] [src]

Iterator-based Bresenham's line drawing algorithm

Bresenham's line drawing algorithm is fast algorithm to draw a line between two points. This crate implements the fast integer variant, using an iterator-based appraoch for flexibility. It calculates coordinates without knowing anything about drawing methods or surfaces.

Example:

extern crate bresenham;
use bresenham::Bresenham;

fn main() {
    for (x, y) in Bresenham::new((0, 1), (6, 4)) {
        println!("{}, {}", x, y);
    }
}

Will print:

(0, 1)
(1, 1)
(2, 2)
(3, 2)
(4, 3)
(5, 3)

Structs

Bresenham

Line-drawing iterator

Type Definitions

Point

Convenient typedef for two machines-sized integers