Beach.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 Beach : 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_Beach.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("Beach");
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.5) {\n"
55  " return 1.07069284759359E+03 * x - 3.92901626559718E+02; // R1\n"
56  " } else if (x < (4.62452380952399E+02 - 3.16199999999948E+02) / (1.05778571428574E+03 - 8.03199999999881E+02)) { // 0.57447206479\n"
57  " return 1.05778571428574E+03 * x - 4.62452380952399E+02; // R2\n"
58  " } else if (x < (2.16218045113087E+01 + 3.16199999999948E+02) / (8.03199999999881E+02 - 2.93462406015021E+02)) { // 0.66273668746\n"
59  " return 8.03199999999881E+02 * x - 3.16199999999948E+02; // R3\n"
60  " } else if (x < 0.7332708626326772) {\n"
61  " return 2.93462406015021E+02 * x + 2.16218045113087E+01; // R4\n"
62  " } else {\n"
63  " return 0.0;\n"
64  " }\n"
65  "}\n"
66  "\n"
67  "float colormap_green(float x) {\n"
68  " if (x < (2.51230508474576E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 5.35095032144939E+02)) { // 0.23285616817\n"
69  " return -5.35095032144939E+02 * x + 2.51230508474576E+02; // G1\n"
70  " } else if (x < (6.91824598930488E+02 - 2.71026069518750E+01) / (4.27421457219241E+02 + 1.39121879297175E+03)) { // 0.36550493804\n"
71  " return 4.27421457219241E+02 * x + 2.71026069518750E+01; // G2\n"
72  " } else if (x < (6.91824598930488E+02 + 5.16725562656262E+02) / (1.02304642956372E+03 + 1.39121879297175E+03)) { // 0.500587156\n"
73  " return -1.39121879297175E+03 * x + 6.91824598930488E+02; // G3\n"
74  " } else if (x < 0.7332708626326772) {\n"
75  " return 1.02304642956372E+03 * x - 5.16725562656262E+02; // G4\n"
76  " } else {\n"
77  " return 0.0;\n"
78  " }\n"
79  "}\n"
80  "\n"
81  "float colormap_blue(float x) {\n"
82  " if (x < 0.3584754040051419) {\n"
83  " return 1.07130443548384E+03 * x - 2.48036290322570E+02; // B1\n"
84  " } else if (x < 123.0 / 251.0) {\n"
85  " return 136.0;\n"
86  " } else if (x < 0.7332708626326772) {\n"
87  " return -1.01758796992489E+03 * x + 5.87035338345905E+02; // B2\n"
88  " } else {\n"
89  " return 8.98509790209691E+02 * x - 6.58851048950966E+02; // B3\n"
90  " }\n"
91  "}\n"
92  "\n"
93  "// R2 - R3 = 0\n"
94  "// => [x=0.5744720647924222]\n"
95  "\n"
96  "// B1 - 136 = 0\n"
97  "// => [x=0.3584754040051419]\n"
98  "\n"
99  "// B3 = 0\n"
100  "// => [x=0.7332708626326772]\n"
101  "\n"
102  "vec4 colormap(float x) {\n"
103  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
104  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
105  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
106  " return vec4(r, g, b, 1.0);\n"
107  "}\n"
108  );
109  }
110  };
111 
112  } // namespace IDL
113 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::Beach::getCategory
std::string getCategory() const override
Definition: Beach.h:45
colormap::IDL::Beach::getSource
std::string getSource() const override
Definition: Beach.h:50
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::Beach::getColor
Color getColor(double x) const override
Definition: Beach.h:28
colormap::IDL::Beach
Definition: Beach.h:13
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
min
T min(T t1, T t2)
Definition: gdiam.h:42
colormap::IDL::Beach::getTitle
std::string getTitle() const override
Definition: Beach.h:40