From d22402bdfa591b9628d920f3e69663b69a98a800 Mon Sep 17 00:00:00 2001 From: Andrew Hundt Date: Fri, 28 Jul 2017 03:11:57 -0700 Subject: [PATCH] color.cc constexpr std::sqrt is not ISO C++ (#432) --- cartographer/io/color.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cartographer/io/color.cc b/cartographer/io/color.cc index 747225c..34a4deb 100644 --- a/cartographer/io/color.cc +++ b/cartographer/io/color.cc @@ -29,7 +29,6 @@ namespace { constexpr float kInitialHue = 0.69f; constexpr float kSaturation = 0.85f; constexpr float kValue = 0.77f; -constexpr float kGoldenRatioConjugate = (std::sqrt(5.f) - 1.f) / 2.f; FloatColor HsvToRgb(const float h, const float s, const float v) { const float h_6 = (h == 1.f) ? 0.f : 6 * h; @@ -63,6 +62,7 @@ FloatColor GetColor(int id) { CHECK_GE(id, 0); // Uniform color sampling using the golden ratio from // http://martin.ankerl.com/2009/12/09/how-to-create-random-colors-programmatically/ + constexpr float kGoldenRatioConjugate = 0.6180339887498949f; const float hue = std::fmod(kInitialHue + kGoldenRatioConjugate * id, 1.f); return HsvToRgb(hue, kSaturation, kValue); }