60 #include <ACG/Utils/HaltonColors.hh>
83 inverse_bases[0] = 1.0f / bases[0];
84 inverse_bases[1] = 1.0f / bases[1];
85 inverse_bases[2] = 1.0f / bases[2];
88 float HaltonColors::halton(
int index)
90 int base = bases[index];
91 float inverse_base = inverse_bases[index];
93 float half = inverse_base;
94 int I = current[index];
99 I = (int)(inverse_base * (I - digit));
100 half *= inverse_base;
105 float HaltonColors::random_interval(
int index,
float min,
float max)
107 return halton(index) * (max - min) + min;
110 ACG::Vec4f HaltonColors::HSL2RGB(
double h,
double sl,
double l)
119 v = (l <= 0.5) ? (l * (1.0 + sl)) : (l + sl - l * sl);
125 double fract, vsf, mid1, mid2;
132 vsf = v * sv * fract;
170 return Vec4f((
float)r, (
float)g, (
float)b, 1.0f);
174 float h = random_interval(0, 0.0f , 0.9f );
175 float s = random_interval(1, 0.40f, 0.80f);
176 float l = random_interval(2, 0.30f, 0.60f);
177 return HSL2RGB(h, s, l);
Namespace providing different geometric functions concerning angles.
ACG::Vec4f get_next_color()
Generate the next color (legacy method)
VectorT< float, 4 > Vec4f
HaltonColors(int skip=250)
Default constructor.
virtual ACG::Vec4f generateNextColor()
Generate the next color.