1 unstable release
0.1.8 |
|
---|---|
0.1.7 |
|
0.1.5 |
|
0.0.0 | Feb 18, 2024 |
#380 in Graphics APIs
59 downloads per month
8KB
83 lines
rust_bresenham
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)]
}