CB-RdBu.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 CBRdBu : 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-RdBu.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-RdBu");
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.09771832105856419) {\n"
55  " return 7.60263247863246E+02 * x + 1.02931623931624E+02;\n"
56  " } else if (x < 0.3017162107441106) {\n"
57  " return (-2.54380938558548E+02 * x + 4.29911571188803E+02) * x + 1.37642085716717E+02;\n"
58  " } else if (x < 0.4014205790737471) {\n"
59  " return 8.67103448276151E+01 * x + 2.18034482758611E+02;\n"
60  " } else if (x < 0.5019932233215039) {\n"
61  " return -6.15461538461498E+01 * x + 2.77547692307680E+02;\n"
62  " } else if (x < 0.5969483882550937) {\n"
63  " return -3.77588522588624E+02 * x + 4.36198819698878E+02;\n"
64  " } else if (x < 0.8046060096654594) {\n"
65  " return (-6.51345897546620E+02 * x + 2.09780968434337E+02) * x + 3.17674951640855E+02;\n"
66  " } else {\n"
67  " return -3.08431855203590E+02 * x + 3.12956742081421E+02;\n"
68  " }\n"
69  "}\n"
70  "\n"
71  "float colormap_green(float x) {\n"
72  " if (x < 0.09881640500975222) {\n"
73  " return 2.41408547008547E+02 * x + 3.50427350427364E-01;\n"
74  " } else if (x < 0.5000816285610199) {\n"
75  " return ((((1.98531871433258E+04 * x - 2.64108262469187E+04) * x + 1.10991785969817E+04) * x - 1.92958444776211E+03) * x + 8.39569642882186E+02) * x - 4.82944517518776E+01;\n"
76  " } else if (x < 0.8922355473041534) {\n"
77  " return (((6.16712686949223E+03 * x - 1.59084026055125E+04) * x + 1.45172137257997E+04) * x - 5.80944127411621E+03) * x + 1.12477959061948E+03;\n"
78  " } else {\n"
79  " return -5.28313797313699E+02 * x + 5.78459299959206E+02;\n"
80  " }\n"
81  "}\n"
82  "\n"
83  "float colormap_blue(float x) {\n"
84  " if (x < 0.1033699568661857) {\n"
85  " return 1.30256410256410E+02 * x + 3.08518518518519E+01;\n"
86  " } else if (x < 0.2037526071071625) {\n"
87  " return 3.38458128078815E+02 * x + 9.33004926108412E+00;\n"
88  " } else if (x < 0.2973267734050751) {\n"
89  " return (-1.06345054944861E+02 * x + 5.93327252747168E+02) * x - 3.81852747252658E+01;\n"
90  " } else if (x < 0.4029109179973602) {\n"
91  " return 6.68959706959723E+02 * x - 7.00740740740798E+01;\n"
92  " } else if (x < 0.5006715489526758) {\n"
93  " return 4.87348695652202E+02 * x + 3.09898550724286E+00;\n"
94  " } else if (x < 0.6004396902588283) {\n"
95  " return -6.85799999999829E+01 * x + 2.81436666666663E+02;\n"
96  " } else if (x < 0.702576607465744) {\n"
97  " return -1.81331701891043E+02 * x + 3.49137263626287E+02;\n"
98  " } else if (x < 0.9010407030582428) {\n"
99  " return (2.06124143164576E+02 * x - 5.78166906665595E+02) * x + 5.26198653917172E+02;\n"
100  " } else {\n"
101  " return -7.36990769230737E+02 * x + 8.36652307692262E+02;\n"
102  " }\n"
103  "}\n"
104  "\n"
105  "vec4 colormap(float x) {\n"
106  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
107  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
108  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
109  " return vec4(r, g, b, 1.0);\n"
110  "}\n"
111  );
112  }
113  };
114 
115  } // namespace IDL
116 } // namespace colormap
colormap::IDL::CBRdBu::getCategory
std::string getCategory() const override
Definition: CB-RdBu.h:45
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::CBRdBu::getTitle
std::string getTitle() const override
Definition: CB-RdBu.h:40
colormap::Color::g
double g
Definition: colormap.h:14
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
colormap::IDL::CBRdBu::getSource
std::string getSource() const override
Definition: CB-RdBu.h:50
colormap::Colormap::vec4
Definition: colormap.h:32
colormap::IDL::CBRdBu::getColor
Color getColor(double x) const override
Definition: CB-RdBu.h:28
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::IDL::CBRdBu
Definition: CB-RdBu.h:13
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