Green-Red-Blue-White.h
Go to the documentation of this file.
1 /**
2  * This file was automatically created with "create_c++_header.sh".
3  * Do not edit manually.
4  */
5 #pragma once
6 #include "../../colormap.h"
7 
8 namespace colormap
9 {
10  namespace IDL
11  {
12 
13  class GreenRedBlueWhite : public Colormap
14  {
15  private:
16  class Wrapper : public WrapperBase
17  {
18  public:
19 #ifdef float
20 #error "TODO"
21 #endif
22 #define float local_real_t
23 #include "../../../../shaders/glsl/IDL_Green-Red-Blue-White.frag"
24 #undef float
25  };
26 
27  public:
28  Color getColor(double x) const override
29  {
30  Wrapper w;
31  vec4 c = w.colormap(x);
32  Color result;
33  result.r = std::max(0.0, std::min(1.0, c.r));
34  result.g = std::max(0.0, std::min(1.0, c.g));
35  result.b = std::max(0.0, std::min(1.0, c.b));
36  result.a = std::max(0.0, std::min(1.0, c.a));
37  return result;
38  }
39 
40  std::string getTitle() const override
41  {
42  return std::string("Green-Red-Blue-White");
43  }
44 
45  std::string getCategory() const override
46  {
47  return std::string("IDL");
48  }
49 
50  std::string getSource() const override
51  {
52  return std::string(
53  "float colormap_red(float x) {\n"
54  " if (x < 0.2648221343873518) {\n"
55  " return 1518.00 * x - 162.00;\n"
56  " } else if (x < 0.2806324110671937) {\n"
57  " return 759.00 * x + 39.00;\n"
58  " } else if (x < 0.2964426877470356) {\n"
59  " return 252.0;\n"
60  " } else if (x < 0.3122529644268774) {\n"
61  " return -253.00 * x + 327.00;\n"
62  " } else if (x < 0.3280632411067194) {\n"
63  " return 248.0;\n"
64  " } else if (x < 0.3596837944664031) {\n"
65  " return -253.00 * x + 331.00;\n"
66  " } else if (x < 0.3636363636363636) {\n"
67  " return 240.0;\n"
68  " } else if (x < 0.3794466403162055) {\n"
69  " return -253.00 * x + 332.00;\n"
70  " } else if (x < 0.391304347826087) {\n"
71  " return 236.0;\n"
72  " } else if (x < 0.4229249011857708) {\n"
73  " return -253.00 * x + 335.00;\n"
74  " } else if (x < 0.4387351778656127) {\n"
75  " return 228.0;\n"
76  " } else if (x < 0.4861660079051384) {\n"
77  " return -253.00 * x + 339.00;\n"
78  " } else if (x < 0.5019762845849802) {\n"
79  " return 216.0;\n"
80  " } else if (x < 0.549407114624506) {\n"
81  " return -253.00 * x + 343.00;\n"
82  " } else if (x < 0.5652173913043478) {\n"
83  " return 204.0;\n"
84  " } else if (x < 0.5968379446640316) {\n"
85  " return -253.00 * x + 347.00;\n"
86  " } else if (x < 0.6126482213438735) {\n"
87  " return 196.0;\n"
88  " } else if (x < 0.6600790513833992) {\n"
89  " return -253.00 * x + 351.00;\n"
90  " } else if (x < 0.6758893280632411) {\n"
91  " return 184.0;\n"
92  " } else if (x < 0.7075098814229249) {\n"
93  " return -253.00 * x + 355.00;\n"
94  " } else if (x < 0.7233201581027668) {\n"
95  " return 176.0;\n"
96  " } else if (x < 0.7707509881422925) {\n"
97  " return -253.00 * x + 359.00;\n"
98  " } else if (x < 0.7865612648221344) {\n"
99  " return 164.0;\n"
100  " } else if (x < 0.83399209486166) {\n"
101  " return -253.00 * x + 363.00;\n"
102  " } else if (x < 0.849802371541502) {\n"
103  " return 152.0;\n"
104  " } else if (x < 0.8662737248407505) {\n"
105  " return -253.00 * x + 367.00;\n"
106  " } else {\n"
107  " return 8.24946218487293E+02 * x - 5.66796485866989E+02;\n"
108  " }\n"
109  "}\n"
110  "\n"
111  "float colormap_green(float x) {\n"
112  " if (x < 0.04321209459549381) {\n"
113  " return 9.10799999999998E+02 * x + 6.80363636363637E+01;\n"
114  " } else if (x < 0.1067193675889328) {\n"
115  " return 2277.00 * x + 9.00;\n"
116  " } else if (x < 0.1225296442687747) {\n"
117  " return -759.00 * x + 333.00;\n"
118  " } else if (x < 0.6113554850777934) {\n"
119  " return -1518.00 * x + 426.00;\n"
120  " } else if (x < 0.9924501603814814) {\n"
121  " return 1.97884558823513E+03 * x - 1.71181573083763E+03;\n"
122  " } else {\n"
123  " return 253.00 * x + 1.00;\n"
124  " }\n"
125  "}\n"
126  "\n"
127  "float colormap_blue(float x) {\n"
128  " return 5.23682489688790E+02 * x - 1.55016347956506E+02;\n"
129  "}\n"
130  "\n"
131  "vec4 colormap(float x) {\n"
132  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
133  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
134  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
135  " return vec4(r, g, b, 1.0);\n"
136  "}\n"
137  );
138  }
139  };
140 
141  } // namespace IDL
142 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::GreenRedBlueWhite::getColor
Color getColor(double x) const override
Definition: Green-Red-Blue-White.h:28
colormap::IDL::GreenRedBlueWhite::getTitle
std::string getTitle() const override
Definition: Green-Red-Blue-White.h:40
colormap::Color::g
double g
Definition: colormap.h:14
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::Colormap::vec4
Definition: colormap.h:32
colormap::IDL::GreenRedBlueWhite::getCategory
std::string getCategory() const override
Definition: Green-Red-Blue-White.h:45
colormap::Color::a
double a
Definition: colormap.h:14
colormap::Color::b
double b
Definition: colormap.h:14
max
T max(T t1, T t2)
Definition: gdiam.h:48
colormap::Color
Definition: colormap.h:12
colormap
This file was automatically created with "create_c++_header.sh".
Definition: colormap.h:9
colormap::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:144
colormap::IDL::GreenRedBlueWhite
Definition: Green-Red-Blue-White.h:13
min
T min(T t1, T t2)
Definition: gdiam.h:42
colormap::IDL::GreenRedBlueWhite::getSource
std::string getSource() const override
Definition: Green-Red-Blue-White.h:50