From b0ea3a9f4488526871aab5127aa2b6922155e0b2 Mon Sep 17 00:00:00 2001 From: zeefaad Date: Sat, 14 Feb 2026 13:59:20 +0100 Subject: [PATCH] eps --- src/main.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main.rs b/src/main.rs index 55c7232..f3b891a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ use std::f64::consts::PI; use std::fs; fn chladni(x: f64, y: f64, n: f64, m: f64, eps: f64) -> f64 { - (n * PI * x).cos() * (m * PI * y).cos() - (m * PI * x).cos() * (n * PI * y).cos() + (n * PI * x).cos() * (m * PI * y).cos() + eps * (m * PI * x).cos() * (n * PI * y).cos() } fn generate_png(n: u32, m: u32, width: u32, height: u32, eps: f64) { @@ -15,9 +15,11 @@ fn generate_png(n: u32, m: u32, width: u32, height: u32, eps: f64) { let yf = (y as f64 / height as f64) * 2.0 - 1.0; let val = chladni(xf, yf, n as f64, m as f64, eps); - let intensity = val.abs(); - let bright = (((0.08 - intensity).max(0.0) / 0.08) * 255.0) as u8; + let bright = if val.abs() < 0.08 { 255 } else { 0 }; // Sans variation d'alpha + + // let intensity = val.abs(); + // let bright = (((0.08 - intensity).max(0.0) / 0.08) * 255.0) as u8; *pixel = Rgba([0, 0, 0, bright]); // *pixel = Rgb([brigh, brigh, brigh]); } @@ -30,8 +32,8 @@ fn generate_png(n: u32, m: u32, width: u32, height: u32, eps: f64) { fn main() { let width = 1000; let height = 1000; - let max_n = 5; - let max_m = 5; + let max_n = 300; + let max_m = 300; fs::create_dir_all("out").expect("Erreur");