diff --git a/grid_image.png b/grid_image.png index 68deef5..4095f87 100644 Binary files a/grid_image.png and b/grid_image.png differ diff --git a/src/main.rs b/src/main.rs index c33c0f2..cd83ede 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,7 +24,6 @@ struct Args { fn main() { - let args = Args::parse(); let width = 7000; @@ -72,24 +71,25 @@ fn main() { let y = get_point(point) * 1000.0; img.put_pixel( (width as f64 / 2.0 + x).round() as u32, - (height as f64 / 2.0 + y) as u32, + (height as f64 / 2.0 - y) as u32, Rgb(color) ); img.put_pixel( (width as f64 / 2.0 - x).round() as u32, - (height as f64 / 2.0 + y).round() as u32, + (height as f64 / 2.0 - y).round() as u32, Rgb(color) ); } - + // let color = draw_derivation(&mut img, *colors.last().unwrap()); + colors.push(color); img.save("grid_image.png").expect("Failed to save image"); } fn get_pitch_quotient() -> u32 { - 6 + 2 } fn get_point(x: f64) -> f64 { @@ -121,3 +121,16 @@ fn get_image(width: u32, height: u32) -> ImageBuffer, Vec> { } img } + +fn draw_derivation(img: &mut ImageBuffer, Vec>, last_color: [u8; 3]) ->[u8; 3] { + let color = [generate_random(0, 255), generate_random(0, 255), generate_random(0, 255)]; + for x in 0..=img.width() { + for y in 0..img.height() - 1 { + let pixel = img.get_pixel(x, y); + if pixel == &Rgb(last_color) { + img.put_pixel(x, y, Rgb(color)); + } + } + } + color +}