CB-RdYiBu.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 CBRdYiBu : 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_CB-RdYiBu.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("CB-RdYiBu");
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.09790863520700754) {\n"
55  " return 5.14512820512820E+02 * x + 1.64641025641026E+02;\n"
56  " } else if (x < 0.2001887081633112) {\n"
57  " return 2.83195402298854E+02 * x + 1.87288998357964E+02;\n"
58  " } else if (x < 0.3190117539655621) {\n"
59  " return 9.27301587301214E+01 * x + 2.25417989417999E+02;\n"
60  " } else if (x < 0.500517389125164) {\n"
61  " return 255.0;\n"
62  " } else if (x < 0.6068377196788788) {\n"
63  " return -3.04674876847379E+02 * x + 4.07495073891681E+02;\n"
64  " } else if (x < 0.9017468988895416) {\n"
65  " return (1.55336390191951E+02 * x - 7.56394659038288E+02) * x + 6.24412733169483E+02;\n"
66  " } else {\n"
67  " return -1.88350769230735E+02 * x + 2.38492307692292E+02;\n"
68  " }\n"
69  "}\n"
70  "\n"
71  "float colormap_green(float x) {\n"
72  " if (x < 0.09638568758964539) {\n"
73  " return 4.81427692307692E+02 * x + 4.61538461538488E-01;\n"
74  " } else if (x < 0.4987066686153412) {\n"
75  " return ((((3.25545903568267E+04 * x - 4.24067109461319E+04) * x + 1.83751375886345E+04) * x - 3.19145329617892E+03) * x + 8.08315127034676E+02) * x - 1.44611527812961E+01;\n"
76  " } else if (x < 0.6047312345537269) {\n"
77  " return -1.18449917898218E+02 * x + 3.14234811165860E+02;\n"
78  " } else if (x < 0.7067635953426361) {\n"
79  " return -2.70822112753102E+02 * x + 4.06379036672115E+02;\n"
80  " } else {\n"
81  " return (-4.62308723214883E+02 * x + 2.42936159122279E+02) * x + 2.74203431802418E+02;\n"
82  " }\n"
83  "}\n"
84  "\n"
85  "float colormap_blue(float x) {\n"
86  " if (x < 0.09982818011951204) {\n"
87  " return 1.64123076923076E+01 * x + 3.72646153846154E+01;\n"
88  " } else if (x < 0.2958717460833126) {\n"
89  " return 2.87014675052409E+02 * x + 1.02508735150248E+01;\n"
90  " } else if (x < 0.4900527540014758) {\n"
91  " return 4.65475113122167E+02 * x - 4.25505279034673E+01;\n"
92  " } else if (x < 0.6017014681258838) {\n"
93  " return 5.61032967032998E+02 * x - 8.93789173789407E+01;\n"
94  " } else if (x < 0.7015737100463595) {\n"
95  " return -1.51655677655728E+02 * x + 3.39446886446912E+02;\n"
96  " } else if (x < 0.8237156500567735) {\n"
97  " return -2.43405347593559E+02 * x + 4.03816042780725E+02;\n"
98  " } else {\n"
99  " return -3.00296889157305E+02 * x + 4.50678495922638E+02;\n"
100  " }\n"
101  "}\n"
102  "\n"
103  "vec4 colormap(float x) {\n"
104  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
105  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
106  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
107  " return vec4(r, g, b, 1.0);\n"
108  "}\n"
109  );
110  }
111  };
112 
113  } // namespace IDL
114 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
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::CBRdYiBu::getColor
Color getColor(double x) const override
Definition: CB-RdYiBu.h:28
colormap::IDL::CBRdYiBu::getCategory
std::string getCategory() const override
Definition: CB-RdYiBu.h:45
colormap::Color::a
double a
Definition: colormap.h:14
colormap::IDL::CBRdYiBu
Definition: CB-RdYiBu.h:13
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::IDL::CBRdYiBu::getTitle
std::string getTitle() const override
Definition: CB-RdYiBu.h:40
colormap::Color::r
double r
Definition: colormap.h:14
colormap::Colormap::WrapperBase
Definition: colormap.h:144
min
T min(T t1, T t2)
Definition: gdiam.h:42
colormap::IDL::CBRdYiBu::getSource
std::string getSource() const override
Definition: CB-RdYiBu.h:50