Lumiverse  2.5
A framework for creating lighting control applications
LumiverseColorLib.h
Go to the documentation of this file.
1 
5 #ifndef _LUMIVERSECOLORLIB_H_
6 #define _LUMIVERSECOLORLIB_H_
7 
8 // Color and rotation use unordered_maps with initailizers for convenience
9 // Apparently VS2012 didn't fully implement this
10 #define USE_C11_MAPS
11 
12 #ifdef _MSC_VER
13  #if _MSC_VER <= 1700
14  #undef USE_C11_MAPS
15  #endif
16 #endif
17 
18 #include <unordered_map>
19 #define _USE_MATH_DEFINES
20 #include <math.h>
21 
22 #include "Logger.h"
23 #include "lib/Eigen/Dense"
24 
25 using namespace std;
26 
27 namespace Lumiverse {
30  sRGB,
31  sharpRGB /* Picture Perfect RGB Rendering Using Spectral Prefiltering */
32  };
33 
34  enum ReferenceWhite {
35  D65, /*< D65 illuminant. */
36  D50, /*< D50 illuminant. */
37  A /*< A illuminant. */
38  };
39 
40 #ifdef USE_C11_MAPS
41 
42  static unordered_map<int, Eigen::Matrix3d> RGBToXYZ =
43  {
44  { sRGB, (Eigen::Matrix3d() << 0.4124564, 0.3575761, 0.1804375,
45  0.2126729, 0.7151522, 0.0721750,
46  0.0193339, 0.1191920, 0.9503041).finished() },
47  { sharpRGB, (Eigen::Matrix3d() << 0.8156, 0.0472, 0.1372,
48  0.3791, 0.5769, 0.0440,
49  -0.0123, 0.0167, 0.9955).finished() }
50  };
51 
53  static unordered_map<int, ReferenceWhite> ColorSpaceRefWhite =
54  {
55  { sRGB, D65 }
56  };
57 
59  static unordered_map<int, Eigen::Vector3d> refWhites =
60  {
61  { D65, Eigen::Vector3d(95.047, 100.00, 108.883) },
62  { D50, Eigen::Vector3d(96.4212, 100.0, 82.5188) },
63  { A, Eigen::Vector3d(109.844, 100.0, 35.55976) }
64  };
65 #else
66  // Apparently VS2012 and earlier don't compile the above initialization
67  static Eigen::Matrix3d RGBToXYZ(RGBColorSpace c) {
68  switch (c) {
69  case sRGB:
70  return (Eigen::Matrix3d() << 0.4124564, 0.3575761, 0.1804375,
71  0.2126729, 0.7151522, 0.0721750,
72  0.0193339, 0.1191920, 0.9503041).finished();
73  case sharpRGB:
74  return (Eigen::Matrix3d() << 0.8156, 0.0472, 0.1372,
75  0.3791, 0.5769, 0.0440,
76  -0.0123, 0.0167, 0.9955).finished();
77  default:
78  return Eigen::Matrix3d();
79  }
80  }
81 
82  static ReferenceWhite ColorSpaceRefWhite(RGBColorSpace c) {
83  switch(c) {
84  case sRGB:
85  return D65;
86  default:
87  return D65;
88  }
89  }
90 
91  static Eigen::Vector3d refWhites(ReferenceWhite c) {
92  switch(c) {
93  case D65:
94  return Eigen::Vector3d(95.047, 100.00, 108.883);
95  case D50:
96  return Eigen::Vector3d(96.4212, 100.0, 82.5188);
97  default:
98  return Eigen::Vector3d();
99  }
100  }
101 #endif
102 
103  // All of the following CMFs start at 360nm and go to 830nm
104 
106  static double CIE2012X[471] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3.77E-03, 4.53E-03, 5.45E-03, 6.54E-03, 7.84E-03, 9.38E-03, 1.12E-02, 1.33E-02, 1.59E-02, 1.88E-02, 2.21E-02, 2.60E-02, 3.04E-02, 3.54E-02, 4.11E-02, 4.74E-02, 5.45E-02, 6.22E-02, 7.07E-02, 7.98E-02, 8.95E-02, 9.97E-02, 1.10E-01, 1.21E-01, 1.33E-01, 1.45E-01, 1.57E-01, 1.69E-01, 1.81E-01, 1.93E-01, 2.04E-01, 2.14E-01, 2.23E-01, 2.32E-01, 2.40E-01, 2.49E-01, 2.58E-01, 2.66E-01, 2.75E-01, 2.84E-01, 2.92E-01, 2.99E-01, 3.05E-01, 3.11E-01, 3.17E-01, 3.23E-01, 3.29E-01, 3.35E-01, 3.41E-01, 3.45E-01, 3.48E-01, 3.49E-01, 3.49E-01, 3.47E-01, 3.45E-01, 3.42E-01, 3.39E-01, 3.36E-01, 3.32E-01, 3.28E-01, 3.22E-01, 3.16E-01, 3.08E-01, 2.99E-01, 2.91E-01, 2.83E-01, 2.75E-01, 2.67E-01, 2.61E-01, 2.54E-01, 2.49E-01, 2.43E-01, 2.38E-01, 2.33E-01, 2.28E-01, 2.22E-01, 2.15E-01, 2.08E-01, 1.99E-01, 1.90E-01, 1.81E-01, 1.71E-01, 1.60E-01, 1.50E-01, 1.40E-01, 1.29E-01, 1.19E-01, 1.09E-01, 9.95E-02, 9.04E-02, 8.18E-02, 7.38E-02, 6.62E-02, 5.91E-02, 5.23E-02, 4.60E-02, 4.01E-02, 3.45E-02, 2.95E-02, 2.49E-02, 2.08E-02, 1.72E-02, 1.41E-02, 1.13E-02, 9.02E-03, 7.10E-03, 5.57E-03, 4.39E-03, 3.52E-03, 2.89E-03, 2.46E-03, 2.21E-03, 2.15E-03, 2.34E-03, 2.82E-03, 3.65E-03, 4.89E-03, 6.63E-03, 8.94E-03, 1.19E-02, 1.56E-02, 2.00E-02, 2.50E-02, 3.07E-02, 3.67E-02, 4.32E-02, 4.98E-02, 5.67E-02, 6.39E-02, 7.15E-02, 7.96E-02, 8.82E-02, 9.73E-02, 1.07E-01, 1.17E-01, 1.27E-01, 1.37E-01, 1.48E-01, 1.59E-01, 1.71E-01, 1.82E-01, 1.93E-01, 2.05E-01, 2.16E-01, 2.28E-01, 2.41E-01, 2.54E-01, 2.67E-01, 2.81E-01, 2.95E-01, 3.10E-01, 3.24E-01, 3.38E-01, 3.53E-01, 3.67E-01, 3.80E-01, 3.94E-01, 4.08E-01, 4.21E-01, 4.35E-01, 4.49E-01, 4.64E-01, 4.79E-01, 4.95E-01, 5.11E-01, 5.28E-01, 5.45E-01, 5.62E-01, 5.79E-01, 5.96E-01, 6.13E-01, 6.31E-01, 6.48E-01, 6.65E-01, 6.83E-01, 7.02E-01, 7.20E-01, 7.39E-01, 7.59E-01, 7.78E-01, 7.97E-01, 8.15E-01, 8.34E-01, 8.52E-01, 8.69E-01, 8.85E-01, 9.01E-01, 9.17E-01, 9.32E-01, 9.47E-01, 9.64E-01, 9.81E-01, 9.99E-01, 1.02E+00, 1.03E+00, 1.05E+00, 1.07E+00, 1.08E+00, 1.09E+00, 1.10E+00, 1.11E+00, 1.12E+00, 1.13E+00, 1.13E+00, 1.14E+00, 1.14E+00, 1.15E+00, 1.15E+00, 1.15E+00, 1.15E+00, 1.15E+00, 1.15E+00, 1.15E+00, 1.14E+00, 1.14E+00, 1.13E+00, 1.13E+00, 1.12E+00, 1.11E+00, 1.10E+00, 1.08E+00, 1.07E+00, 1.06E+00, 1.04E+00, 1.02E+00, 1.01E+00, 9.90E-01, 9.71E-01, 9.52E-01, 9.33E-01, 9.14E-01, 8.95E-01, 8.76E-01, 8.56E-01, 8.35E-01, 8.14E-01, 7.90E-01, 7.66E-01, 7.42E-01, 7.17E-01, 6.92E-01, 6.68E-01, 6.44E-01, 6.21E-01, 5.98E-01, 5.76E-01, 5.54E-01, 5.33E-01, 5.12E-01, 4.92E-01, 4.73E-01, 4.55E-01, 4.37E-01, 4.19E-01, 4.02E-01, 3.84E-01, 3.67E-01, 3.50E-01, 3.33E-01, 3.16E-01, 3.00E-01, 2.84E-01, 2.69E-01, 2.55E-01, 2.41E-01, 2.28E-01, 2.15E-01, 2.03E-01, 1.92E-01, 1.81E-01, 1.71E-01, 1.61E-01, 1.52E-01, 1.43E-01, 1.34E-01, 1.26E-01, 1.19E-01, 1.12E-01, 1.05E-01, 9.83E-02, 9.22E-02, 8.65E-02, 8.10E-02, 7.59E-02, 7.10E-02, 6.64E-02, 6.21E-02, 5.80E-02, 5.41E-02, 5.05E-02, 4.71E-02, 4.39E-02, 4.09E-02, 3.81E-02, 3.54E-02, 3.29E-02, 3.06E-02, 2.83E-02, 2.63E-02, 2.44E-02, 2.26E-02, 2.10E-02, 1.95E-02, 1.82E-02, 1.69E-02, 1.58E-02, 1.47E-02, 1.36E-02, 1.27E-02, 1.18E-02, 1.10E-02, 1.02E-02, 9.48E-03, 8.82E-03, 8.19E-03, 7.61E-03, 7.06E-03, 6.55E-03, 6.07E-03, 5.63E-03, 5.21E-03, 4.83E-03, 4.48E-03, 4.15E-03, 3.85E-03, 3.57E-03, 3.31E-03, 3.08E-03, 2.86E-03, 2.65E-03, 2.46E-03, 2.29E-03, 2.13E-03, 1.97E-03, 1.83E-03, 1.70E-03, 1.58E-03, 1.47E-03, 1.37E-03, 1.27E-03, 1.19E-03, 1.10E-03, 1.03E-03, 9.56E-04, 8.89E-04, 8.27E-04, 7.69E-04, 7.15E-04, 6.65E-04, 6.19E-04, 5.76E-04, 5.37E-04, 5.00E-04, 4.67E-04, 4.35E-04, 4.06E-04, 3.78E-04, 3.53E-04, 3.29E-04, 3.06E-04, 2.86E-04, 2.66E-04, 2.49E-04, 2.32E-04, 2.17E-04, 2.02E-04, 1.89E-04, 1.76E-04, 1.65E-04, 1.54E-04, 1.44E-04, 1.34E-04, 1.26E-04, 1.17E-04, 1.10E-04, 1.02E-04, 9.58E-05, 8.97E-05, 8.39E-05, 7.85E-05, 7.35E-05, 6.87E-05, 6.43E-05, 6.01E-05, 5.62E-05, 5.26E-05, 4.93E-05, 4.62E-05, 4.33E-05, 4.06E-05, 3.81E-05, 3.57E-05, 3.35E-05, 3.14E-05, 2.94E-05, 2.76E-05, 2.59E-05, 2.43E-05, 2.28E-05, 2.14E-05, 2.00E-05, 1.88E-05, 1.76E-05, 1.66E-05, 1.55E-05, 1.46E-05, 1.37E-05, 1.29E-05, 1.21E-05, 1.14E-05, 1.07E-05, 1.00E-05, 9.45E-06, 8.88E-06, 8.36E-06, 7.86E-06, 7.39E-06, 6.94E-06, 6.53E-06, 6.14E-06, 5.77E-06, 5.43E-06, 5.10E-06, 4.80E-06, 4.52E-06, 4.26E-06, 4.01E-06, 3.78E-06, 3.56E-06, 3.36E-06, 3.17E-06, 2.99E-06, 2.81E-06, 2.65E-06, 2.50E-06, 2.36E-06, 2.22E-06, 2.10E-06, 1.98E-06, 1.87E-06, 1.76E-06 };
107 
109  static double CIE2012Y[471] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4.15E-04, 5.03E-04, 6.08E-04, 7.34E-04, 8.84E-04, 1.06E-03, 1.27E-03, 1.50E-03, 1.78E-03, 2.10E-03, 2.45E-03, 2.85E-03, 3.30E-03, 3.80E-03, 4.35E-03, 4.97E-03, 5.66E-03, 6.42E-03, 7.25E-03, 8.14E-03, 9.08E-03, 1.01E-02, 1.11E-02, 1.21E-02, 1.32E-02, 1.43E-02, 1.55E-02, 1.66E-02, 1.79E-02, 1.91E-02, 2.03E-02, 2.14E-02, 2.26E-02, 2.37E-02, 2.49E-02, 2.61E-02, 2.74E-02, 2.87E-02, 3.02E-02, 3.17E-02, 3.32E-02, 3.48E-02, 3.64E-02, 3.81E-02, 3.98E-02, 4.16E-02, 4.34E-02, 4.52E-02, 4.70E-02, 4.87E-02, 5.03E-02, 5.19E-02, 5.33E-02, 5.47E-02, 5.61E-02, 5.74E-02, 5.89E-02, 6.03E-02, 6.18E-02, 6.33E-02, 6.47E-02, 6.61E-02, 6.76E-02, 6.90E-02, 7.06E-02, 7.24E-02, 7.44E-02, 7.66E-02, 7.91E-02, 8.20E-02, 8.51E-02, 8.87E-02, 9.27E-02, 9.69E-02, 1.01E-01, 1.06E-01, 1.11E-01, 1.16E-01, 1.20E-01, 1.25E-01, 1.30E-01, 1.35E-01, 1.39E-01, 1.44E-01, 1.49E-01, 1.54E-01, 1.58E-01, 1.63E-01, 1.68E-01, 1.74E-01, 1.79E-01, 1.84E-01, 1.90E-01, 1.95E-01, 2.01E-01, 2.06E-01, 2.12E-01, 2.18E-01, 2.24E-01, 2.31E-01, 2.38E-01, 2.46E-01, 2.55E-01, 2.64E-01, 2.74E-01, 2.85E-01, 2.96E-01, 3.09E-01, 3.21E-01, 3.34E-01, 3.48E-01, 3.63E-01, 3.78E-01, 3.94E-01, 4.11E-01, 4.28E-01, 4.45E-01, 4.64E-01, 4.82E-01, 5.01E-01, 5.20E-01, 5.40E-01, 5.60E-01, 5.80E-01, 6.00E-01, 6.21E-01, 6.41E-01, 6.61E-01, 6.81E-01, 7.00E-01, 7.18E-01, 7.35E-01, 7.51E-01, 7.66E-01, 7.81E-01, 7.95E-01, 8.08E-01, 8.21E-01, 8.34E-01, 8.46E-01, 8.58E-01, 8.68E-01, 8.78E-01, 8.88E-01, 8.98E-01, 9.07E-01, 9.17E-01, 9.27E-01, 9.37E-01, 9.46E-01, 9.54E-01, 9.62E-01, 9.68E-01, 9.74E-01, 9.78E-01, 9.81E-01, 9.84E-01, 9.85E-01, 9.86E-01, 9.88E-01, 9.89E-01, 9.91E-01, 9.93E-01, 9.96E-01, 9.98E-01, 9.99E-01, 1.00E+00, 1.00E+00, 9.99E-01, 9.98E-01, 9.97E-01, 9.96E-01, 9.95E-01, 9.94E-01, 9.92E-01, 9.90E-01, 9.88E-01, 9.85E-01, 9.82E-01, 9.78E-01, 9.73E-01, 9.68E-01, 9.63E-01, 9.57E-01, 9.50E-01, 9.42E-01, 9.34E-01, 9.24E-01, 9.15E-01, 9.05E-01, 8.96E-01, 8.88E-01, 8.81E-01, 8.74E-01, 8.66E-01, 8.59E-01, 8.50E-01, 8.42E-01, 8.32E-01, 8.22E-01, 8.12E-01, 8.01E-01, 7.90E-01, 7.78E-01, 7.66E-01, 7.54E-01, 7.42E-01, 7.30E-01, 7.17E-01, 7.05E-01, 6.92E-01, 6.79E-01, 6.66E-01, 6.53E-01, 6.40E-01, 6.27E-01, 6.14E-01, 6.00E-01, 5.86E-01, 5.72E-01, 5.58E-01, 5.45E-01, 5.31E-01, 5.17E-01, 5.03E-01, 4.90E-01, 4.76E-01, 4.62E-01, 4.49E-01, 4.36E-01, 4.23E-01, 4.10E-01, 3.98E-01, 3.86E-01, 3.73E-01, 3.61E-01, 3.48E-01, 3.36E-01, 3.23E-01, 3.10E-01, 2.98E-01, 2.86E-01, 2.74E-01, 2.63E-01, 2.52E-01, 2.42E-01, 2.31E-01, 2.22E-01, 2.12E-01, 2.03E-01, 1.94E-01, 1.86E-01, 1.78E-01, 1.70E-01, 1.62E-01, 1.55E-01, 1.47E-01, 1.40E-01, 1.33E-01, 1.26E-01, 1.19E-01, 1.13E-01, 1.07E-01, 1.01E-01, 9.52E-02, 8.98E-02, 8.47E-02, 7.98E-02, 7.52E-02, 7.09E-02, 6.67E-02, 6.28E-02, 5.90E-02, 5.55E-02, 5.22E-02, 4.90E-02, 4.60E-02, 4.32E-02, 4.05E-02, 3.80E-02, 3.56E-02, 3.33E-02, 3.12E-02, 2.92E-02, 2.73E-02, 2.55E-02, 2.39E-02, 2.23E-02, 2.08E-02, 1.94E-02, 1.81E-02, 1.68E-02, 1.57E-02, 1.46E-02, 1.36E-02, 1.26E-02, 1.17E-02, 1.09E-02, 1.01E-02, 9.33E-03, 8.66E-03, 8.05E-03, 7.48E-03, 6.96E-03, 6.48E-03, 6.03E-03, 5.61E-03, 5.22E-03, 4.85E-03, 4.51E-03, 4.20E-03, 3.90E-03, 3.63E-03, 3.37E-03, 3.13E-03, 2.91E-03, 2.70E-03, 2.51E-03, 2.32E-03, 2.15E-03, 2.00E-03, 1.85E-03, 1.71E-03, 1.59E-03, 1.47E-03, 1.37E-03, 1.27E-03, 1.18E-03, 1.09E-03, 1.02E-03, 9.45E-04, 8.78E-04, 8.15E-04, 7.57E-04, 7.03E-04, 6.54E-04, 6.08E-04, 5.65E-04, 5.26E-04, 4.90E-04, 4.56E-04, 4.24E-04, 3.95E-04, 3.67E-04, 3.42E-04, 3.18E-04, 2.96E-04, 2.75E-04, 2.56E-04, 2.38E-04, 2.22E-04, 2.07E-04, 1.93E-04, 1.80E-04, 1.68E-04, 1.57E-04, 1.46E-04, 1.36E-04, 1.27E-04, 1.18E-04, 1.10E-04, 1.03E-04, 9.61E-05, 8.97E-05, 8.38E-05, 7.83E-05, 7.31E-05, 6.83E-05, 6.39E-05, 5.97E-05, 5.58E-05, 5.21E-05, 4.87E-05, 4.55E-05, 4.26E-05, 3.98E-05, 3.73E-05, 3.49E-05, 3.26E-05, 3.06E-05, 2.86E-05, 2.68E-05, 2.50E-05, 2.34E-05, 2.19E-05, 2.05E-05, 1.92E-05, 1.80E-05, 1.69E-05, 1.59E-05, 1.49E-05, 1.40E-05, 1.31E-05, 1.23E-05, 1.15E-05, 1.08E-05, 1.01E-05, 9.51E-06, 8.93E-06, 8.38E-06, 7.86E-06, 7.38E-06, 6.93E-06, 6.51E-06, 6.11E-06, 5.74E-06, 5.39E-06, 5.07E-06, 4.76E-06, 4.48E-06, 4.21E-06, 3.96E-06, 3.73E-06, 3.51E-06, 3.30E-06, 3.11E-06, 2.92E-06, 2.75E-06, 2.58E-06, 2.43E-06, 2.29E-06, 2.15E-06, 2.03E-06, 1.91E-06, 1.80E-06, 1.69E-06, 1.60E-06, 1.50E-06, 1.42E-06, 1.34E-06, 1.26E-06, 1.19E-06, 1.12E-06, 1.06E-06, 9.99E-07, 9.42E-07, 8.89E-07, 8.39E-07, 7.91E-07, 7.47E-07, 7.05E-07 };
110 
112  static double CIE2012Z[471] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1.85E-02, 2.22E-02, 2.67E-02, 3.21E-02, 3.85E-02, 4.61E-02, 5.51E-02, 6.58E-02, 7.82E-02, 9.28E-02, 1.10E-01, 1.29E-01, 1.51E-01, 1.76E-01, 2.05E-01, 2.37E-01, 2.73E-01, 3.12E-01, 3.55E-01, 4.01E-01, 4.51E-01, 5.03E-01, 5.59E-01, 6.16E-01, 6.76E-01, 7.38E-01, 8.01E-01, 8.66E-01, 9.30E-01, 9.92E-01, 1.05E+00, 1.11E+00, 1.16E+00, 1.21E+00, 1.26E+00, 1.31E+00, 1.35E+00, 1.41E+00, 1.46E+00, 1.51E+00, 1.55E+00, 1.60E+00, 1.64E+00, 1.67E+00, 1.71E+00, 1.75E+00, 1.79E+00, 1.83E+00, 1.86E+00, 1.89E+00, 1.92E+00, 1.93E+00, 1.93E+00, 1.93E+00, 1.93E+00, 1.92E+00, 1.91E+00, 1.90E+00, 1.89E+00, 1.87E+00, 1.85E+00, 1.82E+00, 1.78E+00, 1.74E+00, 1.70E+00, 1.66E+00, 1.63E+00, 1.60E+00, 1.57E+00, 1.54E+00, 1.52E+00, 1.50E+00, 1.49E+00, 1.47E+00, 1.45E+00, 1.43E+00, 1.40E+00, 1.37E+00, 1.33E+00, 1.29E+00, 1.25E+00, 1.20E+00, 1.15E+00, 1.10E+00, 1.05E+00, 9.99E-01, 9.47E-01, 8.97E-01, 8.47E-01, 8.00E-01, 7.55E-01, 7.13E-01, 6.73E-01, 6.34E-01, 5.97E-01, 5.62E-01, 5.27E-01, 4.95E-01, 4.64E-01, 4.36E-01, 4.10E-01, 3.86E-01, 3.65E-01, 3.45E-01, 3.27E-01, 3.11E-01, 2.95E-01, 2.80E-01, 2.65E-01, 2.51E-01, 2.38E-01, 2.24E-01, 2.11E-01, 1.98E-01, 1.85E-01, 1.72E-01, 1.60E-01, 1.48E-01, 1.37E-01, 1.27E-01, 1.18E-01, 1.09E-01, 1.02E-01, 9.53E-02, 8.89E-02, 8.28E-02, 7.70E-02, 7.14E-02, 6.62E-02, 6.12E-02, 5.65E-02, 5.22E-02, 4.81E-02, 4.43E-02, 4.08E-02, 3.75E-02, 3.45E-02, 3.16E-02, 2.90E-02, 2.66E-02, 2.44E-02, 2.23E-02, 2.05E-02, 1.87E-02, 1.71E-02, 1.57E-02, 1.43E-02, 1.30E-02, 1.19E-02, 1.08E-02, 9.85E-03, 8.96E-03, 8.15E-03, 7.42E-03, 6.74E-03, 6.13E-03, 5.57E-03, 5.06E-03, 4.60E-03, 4.18E-03, 3.79E-03, 3.44E-03, 3.12E-03, 2.83E-03, 2.57E-03, 2.33E-03, 2.11E-03, 1.92E-03, 1.74E-03, 1.58E-03, 1.43E-03, 1.30E-03, 1.18E-03, 1.07E-03, 9.72E-04, 8.82E-04, 8.01E-04, 7.27E-04, 6.61E-04, 6.00E-04, 5.45E-04, 4.95E-04, 4.50E-04, 4.09E-04, 3.72E-04, 3.39E-04, 3.08E-04, 2.80E-04, 2.55E-04, 2.32E-04, 2.12E-04, 1.93E-04, 1.76E-04, 1.60E-04, 1.46E-04, 1.34E-04, 1.22E-04, 1.11E-04, 1.02E-04, 9.29E-05, 8.49E-05, 7.77E-05, 7.11E-05, 6.51E-05, 5.96E-05, 5.46E-05, 5.01E-05, 4.59E-05, 4.21E-05, 3.87E-05, 3.55E-05, 3.26E-05, 3.00E-05, 2.76E-05, 2.54E-05, 2.33E-05, 2.15E-05, 1.98E-05, 1.83E-05, 1.68E-05, 1.55E-05, 1.44E-05, 1.33E-05, 1.23E-05, 1.13E-05, 1.05E-05, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00, 0.00E+00 };
113 
115  static double CIE1964X[471] = { 1.222E-07, 1.85138E-07, 2.7883E-07, 4.1747E-07, 6.2133E-07, 9.1927E-07, 1.35198E-06, 1.97654E-06, 2.8725E-06, 4.1495E-06, 5.9586E-06, 8.5056E-06, 1.20686E-05, 1.70226E-05, 0.000023868, 0.000033266, 0.000046087, 0.000063472, 0.000086892, 0.000118246, 0.000159952, 0.00021508, 0.00028749, 0.00038199, 0.00050455, 0.00066244, 0.0008645, 0.0011215, 0.00144616, 0.00185359, 0.0023616, 0.0029906, 0.0037645, 0.0047102, 0.0058581, 0.0072423, 0.0088996, 0.0108709, 0.0131989, 0.0159292, 0.0191097, 0.022788, 0.027011, 0.031829, 0.037278, 0.0434, 0.050223, 0.057764, 0.066038, 0.075033, 0.084736, 0.095041, 0.105836, 0.117066, 0.128682, 0.140638, 0.152893, 0.165416, 0.178191, 0.191214, 0.204492, 0.21765, 0.230267, 0.242311, 0.253793, 0.264737, 0.275195, 0.285301, 0.295143, 0.304869, 0.314679, 0.324355, 0.33357, 0.342243, 0.350312, 0.357719, 0.364482, 0.370493, 0.375727, 0.380158, 0.383734, 0.386327, 0.387858, 0.388396, 0.387978, 0.386726, 0.384696, 0.382006, 0.378709, 0.374915, 0.370702, 0.366089, 0.361045, 0.355518, 0.349486, 0.342957, 0.335893, 0.328284, 0.32015, 0.311475, 0.302273, 0.292858, 0.283502, 0.274044, 0.264263, 0.254085, 0.243392, 0.232187, 0.220488, 0.208198, 0.195618, 0.183034, 0.170222, 0.157348, 0.14465, 0.132349, 0.120584, 0.109456, 0.099042, 0.089388, 0.080507, 0.072034, 0.06371, 0.055694, 0.048117, 0.041072, 0.034642, 0.028896, 0.023876, 0.019628, 0.016172, 0.0133, 0.010759, 0.008542, 0.006661, 0.005132, 0.003982, 0.003239, 0.002934, 0.003114, 0.003816, 0.005095, 0.006936, 0.009299, 0.012147, 0.015444, 0.019156, 0.02325, 0.02769, 0.032444, 0.037465, 0.042956, 0.049114, 0.05592, 0.063349, 0.071358, 0.079901, 0.088909, 0.098293, 0.107949, 0.117749, 0.127839, 0.13845, 0.149516, 0.161041, 0.172953, 0.185209, 0.197755, 0.210538, 0.22346, 0.236491, 0.249633, 0.262972, 0.276515, 0.290269, 0.304213, 0.318361, 0.332705, 0.347232, 0.361926, 0.376772, 0.391683, 0.406594, 0.421539, 0.436517, 0.451584, 0.466782, 0.482147, 0.497738, 0.513606, 0.529826, 0.54644, 0.563426, 0.580726, 0.59829, 0.616053, 0.633948, 0.651901, 0.669824, 0.687632, 0.705224, 0.722773, 0.740483, 0.758273, 0.776083, 0.793832, 0.811436, 0.828822, 0.845879, 0.862525, 0.878655, 0.894208, 0.909206, 0.923672, 0.937638, 0.951162, 0.964283, 0.977068, 0.98959, 1.00191, 1.01416, 1.0265, 1.0388, 1.051, 1.0629, 1.0743, 1.0852, 1.0952, 1.1042, 1.112, 1.11852, 1.1238, 1.128, 1.1311, 1.1332, 1.1343, 1.1343, 1.1333, 1.1312, 1.1281, 1.12399, 1.1189, 1.1129, 1.1059, 1.098, 1.0891, 1.0792, 1.0684, 1.0567, 1.044, 1.03048, 1.016, 1.0008, 0.98479, 0.96808, 0.95074, 0.9328, 0.91434, 0.89539, 0.87603, 0.856297, 0.83635, 0.81629, 0.79605, 0.77561, 0.75493, 0.73399, 0.71278, 0.69129, 0.66952, 0.647467, 0.62511, 0.60252, 0.57989, 0.55737, 0.53511, 0.51324, 0.49186, 0.47108, 0.45096, 0.431567, 0.41287, 0.39475, 0.37721, 0.36019, 0.34369, 0.32769, 0.31217, 0.29711, 0.2825, 0.268329, 0.25459, 0.2413, 0.22848, 0.21614, 0.2043, 0.19295, 0.18211, 0.17177, 0.16192, 0.152568, 0.14367, 0.1352, 0.12713, 0.11948, 0.11221, 0.10531, 0.098786, 0.09261, 0.086773, 0.0812606, 0.076048, 0.071114, 0.066454, 0.062062, 0.05793, 0.05405, 0.050412, 0.047006, 0.043823, 0.0408508, 0.038072, 0.035468, 0.033031, 0.030753, 0.028623, 0.026635, 0.024781, 0.023052, 0.021441, 0.0199413, 0.018544, 0.017241, 0.016027, 0.014896, 0.013842, 0.012862, 0.011949, 0.0111, 0.010311, 0.00957688, 0.008894, 0.0082581, 0.0076664, 0.0071163, 0.0066052, 0.0061306, 0.0056903, 0.0052819, 0.0049033, 0.00455263, 0.0042275, 0.0039258, 0.0036457, 0.0033859, 0.0031447, 0.0029208, 0.002713, 0.0025202, 0.0023411, 0.00217496, 0.0020206, 0.0018773, 0.0017441, 0.0016205, 0.0015057, 0.0013992, 0.0013004, 0.0012087, 0.0011236, 0.00104476, 0.00097156, 0.0009036, 0.00084048, 0.00078187, 0.00072745, 0.0006769, 0.00062996, 0.00058637, 0.00054587, 0.000508258, 0.0004733, 0.0004408, 0.00041058, 0.00038249, 0.00035638, 0.00033211, 0.00030955, 0.00028858, 0.00026909, 0.000250969, 0.00023413, 0.00021847, 0.00020391, 0.00019035, 0.00017773, 0.00016597, 0.00015502, 0.0001448, 0.00013528, 0.00012639, 0.0001181, 0.00011037, 0.00010315, 0.000096427, 0.000090151, 0.000084294, 0.00007883, 0.000073729, 0.000068969, 6.45258E-05, 0.000060376, 0.0000565, 0.00005288, 0.000049498, 0.000046339, 0.000043389, 0.000040634, 0.00003806, 0.000035657, 3.34117E-05, 0.000031315, 0.000029355, 0.000027524, 0.000025811, 0.000024209, 0.000022711, 0.000021308, 0.000019994, 0.000018764, 1.76115E-05, 0.000016532, 0.000015521, 0.000014574, 0.000013686, 0.000012855, 0.000012075, 0.000011345, 0.000010659, 0.000010017, 9.41363E-06, 8.8479E-06, 8.3171E-06, 0.000007819, 7.3516E-06, 0.000006913, 6.5015E-06, 6.1153E-06, 5.7529E-06, 5.4127E-06, 5.09347E-06, 4.7938E-06, 4.5125E-06, 4.2483E-06, 4.0002E-06, 3.7671E-06, 0.000003548, 3.3421E-06, 3.1485E-06, 2.9665E-06, 2.79531E-06, 2.6345E-06, 2.4834E-06, 2.3414E-06, 2.2078E-06, 0.000002082, 1.9636E-06, 1.8519E-06, 1.7465E-06, 1.6471E-06, 1.55314E-06 };
116 
118  static double CIE1964Y[471] = { 1.3398E-08, 2.0294E-08, 3.056E-08, 4.574E-08, 6.805E-08, 1.0065E-07, 1.4798E-07, 2.1627E-07, 3.142E-07, 4.537E-07, 6.511E-07, 9.288E-07, 1.3175E-06, 1.8572E-06, 0.000002602, 0.000003625, 0.000005019, 0.000006907, 0.000009449, 0.000012848, 0.000017364, 0.000023327, 0.00003115, 0.00004135, 0.00005456, 0.00007156, 0.0000933, 0.00012087, 0.00015564, 0.0001992, 0.0002534, 0.0003202, 0.0004024, 0.0005023, 0.0006232, 0.0007685, 0.0009417, 0.0011478, 0.0013903, 0.001674, 0.0020044, 0.002386, 0.002822, 0.003319, 0.00388, 0.004509, 0.005209, 0.005985, 0.006833, 0.007757, 0.008756, 0.009816, 0.010918, 0.012058, 0.013237, 0.014456, 0.015717, 0.017025, 0.018399, 0.019848, 0.021391, 0.022992, 0.024598, 0.026213, 0.027841, 0.029497, 0.031195, 0.032927, 0.034738, 0.036654, 0.038676, 0.040792, 0.042946, 0.045114, 0.047333, 0.049602, 0.051934, 0.054337, 0.056822, 0.059399, 0.062077, 0.064737, 0.067285, 0.069764, 0.072218, 0.074704, 0.077272, 0.079979, 0.082874, 0.086, 0.089456, 0.092947, 0.096275, 0.099535, 0.102829, 0.106256, 0.109901, 0.113835, 0.118167, 0.122932, 0.128201, 0.133457, 0.138323, 0.143042, 0.147787, 0.152761, 0.158102, 0.163941, 0.170362, 0.177425, 0.18519, 0.193025, 0.200313, 0.207156, 0.213644, 0.21994, 0.22617, 0.232467, 0.239025, 0.245997, 0.253589, 0.261876, 0.270643, 0.279645, 0.288694, 0.297665, 0.306469, 0.315035, 0.323335, 0.331366, 0.339133, 0.34786, 0.358326, 0.370001, 0.382464, 0.395379, 0.408482, 0.421588, 0.434619, 0.447601, 0.460777, 0.47434, 0.4882, 0.50234, 0.51674, 0.53136, 0.54619, 0.56118, 0.57629, 0.5915, 0.606741, 0.62215, 0.63783, 0.65371, 0.66968, 0.68566, 0.70155, 0.71723, 0.73257, 0.74746, 0.761757, 0.77534, 0.78822, 0.80046, 0.81214, 0.82333, 0.83412, 0.8446, 0.85487, 0.86504, 0.875211, 0.88537, 0.89537, 0.90515, 0.91465, 0.92381, 0.93255, 0.94081, 0.94852, 0.9556, 0.961988, 0.96754, 0.97223, 0.97617, 0.97946, 0.9822, 0.98452, 0.98652, 0.98832, 0.99002, 0.991761, 0.99353, 0.99523, 0.99677, 0.99809, 0.99911, 0.99977, 1, 0.99971, 0.99885, 0.99734, 0.99526, 0.99274, 0.98975, 0.9863, 0.98238, 0.97798, 0.97311, 0.96774, 0.96189, 0.955552, 0.948601, 0.940981, 0.932798, 0.924158, 0.915175, 0.905954, 0.896608, 0.887249, 0.877986, 0.868934, 0.860164, 0.851519, 0.842963, 0.834393, 0.825623, 0.816764, 0.807544, 0.797947, 0.787893, 0.777405, 0.76649, 0.755309, 0.743845, 0.73219, 0.720353, 0.708281, 0.696055, 0.683621, 0.671048, 0.658341, 0.645545, 0.632718, 0.619815, 0.606887, 0.593878, 0.580781, 0.567653, 0.55449, 0.541228, 0.527963, 0.514634, 0.501363, 0.488124, 0.474935, 0.461834, 0.448823, 0.435917, 0.423153, 0.410526, 0.398057, 0.385835, 0.373951, 0.362311, 0.350863, 0.339554, 0.328309, 0.317118, 0.305936, 0.294737, 0.283493, 0.272222, 0.26099, 0.249877, 0.238946, 0.228254, 0.217853, 0.20778, 0.198072, 0.188748, 0.179828, 0.171285, 0.163059, 0.155151, 0.147535, 0.140211, 0.13317, 0.1264, 0.119892, 0.11364, 0.107633, 0.10187, 0.096347, 0.091063, 0.08601, 0.081187, 0.076583, 0.072198, 0.068024, 0.064052, 0.060281, 0.056697, 0.053292, 0.050059, 0.046998, 0.044096, 0.041345, 0.0387507, 0.0362978, 0.0339832, 0.0318004, 0.0297395, 0.0277918, 0.0259551, 0.0242263, 0.0226017, 0.0210779, 0.0196505, 0.0183153, 0.0170686, 0.0159051, 0.0148183, 0.0138008, 0.0128495, 0.0119607, 0.0111303, 0.0103555, 0.0096332, 0.0089599, 0.0083324, 0.0077488, 0.0072046, 0.0066975, 0.0062251, 0.005785, 0.0053751, 0.0049941, 0.0046392, 0.0043093, 0.0040028, 0.00371774, 0.00345262, 0.00320583, 0.00297623, 0.00276281, 0.00256456, 0.00238048, 0.00220971, 0.00205132, 0.00190449, 0.00176847, 0.00164236, 0.00152535, 0.00141672, 0.00131595, 0.00122239, 0.00113555, 0.00105494, 0.00098014, 0.00091066, 0.00084619, 0.00078629, 0.00073068, 0.00067899, 0.00063101, 0.00058644, 0.00054511, 0.00050672, 0.00047111, 0.00043805, 0.00040741, 0.000378962, 0.000352543, 0.000328001, 0.000305208, 0.000284041, 0.000264375, 0.000246109, 0.000229143, 0.000213376, 0.00019873, 0.000185115, 0.000172454, 0.000160678, 0.00014973, 0.00013955, 0.000130086, 0.00012129, 0.000113106, 0.000105501, 0.000098428, 0.000091853, 0.000085738, 0.000080048, 0.000074751, 0.000069819, 0.000065222, 0.000060939, 0.000056942, 0.000053217, 0.000049737, 0.000046491, 0.000043464, 0.000040635, 0.000038, 3.55405E-05, 3.32448E-05, 3.11006E-05, 0.000029099, 2.72307E-05, 0.000025486, 2.38561E-05, 2.23332E-05, 2.09104E-05, 1.95808E-05, 1.83384E-05, 1.71777E-05, 1.60934E-05, 0.00001508, 1.41336E-05, 0.000013249, 1.24226E-05, 1.16499E-05, 1.09277E-05, 1.02519E-05, 9.6196E-06, 9.0281E-06, 0.000008474, 7.9548E-06, 7.4686E-06, 7.0128E-06, 6.5858E-06, 6.1857E-06, 5.8107E-06, 0.000005459, 5.1298E-06, 4.8206E-06, 4.5312E-06, 4.2591E-06, 4.0042E-06, 3.76473E-06, 3.53995E-06, 3.32914E-06, 3.13115E-06, 2.94529E-06, 2.77081E-06, 2.60705E-06, 2.45329E-06, 2.30894E-06, 2.17338E-06, 2.04613E-06, 1.92662E-06, 1.8144E-06, 1.70895E-06, 1.60988E-06, 1.51677E-06, 1.42921E-06, 1.34686E-06, 1.26945E-06, 1.19662E-06, 1.12809E-06, 1.06368E-06, 1.00313E-06, 9.4622E-07, 8.9263E-07, 8.4216E-07, 7.9464E-07, 7.4978E-07, 7.0744E-07, 6.6748E-07, 6.297E-07 };
119 
121  static double CIE1964Z[471] = { 5.35027E-07, 8.1072E-07, 1.2212E-06, 1.8287E-06, 2.7222E-06, 4.0283E-06, 5.9257E-06, 8.6651E-06, 0.000012596, 0.000018201, 2.61437E-05, 0.00003733, 0.000052987, 0.000074764, 0.00010487, 0.00014622, 0.00020266, 0.00027923, 0.00038245, 0.00052072, 0.000704776, 0.00094823, 0.0012682, 0.0016861, 0.0022285, 0.0029278, 0.0038237, 0.0049642, 0.0064067, 0.0082193, 0.0104822, 0.013289, 0.016747, 0.02098, 0.026127, 0.032344, 0.039802, 0.048691, 0.05921, 0.071576, 0.0860109, 0.10274, 0.122, 0.14402, 0.16899, 0.19712, 0.22857, 0.26347, 0.3019, 0.34387, 0.389366, 0.43797, 0.48922, 0.5429, 0.59881, 0.65676, 0.71658, 0.77812, 0.84131, 0.90611, 0.972542, 1.0389, 1.1031, 1.1651, 1.2249, 1.2825, 1.3382, 1.3926, 1.4461, 1.4994, 1.55348, 1.6072, 1.6589, 1.7082, 1.7548, 1.7985, 1.8392, 1.8766, 1.9105, 1.9408, 1.96728, 1.9891, 2.0057, 2.0174, 2.0244, 2.0273, 2.0264, 2.0223, 2.0153, 2.006, 1.9948, 1.9814, 1.9653, 1.9464, 1.9248, 1.9007, 1.8741, 1.8451, 1.8139, 1.7806, 1.74537, 1.7091, 1.6723, 1.6347, 1.5956, 1.5549, 1.5122, 1.4673, 1.4199, 1.37, 1.31756, 1.2624, 1.205, 1.1466, 1.088, 1.0302, 0.97383, 0.91943, 0.86746, 0.81828, 0.772125, 0.72829, 0.68604, 0.64553, 0.60685, 0.57006, 0.53522, 0.50234, 0.4714, 0.44239, 0.415254, 0.390024, 0.366399, 0.344015, 0.322689, 0.302356, 0.283036, 0.264816, 0.247848, 0.232318, 0.218502, 0.205851, 0.193596, 0.181736, 0.170281, 0.159249, 0.148673, 0.138609, 0.129096, 0.120215, 0.112044, 0.10471, 0.098196, 0.092361, 0.087088, 0.082248, 0.077744, 0.073456, 0.069268, 0.06506, 0.060709, 0.056457, 0.052609, 0.049122, 0.045954, 0.04305, 0.040368, 0.037839, 0.035384, 0.032949, 0.030451, 0.028029, 0.025862, 0.02392, 0.022174, 0.020584, 0.019127, 0.01774, 0.016403, 0.015064, 0.013676, 0.012308, 0.011056, 0.009915, 0.008872, 0.007918, 0.00703, 0.006223, 0.005453, 0.004714, 0.003988, 0.003289, 0.002646, 0.002063, 0.001533, 0.001091, 0.000711, 0.000407, 0.000184, 0.000047, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
122 
123 #ifdef USE_C11_MAPS
124 
130  static unordered_map<string, vector<double> > gelsCoarse = {
131  { "N/C", { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } },
132  // 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740
133  { "R01", { 0.46, 0.59, 0.62, 0.58, 0.47, 0.36, 0.29, 0.27, 0.30, 0.38, 0.50, 0.69, 0.82, 0.86, 0.88, 0.88, 0.88, 0.88, 0.88, 0.88} },
134  { "R02", { 0.69, 0.73, 0.71, 0.65, 0.56, 0.49, 0.47, 0.48, 0.54, 0.68, 0.74, 0.80, 0.84, 0.85, 0.85, 0.86, 0.86, 0.86, 0.86, 0.86} },
135  { "R09", { 0.58, 0.61, 0.55, 0.47, 0.39, 0.35, 0.38, 0.48, 0.57, 0.65, 0.72, 0.81, 0.87, 0.88, 0.88, 0.88, 0.88, 0.88, 0.88, 0.88} },
136  { "R11", { 0.55, 0.49, 0.33, 0.22, 0.15, 0.14, 0.21, 0.43, 0.64, 0.75, 0.80, 0.85, 0.87, 0.88, 0.88, 0.88, 0.88, 0.88, 0.88, 0.88} },
137  { "R313", { 0.14, 0.05, 0.02, 0.02, 0.05, 0.12, 0.22, 0.37, 0.55, 0.71, 0.82, 0.87, 0.88, 0.88, 0.88, 0.88, 0.89, 0.88, 0.88, 0.89} },
138  { "R15", { 0.10, 0.03, 0.01, 0.01, 0.01, 0.02, 0.04, 0.10, 0.27, 0.51, 0.75, 0.86, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89, 0.89} },
139  { "R16", { 0.60, 0.67, 0.60, 0.46, 0.30, 0.19, 0.15, 0.19, 0.29, 0.58, 0.74, 0.81, 0.85, 0.85, 0.85, 0.85, 0.86, 0.85, 0.86, 0.86} },
140  { "R18", { 0.38, 0.49, 0.48, 0.36, 0.22, 0.15, 0.12, 0.14, 0.20, 0.41, 0.53, 0.68, 0.76, 0.78, 0.78, 0.78, 0.78, 0.78, 0.79, 0.79} },
141  { "R19", { 0.01, 0.02, 0.01, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.15, 0.54, 0.78, 0.84, 0.86, 0.87, 0.87, 0.87, 0.87} },
142  { "R26", { 0.13, 0.12, 0.03, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.08, 0.50, 0.73, 0.80, 0.33, 0.84, 0.84, 0.85} },
143  { "R27", { 0.01, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.02, 0.11, 0.33, 0.59, 0.76, 0.82, 0.85, 0.85} },
144  { "R332", { 0.15, 0.50, 0.60, 0.50, 0.30, 0.12, 0.04, 0.03, 0.04, 0.06, 0.16, 0.30, 0.60, 0.72, 0.85, 0.84, 0.83, 0.84, 0.85, 0.86} },
145  { "R37", { 0.62, 0.70, 0.73, 0.74, 0.72, 0.67, 0.68, 0.52, 0.45, 0.43, 0.46, 0.53, 0.70, 0.72, 0.79, 0.81, 0.84, 0.85, 0.85, 0.85} },
146  { "R39", { 0.22, 0.45, 0.52, 0.47, 0.29, 0.11, 0.03, 0.00, 0.00, 0.00, 0.00, 0.01, 0.15, 0.43, 0.50, 0.61, 0.75, 0.80, 0.82, 0.83} },
147  { "R44", { 0.53, 0.68, 0.71, 0.70, 0.62, 0.46, 0.31, 0.18, 0.11, 0.10, 0.13, 0.21, 0.56, 0.79, 0.82, 0.84, 0.84, 0.85, 0.85, 0.85} },
148  { "R51", { 0.68, 0.75, 0.78, 0.78, 0.77, 0.72, 0.67, 0.59, 0.53, 0.48, 0.48, 0.48, 0.56, 0.59, 0.58, 0.67, 0.80, 0.84, 0.85, 0.85} },
149  { "R52", { 0.43, 0.61, 0.72, 0.73, 0.70, 0.64, 0.55, 0.47, 0.37, 0.30, 0.26, 0.25, 0.31, 0.40, 0.49, 0.69, 0.82, 0.86, 0.87, 0.88} },
150  { "R360", { 0.52, 0.59, 0.65, 0.70, 0.71, 0.65, 0.62, 0.57, 0.51, 0.50, 0.45, 0.46, 0.42, 0.38, 0.35, 0.34, 0.42, 0.59, 0.74, 0.81} },
151  { "R65", { 0.48, 0.50, 0.55, 0.63, 0.75, 0.78, 0.74, 0.63, 0.50, 0.32, 0.22, 0.11, 0.11, 0.10, 0.09, 0.34, 0.70, 0.84, 0.87, 0.88} },
152  { "R66", { 0.44, 0.59, 0.70, 0.76, 0.81, 0.83, 0.83, 0.81, 0.77, 0.71, 0.63, 0.53, 0.46, 0.42, 0.41, 0.41, 0.29, 0.64, 0.73, 0.78} },
153  { "R75", { 0.27, 0.25, 0.22, 0.24, 0.36, 0.47, 0.49, 0.42, 0.29, 0.14, 0.06, 0.02, 0.01, 0.01, 0.00, 0.02, 0.05, 0.08, 0.20, 0.44} },
154  { "R85", { 0.03, 0.03, 0.04, 0.08, 0.25, 0.37, 0.28, 0.12, 0.03, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.14, 0.50, 0.76, 0.86} },
155  { "R385", { 0.01, 0.01, 0.01, 0.05, 0.26, 0.38, 0.19, 0.04, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.14, 0.57, 0.79, 0.86} },
156  { "R88", { 0.54, 0.57, 0.47, 0.36, 0.23, 0.35, 0.70, 0.77, 0.78, 0.77, 0.74, 0.70, 0.64, 0.58, 0.52, 0.48, 0.46, 0.51, 0.65, 0.78} },
157  { "R89", { 0.31, 0.25, 0.12, 0.06, 0.06, 0.08, 0.16, 0.36, 0.53, 0.52, 0.39, 0.23, 0.13, 0.06, 0.03, 0.02, 0.01, 0.02, 0.07, 0.28} },
158  { "R397", { 0.31, 0.41, 0.57, 0.58, 0.54, 0.58, 0.68, 0.64, 0.60, 0.60, 0.59, 0.64, 0.65, 0.62, 0.60, 0.58, 0.60, 0.68, 0.77, 0.83} },
159  { "R98", { 0.35, 0.39, 0.33, 0.22, 0.15, 0.19, 0.32, 0.28, 0.20, 0.21, 0.18, 0.25, 0.27, 0.22, 0.20, 0.18, 0.24, 0.43, 0.65, 0.78} },
160  { "R3204", {0.52, 0.59, 0.65, 0.70, 0.71, 0.68, 0.62, 0.57, 0.51, 0.50, 0.45, 0.46, 0.52, 0.38, 0.35, 0.34, 0.42, 0.59, 0.74, 0.81} },
161  { "R4415", {0.61, 0.65, 0.59, 0.47, 0.40, 0.50, 0.57, 0.79, 0.80, 0.80, 0.77, 0.74, 0.69, 0.62, 0.56, 0.52, 0.50, 0.54, 0.67, 0.79} },
162  { "L017", { 0.04, 0.15, 0.17, 0.13, 0.10, 0.07, 0.08, 0.10, 0.14, 0.18, 0.14, 0.32, 0.33, 0.36, 0.40, 0.23, 0.38, 0.55, 0.78, 0.80} },
163  { "L046", { 0.05, 0.10, 0.10, 0.07, 0.06, 0.06, 0.03, 0.02, 0.00, 0.00, 0.00, 0.02, 0.17, 0.29, 0.40, 0.70, 0.82, 0.85, 0.82, 0.85} },
164  { "L048", { 0.20, 0.36, 0.38, 0.40, 0.44, 0.44, 0.27, 0.20, 0.13, 0.08, 0.02, 0.15, 0.31, 0.32, 0.40, 0.63, 0.80, 0.84, 0.83, 0.82} },
165  { "L049", { 0.07, 0.11, 0.23, 0.33, 0.35, 0.20, 0.08, 0.04, 0.01, 0.00, 0.00, 0.00, 0.11, 0.16, 0.30, 0.70, 0.85, 0.83, 0.85, 0.90} },
166  { "L053", { 0.65, 0.70, 0.74, 0.76, 0.80, 0.81, 0.79, 0.75, 0.65, 0.62, 0.54, 0.56, 0.59, 0.55, 0.63, 0.82, 0.85, 0.86, 0.84, 0.90} },
167  { "L088", { 0.20, 0.06, 0.04, 0.02, 0.01, 0.12, 0.77, 0.83, 0.88, 0.85, 0.76, 0.68, 0.55, 0.47, 0.50, 0.37, 0.50, 0.62, 0.82, 0.83} },
168  { "L135", { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.15, 0.43, 0.64, 0.68, 0.70, 0.73, 0.76, 0.79, 0.82, 0.84} },
169  { "L158", { 0.01, 0.01, 0.02, 0.01, 0.00, 0.00, 0.00, 0.01, 0.03, 0.10, 0.35, 0.60, 0.77, 0.80, 0.83, 0.82, 0.84, 0.85, 0.88, 0.90} },
170  { "L198", { 0.00, 0.07, 0.12, 0.22, 0.17, 0.12, 0.08, 0.04, 0.02, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.02, 0.01, 0.13, 0.40, 0.60} },
171  { "L201", { 0.00, 0.00, 0.60, 0.70, 0.75, 0.77, 0.74, 0.63, 0.52, 0.33, 0.23, 0.35, 0.28, 0.24, 0.27, 0.18, 0.28, 0.44, 0.00, 0.00} }, // Spectrum not provided outside of 400-700nm
172  { "L202", { 0.00, 0.00, 0.73, 0.82, 0.85, 0.81, 0.76, 0.70, 0.55, 0.48, 0.55, 0.47, 0.43, 0.47, 0.36, 0.30, 0.46, 0.60, 0.00, 0.00} }, // Spectrum not provided outside of 400-700nm
173  { "L203", { 0.00, 0.00, 0.80, 0.84, 0.86, 0.84, 0.85, 0.78, 0.75, 0.63, 0.69, 0.65, 0.63, 0.63, 0.61, 0.54, 0.60, 0.73, 0.00, 0.00} }, // Spectrum not provided outside of 400-700nm
174  { "L244", { 0.00, 0.00, 0.40, 0.40, 0.40, 0.46, 0.62, 0.75, 0.82, 0.85, 0.80, 0.71, 0.62, 0.57, 0.58, 0.43, 0.89, 0.73, 0.00, 0.00} }, // Spectrum not provided outisde of 400-700nm
175  { "L323", { 0.03, 0.13, 0.18, 0.19, 0.18, 0.23, 0.62, 0.72, 0.67, 0.49, 0.20, 0.08, 0.02, 0.00, 0.01, 0.00, 0.02, 0.08, 0.23, 0.40} },
176  { "L525", { 0.00, 0.00, 0.43, 0.62, 0.83, 0.88, 0.62, 0.43, 0.32, 0.15, 0.10, 0.06, 0.08, 0.06, 0.14, 0.65, 0.83, 0.89, 0.00, 0.00} },
177  { "L707", { 0.06, 0.13, 0.16, 0.23, 0.42, 0.38, 0.17, 0.05, 0.02, 0.01, 0.00, 0.00, 0.00, 0.00, 0.00, 0.20, 0.70, 0.82, 0.85, 0.88} },
178  { "L740", { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.02, 0.10, 0.13, 0.03, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.10, 0.20} },
179  { "L789", { 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.01, 0.08, 0.10, 0.14, 0.15, 0.08, 0.25, 0.43, 0.70} },
180  { "L797", { 0.05, 0.15, 0.18, 0.24, 0.30, 0.17, 0.07, 0.02, 0.00, 0.00, 0.00, 0.00, 0.04, 0.08, 0.10, 0.65, 0.80, 0.83, 0.83, 0.83} },
181  { "G385", { 0.60, 0.72, 0.62, 0.44, 0.36, 0.24, 0.21, 0.22, 0.38, 0.55, 0.65, 0.82, 0.84, 0.84, 0.84, 0.85, 0.85, 0.85, 0.85, 0.85} },
182  // 360 380 400 420 440 460 480 500 520 540 560 580 600 620 640 660 680 700 720 740
183  { "G420", { 0.38, 0.40, 0.00, 0.00, 0.00, 0.00, 0.05, 0.50, 0.52, 0.60, 0.62, 0.80, 0.84, 0.84, 0.84, 0.83, 0.84, 0.84, 0.84, 0.84} },
184  { "G670", { 0.20, 0.23, 0.03, 0.00, 0.00, 0.00, 0.02, 0.32, 0.20, 0.09, 0.03, 0.00, 0.00, 0.00, 0.00, 0.00, 0.03, 0.62, 0.74, 0.78} },
185  { "G840", { 0.58, 0.72, 0.76, 0.78, 0.74, 0.68, 0.61, 0.52, 0.40, 0.25, 0.18, 0.09, 0.06, 0.08, 0.04, 0.02, 0.23, 0.80, 0.82, 0.84} },
186  { "G815", { 0.45, 0.60, 0.68, 0.72, 0.74, 0.70, 0.67, 0.60, 0.42, 0.25, 0.20, 0.10, 0.10, 0.08, 0.06, 0.18, 0.60, 0.78, 0.81, 0.82} },
187  { "G820", { 0.60, 0.70, 0.77, 0.79, 0.79, 0.78, 0.76, 0.68, 0.60, 0.55, 0.50, 0.47, 0.42, 0.40, 0.35, 0.40, 0.53, 0.57, 0.72, 0.83} },
188  { "G841", { 0.43, 0.57, 0.63, 0.68, 0.66, 0.60, 0.50, 0.38, 0.20, 0.16, 0.08, 0.02, 0.02, 0.02, 0.01, 0.03, 0.38, 0.74, 0.81, 0.82} },
189  { "G860", { 0.50, 0.60, 0.72, 0.75, 0.72, 0.68, 0.60, 0.52, 0.40, 0.37, 0.26, 0.22, 0.21, 0.21, 0.17, 0.20, 0.40, 0.52, 0.63, 0.80} },
190  { "G940", { 0.45, 0.62, 0.72, 0.76, 0.75, 0.62, 0.52, 0.38, 0.22, 0.18, 0.18, 0.18, 0.16, 0.20, 0.20, 0.18, 0.23, 0.80, 0.82, 0.84} },
191  { "G945", { 0.20, 0.40, 0.54, 0.50, 0.40, 0.25, 0.19, 0.10, 0.04, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.15, 0.63, 0.80, 0.86} }
192  };
193 
197  static unordered_map<string, double> gelsTrans = {
198  { "N/C", 1 },
199  { "R01", 0.56 },
200  { "R02", 0.78 },
201  { "R09", 0.74 },
202  { "R11", 0.82 },
203  { "R313", 0.76 },
204  { "R15", 0.65 },
205  { "R16", 0.68 },
206  { "R18", 0.56 },
207  { "R19", 0.20 },
208  { "R26", 0.12 },
209  { "R27", 0.04 },
210  { "R332", 0.38 },
211  { "R37", 0.56 },
212  { "R39", 0.10 },
213  { "R44", 0.26 },
214  { "R51", 0.54 },
215  { "R52", 0.26 },
216  { "R360", 0.52 },
217  { "R65" , 0.35 },
218  { "R66", 0.67 },
219  { "R75", 0.11 },
220  { "R85", 0.03 },
221  { "R385", 0.04 },
222  { "R88", 0.82 },
223  { "R89", 0.45 },
224  { "R397", 0.70 },
225  { "R98", 0.25 },
226  { "R3204",0.85 },
227  { "R4415",0.67 },
228  { "L017", 0.219 },
229  { "L046", 0.06 },
230  { "L048", 0.167 },
231  { "L049", 0.058 },
232  { "L053", 0.605 },
233  { "L088", 0.698 },
234  { "L135", 0.265 },
235  { "L158", 0.299 },
236  { "L198", 0.011 },
237  { "L201", 0.35 },
238  { "L202", 0.532 },
239  { "L203", 0.705 },
240  { "L244", 0.74 },
241  { "L323", 0.32 },
242  { "L525", 0.135 },
243  { "L707", 0.02 },
244  { "L740", 0.037 },
245  { "L789", 0.019 },
246  { "L797", 0.028 },
247  { "G385", 0.77 },
248  { "G420", 0.71 },
249  { "G670", 0.07 },
250  { "G815", 0.20 },
251  { "G820", 0.50 },
252  { "G840", 0.19 },
253  { "G841", 0.12 },
254  { "G860", 0.28 },
255  { "G940", 0.20 },
256  { "G945", 0.02 }
257  };
258 #endif
259 
261  namespace ColorUtils {
270  double blackbodySPD(unsigned int nm, unsigned int temp);
271 
279  Eigen::Vector3d getApproxColor(string gel, float intens = 1.0f);
280 
284  Eigen::Vector3d getXYZTemp(unsigned int temp);
285 
291  Eigen::Vector3d getScaledColor(string gel, float intens = 1.0f);
292 
301  Eigen::Vector3d convXYZtoRGB(Eigen::Vector3d color, RGBColorSpace cs = sRGB);
302 
306  Eigen::Vector3d convRGBtoXYZ(Eigen::Vector3d rgb, RGBColorSpace cs = sRGB);
307  Eigen::Vector3d convRGBtoXYZ(double r, double g, double b, RGBColorSpace cs = sRGB);
308 
312  Eigen::Vector3d convXYZtoxyY(Eigen::Vector3d color);
313 
317  Eigen::Vector3d convXYZtoLab(Eigen::Vector3d xyz, ReferenceWhite rw = D65);
318  Eigen::Vector3d convXYZtoLab(Eigen::Vector3d xyz, Eigen::Vector3d rw);
319 
321  double labf(double val);
322 
328  Eigen::Vector2d convxytouv(Eigen::Vector3d xyY);
329 
333  Eigen::Vector2d convuvtoxy(Eigen::Vector2d uv);
334 
341  Eigen::Vector3d convXYZtoLUV(Eigen::Vector3d XYZ, ReferenceWhite rw = D50);
342 
346  Eigen::Vector3d convXYZtoLUV(Eigen::Vector3d XYZ, Eigen::Vector3d rw);
347 
353  Eigen::Vector3d convLUVtoXYZ(Eigen::Vector3d LUV, ReferenceWhite rw = D50);
354 
358  Eigen::Vector3d convLUVtoXYZ(Eigen::Vector3d LUV, Eigen::Vector3d rw);
359 
366  Eigen::Vector3d normalizeRGB(Eigen::Vector3d rgb);
367 
371  double clamp(double val, double min, double max);
372 
374  double sRGBtoXYZCompand(double val);
375 
377  double XYZtosRGBCompand(double val);
378 
382  double getTotalTrans(string gel);
383  }
384 }
385 
386 #endif
static unordered_map< string, vector< double > > gelsCoarse
A list of gels and samples of their transmission rates at 20nm intervals starting at 360nm and ending...
Definition: LumiverseColorLib.h:130
static double CIE1964X[471]
CMF for X coordinate using the CIE 1964 CMF.
Definition: LumiverseColorLib.h:115
static double CIE2012Y[471]
CMF for Y coordinate using the proposed CIE 2012 CMF.
Definition: LumiverseColorLib.h:109
Definition: Layer.h:437
Definition: LumiverseColorLib.h:30
RGBColorSpace
Selects a RGB color space to use in color conversion functions.
Definition: LumiverseColorLib.h:29
static double CIE1964Y[471]
CMF for Y coordinate using the CIE 1964 CMF.
Definition: LumiverseColorLib.h:118
static unordered_map< int, Eigen::Vector3d > refWhites
Reference White XYZ coordinates for standard illuminants.
Definition: LumiverseColorLib.h:59
static double CIE2012Z[471]
CMF for Z coordinate using the proposed CIE 2012 CMF.
Definition: LumiverseColorLib.h:112
Contains functions for logging information to console or file.
static unordered_map< int, Eigen::Matrix3d > RGBToXYZ
RGB to XYZ matrices for color calculations.
Definition: LumiverseColorLib.h:42
Contains all core Lumiverse functions and variables.
Definition: Device.cpp:2
static unordered_map< int, ReferenceWhite > ColorSpaceRefWhite
Maps Color space to the Reference White it uses.
Definition: LumiverseColorLib.h:53
static unordered_map< string, double > gelsTrans
A list of gel transmission percentages.
Definition: LumiverseColorLib.h:197
static double CIE1964Z[471]
CMF for Z coordinate using the CIE 1964 CMF.
Definition: LumiverseColorLib.h:121
static double CIE2012X[471]
CMF for X coordinate using the proposed CIE 2012 CMF.
Definition: LumiverseColorLib.h:106