src/Colourful/Utils/CCTConverter.cs
/// <summary>
/// Returns chromaticity of given CCT (specified in K).
/// </summary>
Returns chromaticity of given CCT (specified in K).
Returns chromaticity of given CCT ( specified in K ) .
public static xyChromaticity GetChromaticityOfCCT(in double temperature)
        {
            double x_c;
            if (temperature <= 4000) 
                x_c = -0.2661239 * (1000000000 / Pow3(in temperature)) - 0.2343580 * (1000000 / Pow2(in temperature)) + 0.8776956 * (1000 / temperature) + 0.179910;
            else 
                x_c = -3.0258469 * (1000000000 / Pow3(in temperature)) + 2.1070379 * (1000000 / Pow2(in temperature)) + 0.2226347 * (1000 / temperature) + 0.240390;
            double y_c;
            if (temperature <= 2222) 
                y_c = -1.1063814 * Pow3(in x_c) - 1.34811020 * Pow2(in x_c) + 2.18555832 * x_c - 0.20219683;
            else if (temperature <= 4000) 
                y_c = -0.9549476 * Pow3(in x_c) - 1.37418593 * Pow2(in x_c) + 2.09137015 * x_c - 0.16748867;
            else 
                y_c = +3.0817580 * Pow3(in x_c) - 5.87338670 * Pow2(in x_c) + 3.75112997 * x_c - 0.37001483;
            return new xyChromaticity(in x_c, in y_c);
        }
public static xyChromaticity GetChromaticityOfCCT ( in double temperature ) { double x_c ; if ( temperature <= 4000 ) x_c = - 0.2661239 * ( 1000000000 / Pow3 ( in temperature ) ) - 0.2343580 * ( 1000000 / Pow2 ( in temperature ) ) + 0.8776956 * ( 1000 / temperature ) + 0.179910 ; else x_c = - 3.0258469 * ( 1000000000 / Pow3 ( in temperature ) ) + 2.1070379 * ( 1000000 / Pow2 ( in temperature ) ) + 0.2226347 * ( 1000 / temperature ) + 0.240390 ; double y_c ; if ( temperature <= 2222 ) y_c = - 1.1063814 * Pow3 ( in x_c ) - 1.34811020 * Pow2 ( in x_c ) + 2.18555832 * x_c - 0.20219683 ; else if ( temperature <= 4000 ) y_c = - 0.9549476 * Pow3 ( in x_c ) - 1.37418593 * Pow2 ( in x_c ) + 2.09137015 * x_c - 0.16748867 ; else y_c = + 3.0817580 * Pow3 ( in x_c ) - 5.87338670 * Pow2 ( in x_c ) + 3.75112997 * x_c - 0.37001483 ; return new xyChromaticity ( in x_c , in y_c ) ; }
Returns chromaticity of given CCT (specified in K).
Returns chromaticity of given CCT ( specified in K ) .
// approximation described here: http://en.wikipedia.org/wiki/Planckian_locus#Approximation // correctly 1667 <= T <= 4000 // correctly 4000 <= T <= 25000 // correctly 1667 <= T <= 2222 // correctly 2222 <= T <= 4000 // correctly 4000 <= T <= 25000
double
in