Skip to content

tropical32/rust_bresenham

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust_bresenham

bresenham line

Usage with iterator

use rust_bresenham::Bresenham;

fn main() {
    let points_iter = Bresenham::new((1, 1), (3, 7));

    for point in points_iter {
        println!("{:?}", point);
        // (1, 2)
        // (2, 3)
        // (2, 4)
        // (2, 5)
        // (3, 6)
    }
}

Get all points

use rust_bresenham::Bresenham;

fn main() {
    let points: Vec<_> = Bresenham::new((3, 7), (1, 1)).collect();

    println!("points = {:?}", points);
    // points = [(3, 6), (2, 5), (2, 4), (2, 3), (1, 2)]
}

About

Bresenham's line implementation in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages