From c6acac05670c59ee29353c63a9db166448da85bb Mon Sep 17 00:00:00 2001 From: Matthew Gordon Date: Wed, 2 Sep 2020 23:21:53 -0400 Subject: [PATCH] Add Photon type --- src/colour/mod.rs | 3 +++ src/colour/photon.rs | 10 ++++++++++ 2 files changed, 13 insertions(+) create mode 100644 src/colour/photon.rs diff --git a/src/colour/mod.rs b/src/colour/mod.rs index e603a81..1fb5c1f 100644 --- a/src/colour/mod.rs +++ b/src/colour/mod.rs @@ -1,2 +1,5 @@ pub mod colour_rgb; pub use colour_rgb::{ColourRgbF, ColourRgbU8, NamedColour}; + +pub mod photon; +pub use photon::Photon; diff --git a/src/colour/photon.rs b/src/colour/photon.rs new file mode 100644 index 0000000..299c005 --- /dev/null +++ b/src/colour/photon.rs @@ -0,0 +1,10 @@ +/// A quantum of light with a given wavelength and intensity +pub struct Photon { + /// The wavelength in nanometres + pub wavelength: f64, + /// The intensity of the light + /// + /// Depending on context, this might represent actual intensity in W/sr, + /// radiant flux in W, irradiance in W/m^2, or radiance in W/(m^2sr). + pub intensity: f64, +}