77 }
else if(
cct <= 7000.0) {
78 x = (-4.6070e9 / std::pow(
cct, 3)) +
79 ( 2.9678e6 / std::pow(
cct, 2)) +
80 ( 0.09911e3 /
cct) + 0.244063;
81 }
else if(
cct <= 25000) {
82 x = (-2.0064e9 / std::pow(
cct, 3)) +
83 ( 1.9108e6 / std::pow(
cct, 2)) +
84 ( 0.24748e3 /
cct) + 0.237040;
88 y = (-3.0 * std::pow(x, 2)) + (2.870 * x) - 0.275;
97 CIEPoint(
double x = -1.0,
double y = -1.0) : d(x, y) { }
124 double X = (x() *
Y) / y();
125 double Z = ((1.0 - x() - y()) *
Y) / y();
131 double u = (4.0 * X) / (-2.0 * X + 12.0 *
Y + 3.0 *
Z);
132 double v = (9.0 *
Y) / (-2.0 * X + 12.0 *
Y + 3.0 *
Z);
133 return u >= 0 &&
u <= 0.6 && v >= 0 && v <= 0.6 &&
u + v <= 0.6;
138 double n = (x() - 0.3320) / (0.1858 - y());
139 return 437.0 * std::pow(
n, 3.0) +
140 3601.0 * std::pow(
n, 2.0) +
bool isBetween(const Array< T, NumValues > &min, const Array< T, NumValues > &max) const
Returns true if all elements fall within the given range.
Definition array.h:338
Array< T, NumValues > lerp(const Array< T, NumValues > &other, double v) const
Returns a linearly interpolated array between this one and another.
Definition array.h:310
A point in the CIE 1931 xy chromaticity diagram.
Definition ciepoint.h:26
static constexpr double MaxWavelength
Maximum visible wavelength in nanometers.
Definition ciepoint.h:35
CIEPoint(double x=-1.0, double y=-1.0)
Constructs a CIEPoint with the given chromaticity coordinates.
Definition ciepoint.h:97
static constexpr double MinWavelength
Minimum visible wavelength in nanometers.
Definition ciepoint.h:32
static XYZColor wavelengthToXYZ(double wavelength)
Converts a wavelength to a CIE XYZ color.
static CIEPoint colorTempToWhitePoint(double cct)
Computes the white point for a correlated color temperature.
Definition ciepoint.h:72
static bool isValidWavelength(double val)
Checks whether a wavelength is within the visible range.
Definition ciepoint.h:45
CIEPoint(const DataType &other)
Constructs a CIEPoint from raw coordinate data.
Definition ciepoint.h:103
bool isValid() const
Checks whether this point lies within valid chromaticity bounds.
Definition ciepoint.h:109
static CIEPoint wavelengthToCIEPoint(double wavelength)
Converts a wavelength to a CIE xy chromaticity point.
CIEPoint lerp(const CIEPoint &other, double t) const
Linearly interpolates between this point and another.
Definition ciepoint.h:119
Array< double, 2 > DataType
Underlying storage type for the x and y coordinates.
Definition ciepoint.h:29
Dynamic array container wrapping std::vector.
Definition list.h:40
CIE XYZ color value.
Definition xyzcolor.h:25
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19