CB-Paired.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 CBPaired : 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-Paired.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-Paired");
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.0906416957946237) {\n"
55  " return -1.48766695652174E+03 * x + 1.65896666666667E+02;\n"
56  " } else if (x < 0.181137969063194) {\n"
57  " return 1.62263833992095E+03 * x - 1.16026679841898E+02;\n"
58  " } else if (x < 0.2716806139960391) {\n"
59  " return -1.40227075098820E+03 * x + 4.31899209486178E+02;\n"
60  " } else if (x < 0.3621693275308975) {\n"
61  " return 2.21145652173927E+03 * x - 5.49880434782653E+02;\n"
62  " } else if (x < 0.4514347780510689) {\n"
63  " return -2.73075098814252E+02 * x + 3.49940711462467E+02;\n"
64  " } else if (x < 0.5478389816716595) {\n"
65  " return 2.75424347826088E+02 * x + 1.02328985507251E+02;\n"
66  " } else if (x < 0.6384253260915684) {\n"
67  " return 1.95770750987722E+01 * x + 2.42492094861655E+02;\n"
68  " } else if (x < 0.7280391465804739) {\n"
69  " return -5.92081027667844E+02 * x + 6.32990118576982E+02;\n"
70  " } else if (x < 0.8191050219893012) {\n"
71  " return -1.05189130434770E+03 * x + 9.67749999999916E+02;\n"
72  " } else if (x < 0.9092300295745469) {\n"
73  " return 1.64974505928811E+03 * x - 1.24517391304309E+03;\n"
74  " } else {\n"
75  " return -8.20731225296366E+02 * x + 1.00105731225287E+03;\n"
76  " }\n"
77  "}\n"
78  "\n"
79  "float colormap_green(float x) {\n"
80  " if (x < 0.09069203671589791) {\n"
81  " return -9.49076521739127E+02 * x + 2.05970000000000E+02;\n"
82  " } else if (x < 0.1811205395903491) {\n"
83  " return 1.14400395256917E+03 * x + 1.61442687747026E+01;\n"
84  " } else if (x < 0.271076794014141) {\n"
85  " return -7.04272727272755E+02 * x + 3.50905138339931E+02;\n"
86  " } else if (x < 0.3618506954718166) {\n"
87  " return -6.35000000000221E+01 * x + 1.77206521739141E+02;\n"
88  " } else if (x < 0.4527247821743651) {\n"
89  " return -1.40603557312254E+03 * x + 6.63003952569178E+02;\n"
90  " } else if (x < 0.5472660653935183) {\n"
91  " return 1.73713913043494E+03 * x - 7.59989130434857E+02;\n"
92  " } else if (x < 0.6379975539161487) {\n"
93  " return -7.00507905138483E+02 * x + 5.74052371541584E+02;\n"
94  " } else if (x < 0.7283304980067641) {\n"
95  " return 5.64723320158019E+02 * x - 2.33162055335916E+02; } else if (x < 0.8189077039268755) {\n"
96  " return -1.29283992094844E+03 * x + 1.11975790513821E+03; } else if (x < 0.9094178747563795) {\n"
97  " return 2.14293675889271E+03 * x - 1.69382608695601E+03;\n"
98  " } else {\n"
99  " return -1.75290118577070E+03 * x + 1.84911857707505E+03;\n"
100  " }\n"
101  "}\n"
102  "\n"
103  "float colormap_blue(float x) {\n"
104  " if (x < 0.1835817221386023) {\n"
105  " return -4.93278367346940E+02 * x + 2.25853877551021E+02;\n"
106  " } else if (x < 0.2718482976477959) {\n"
107  " return -1.04124223602495E+03 * x + 3.26450028232661E+02;\n"
108  " } else if (x < 0.3623519200472859) {\n"
109  " return 1.21151976284592E+03 * x - 2.85959486166031E+02;\n"
110  " } else if (x < 0.4526344257525674) {\n"
111  " return -1.38645849802374E+03 * x + 6.55422924901199E+02;\n"
112  " } else if (x < 0.5474992417588231) {\n"
113  " return 8.80275652173975E+02 * x - 3.70578985507278E+02;\n"
114  " } else if (x < 0.6375259518892261) {\n"
115  " return -1.24038339920972E+03 * x + 7.90480237154278E+02;\n"
116  " } else if (x < 0.7280438873117513) {\n"
117  " return 2.36255138339872E+03 * x - 1.50648418972297E+03;\n"
118  " } else if (x < 0.8192397843702398) {\n"
119  " return -6.51816205533491E+02 * x + 6.88107707509788E+02;\n"
120  " } else if (x < 0.9092328860678134) {\n"
121  " return -1.35533596837590E+01 * x + 1.65217391304318E+02;\n"
122  " } else {\n"
123  " return -1.19420158102770E+03 * x + 1.23870158102770E+03;\n"
124  " }\n"
125  "}\n"
126  "\n"
127  "vec4 colormap(float x) {\n"
128  " float r = clamp(colormap_red(x) / 255.0, 0.0, 1.0);\n"
129  " float g = clamp(colormap_green(x) / 255.0, 0.0, 1.0);\n"
130  " float b = clamp(colormap_blue(x) / 255.0, 0.0, 1.0);\n"
131  " return vec4(r, g, b, 1.0);\n"
132  "}\n"
133  );
134  }
135  };
136 
137  } // namespace IDL
138 } // namespace colormap
colormap::Colormap
Definition: colormap.h:17
colormap::IDL::CBPaired::getTitle
std::string getTitle() const override
Definition: CB-Paired.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::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::CBPaired::getSource
std::string getSource() const override
Definition: CB-Paired.h:50
colormap::Color
Definition: colormap.h:12
colormap::IDL::CBPaired
Definition: CB-Paired.h:13
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::IDL::CBPaired::getColor
Color getColor(double x) const override
Definition: CB-Paired.h:28
colormap::Colormap::WrapperBase
Definition: colormap.h:144
min
T min(T t1, T t2)
Definition: gdiam.h:42
colormap::IDL::CBPaired::getCategory
std::string getCategory() const override
Definition: CB-Paired.h:45