Add ColourXyz::from_photon()
This commit is contained in:
parent
425f093756
commit
e0d3354a77
|
|
@ -1,6 +1,6 @@
|
|||
use crate::math::{Mat3, Vec3};
|
||||
|
||||
use super::ColourRgbF;
|
||||
use super::{ColourRgbF, Photon};
|
||||
|
||||
/// A CIE XYZ Colour Value
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
|
|
@ -28,6 +28,12 @@ impl ColourXyz {
|
|||
ColourXyz { values }
|
||||
}
|
||||
|
||||
pub fn from_photon(photon: &Photon) -> ColourXyz {
|
||||
let mut result = Self::for_wavelength(photon.wavelength);
|
||||
result.values *= photon.intensity;
|
||||
result
|
||||
}
|
||||
|
||||
pub fn x(&self) -> f64 {
|
||||
self.values.x()
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue