Bitmap/Bresenham's line algorithm: Difference between revisions
Content added Content deleted
Line 3,820: | Line 3,820: | ||
} |
} |
||
coordinates |
coordinates |
||
} |
|||
fn draw_line(line: std::vec::Vec<Point>, width: i32, height: i32) { |
|||
for col in 0..height { |
|||
for row in 0..width { |
|||
let is_point_in_line = line.iter().any(| point| point.x == row && point.y == col); |
|||
match is_point_in_line { |
|||
true => print!("@"), |
|||
_ => print!(".") |
|||
}; |
|||
} |
|||
print!("\n"); |
|||
} |
|||
} |
} |
||
</lang> |
</lang> |