1 unstable release

0.3.3 Nov 14, 2022
0.3.2 Oct 20, 2022
0.3.1 Sep 27, 2022
0.2.1 Sep 26, 2022
0.0.1 Feb 18, 2024

#213 in Graphics APIs

50 downloads per month

MIT/Apache

10KB
205 lines

LineRasterizer

line rasterization

Usage

Get all points

use rust_line_rasterizer::LineRasterizer;

fn main(){
    let points: Vec<_> = LineRasterizer::new((0, 0), (2, 4)).collect();
    println!("points = {:?}", points);
    // points = [(0, 1), (1, 1), (1, 2), (1, 3), (2, 3)]
}

Iterate points

use rust_line_rasterizer::LineRasterizer;

fn main() {
    let line_rasterizer_iter = LineRasterizer::new((2, 4), (0, 0));

    for point in line_rasterizer_iter {
        println!("{:?}", point);
        // (2, 3)
        // (1, 3)
        // (1, 2)
        // (1, 1)
        // (0, 1)
    }
}

No runtime deps