hcg-minus-0.14: haskell cg (minus)

Safe HaskellSafe-Inferred



Planck radiation equation.



planck_rad_eq :: Floating a => a -> a -> aSource

Given wavelength (in microns) and temperature (in degrees Kelvin) solve Planck's radiation equation.

 planck_rad_eq 0.7 2600 == 8.22656629154115e7

k_to_rgb :: (Floating t, Ord t) => t -> (t, t, t)Source

Return the color of a black body emitting light at a given temperature. The Planck radiation equation is solved directly for the R, G, and B wavelengths defined for the CIE 1931 Standard Colorimetric Observer. The colour temperature is specified in degrees Kelvin. Typical constraints for star temperatures are >= 2600K (S Cephei, R Andromedae) and <= 28,000K (Spica).

 let h (r,g,b) = let f = floor . (*) 255 in (f r,f g,f b)
 in map (h . k_to_rgb) [2600,28000] == [(255,95,22),(49,118,254)]