blackbody 0.0.0

Temperature to blackbody color
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented1 out of 3 items with examples
  • Size
  • Source code size: 30.61 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.82 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 13s Average build duration of successful builds.
  • all releases: 13s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • hatoo/blackbody
    4 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • hatoo

blackbody

Blackbody simply provides functions that convert temperature into color. Codes are ported from pbrt-v3.

use blackbody::{temperature_to_rgb, temperature_to_xyz};

fn main() {
    // Convert temperatue (Kelvin) into RGB color whose components are [0.0, 1.0].
    dbg!(temperature_to_rgb(3000.0));
    // Convert temperatue (Kelvin) into XYZ color whose components are [0.0, 1.0].
    dbg!(temperature_to_xyz(3000.0));
}
[examples\example.rs:4] temperature_to_rgb(3000.0) = [
    0.73506474,
    0.3504873,
    0.112983376,
]
[examples\example.rs:5] temperature_to_xyz(3000.0) = [
    0.44889182,
    0.4151354,
    0.16
]