Add Spectrum::grey() constructor

This commit is contained in:
Matthew Gordon 2020-09-12 09:35:37 -04:00
parent a0db18d383
commit 56d3991e7d
1 changed files with 8 additions and 0 deletions

View File

@ -18,6 +18,14 @@ impl Spectrum {
} }
} }
pub fn grey(brightness: f64) -> Spectrum {
Spectrum {
shortest_wavelength: SHORTEST_VISIBLE_WAVELENGTH,
longest_wavelength: LONGEST_VISIBLE_WAVELENGTH,
samples: vec![brightness; 2],
}
}
fn wavelength_range(&self) -> f64 { fn wavelength_range(&self) -> f64 {
self.longest_wavelength - self.shortest_wavelength self.longest_wavelength - self.shortest_wavelength
} }