20 #ifndef ANTKEEPER_COLOR_XYZ_HPP
21 #define ANTKEEPER_COLOR_XYZ_HPP
51 const T
sum = x[0] + x[1] + x[2];
66 const T t0 = (lambda - T{442.0}) * ((lambda < T{442.0}) ? T{0.0624} : T{0.0374});
67 const T t1 = (lambda - T{599.8}) * ((lambda < T{599.8}) ? T{0.0264} : T{0.0323});
68 const T t2 = (lambda - T{501.1}) * ((lambda < T{501.1}) ? T{0.0490} : T{0.0382});
70 const T x0 = T{ 0.362} * std::exp(T{-0.5} * t0 * t0);
71 const T x1 = T{ 1.056} * std::exp(T{-0.5} * t1 * t1);
72 const T x2 = T{-0.065} * std::exp(T{-0.5} * t2 * t2);
88 const T t0 = (lambda - T{568.8}) * ((lambda < T{568.8}) ? T{0.0213} : T{0.0247});
89 const T t1 = (lambda - T{530.9}) * ((lambda < T{530.9}) ? T{0.0613} : T{0.0322});
91 const T y0 = T{0.821} * std::exp(T{-0.5} * t0 * t0);
92 const T y1 = T{0.286} * std::exp(T{-0.5} * t1 * t1);
108 const T t0 = (lambda - T{437.0}) * ((lambda < T{437.0}) ? T{0.0845} : T{0.0278});
109 const T t1 = (lambda - T{459.0}) * ((lambda < T{459.0}) ? T{0.0385} : T{0.0725});
111 const T z0 = T{1.217} * std::exp(T{-0.5} * t0 * t0);
112 const T z1 = T{0.681} * std::exp(T{-0.5} * t1 * t1);
134 xyz_match_x<T>(lambda),
135 xyz_match_y<T>(lambda),
136 xyz_match_z<T>(lambda)
T xyz_match_x(T lambda)
CIE 1931 standard observer color matching function for the X tristimulus value.
constexpr math::vec3< T > xyz_to_xyy(const math::vec3< T > &x) noexcept
Transforms a CIE XYZ color into the CIE xyY color space.
math::vec3< T > xyz_match(T lambda)
Fitted piecewise gaussian approximation to the CIE 1931 standard observer color matching function.
T xyz_match_y(T lambda)
CIE 1931 standard observer color matching function for the Y tristimulus value.
constexpr T xyz_to_luminance(const math::vec3< T > &x) noexcept
Returns the luminance of a CIE XYZ color.
T xyz_match_z(T lambda)
CIE 1931 standard observer color matching function for the Z tristimulus value.
constexpr T sum(const vector< T, N > &x) noexcept
Calculates the sum of all elements in a vector.