fix function form and try adding first dereviation
All checks were successful
CI / Rust project (push) Successful in 1m9s
All checks were successful
CI / Rust project (push) Successful in 1m9s
This commit is contained in:
parent
30111aaa85
commit
9e3b68204c
BIN
grid_image.png
BIN
grid_image.png
Binary file not shown.
|
Before Width: | Height: | Size: 765 KiB After Width: | Height: | Size: 777 KiB |
23
src/main.rs
23
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<Rgb<u8>, Vec<u8>> {
|
||||
}
|
||||
img
|
||||
}
|
||||
|
||||
fn draw_derivation(img: &mut ImageBuffer<Rgb<u8>, Vec<u8>>, 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
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user