Safe Haskell | Safe-Inferred |
---|

Planck radiation equation.

- planck_rad_eq :: Floating a => a -> a -> a
- k_to_rgb :: (Floating t, Ord t) => t -> (t, t, t)
- k_to_colour :: Double -> C

# Documentation

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 `>=`

2600`K`

(*S Cephei, R Andromedae*) and `<=`

28,000`K`

(*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)]