This commit is contained in:
+8
-10
@@ -1,3 +1,5 @@
|
||||
#![allow(dead_code)]
|
||||
|
||||
use rand::Rng;
|
||||
use image::Rgb;
|
||||
use image::RgbImage;
|
||||
@@ -5,12 +7,8 @@ use image::ImageBuffer;
|
||||
|
||||
|
||||
fn main() {
|
||||
// let mut args = vec![];
|
||||
// for arg in env::args() {
|
||||
// args.push(arg);
|
||||
// }
|
||||
let width = 7000;
|
||||
let height = 7000;
|
||||
let width = 6500;
|
||||
let height = 6500;
|
||||
let mut img = get_image(width, height);
|
||||
|
||||
// let mut colors= vec![];
|
||||
@@ -18,8 +16,8 @@ fn main() {
|
||||
let mut points = vec![];
|
||||
for i in 0..=1000 {
|
||||
points.push(i as f64 / 1000.0);
|
||||
points.push(-(i as f64 / 1000.0));
|
||||
}
|
||||
// println!("{points:?}");
|
||||
|
||||
// funktion = f(x) = 3x^2
|
||||
// ableitungsquotient = 6a
|
||||
@@ -31,7 +29,7 @@ fn main() {
|
||||
// img.put_pixel((point * 1000.0_f64).round() as u32, (get_point(point as i32) * 1000.0).round() as u32, Rgb(color));
|
||||
img.put_pixel(
|
||||
(point * 1000.0_f64).round() as u32 + (width / 2),
|
||||
(get_point(point as i32) * 1000.0).round() as u32 + (height / 2),
|
||||
(get_point(point) * 1000.0).round() as u32 + (height / 2),
|
||||
Rgb([255,255,255])
|
||||
);
|
||||
}
|
||||
@@ -45,8 +43,8 @@ fn get_pitch_quotient() -> u32 {
|
||||
6
|
||||
}
|
||||
|
||||
fn get_point(x: i32) -> f64 {
|
||||
(3 * x.pow(2)) as f64
|
||||
fn get_point(x: f64) -> f64 {
|
||||
3.0 * x.powf(2.0)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user