blackbody

Crates.ioblackbody
lib.rsblackbody
version0.0.0
sourcesrc
created_at2022-01-06 11:43:22.453493
updated_at2022-01-06 11:43:22.453493
descriptionTemperature to blackbody color
homepage
repositoryhttps://github.com/hatoo/blackbody
max_upload_size
id508922
size31,078
(hatoo)

documentation

README

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
]
Commit count: 8

cargo fmt