22 #include "glog/logging.h" 29 constexpr
float kInitialHue = 0.69f;
30 constexpr
float kSaturation = 0.85f;
31 constexpr
float kValue = 0.77f;
33 FloatColor HsvToRgb(
const float h,
const float s,
const float v) {
34 const float h_6 = (h == 1.f) ? 0.f : 6 * h;
35 const int h_i = std::floor(h_6);
36 const float f = h_6 - h_i;
38 const float p = v * (1.f - s);
39 const float q = v * (1.f - f * s);
40 const float t = v * (1.f - (1.f - f) * s);
44 }
else if (h_i == 1) {
46 }
else if (h_i == 2) {
48 }
else if (h_i == 3) {
50 }
else if (h_i == 4) {
52 }
else if (h_i == 5) {
55 return {{0.f, 0.f, 0.f}};
65 constexpr
float kGoldenRatioConjugate = 0.6180339887498949f;
66 const float hue = std::fmod(kInitialHue + kGoldenRatioConjugate *
id, 1.f);
67 return HsvToRgb(hue, kSaturation, kValue);
FloatColor GetColor(int id)
std::array< float, 3 > FloatColor