32template <std::
floating_po
int T>
40#if (TOHSV_METHOD == 1)
41 T cmax = max( input );
42 T cmin = min( input );
43 T delta = cmax - cmin;
59 saturation = delta / cmax;
61 T rc = ( cmax - input.
red() ) / delta;
62 T gc = ( cmax - input.
green() ) / delta;
63 T bc = ( cmax - input.
blue() ) / delta;
68 hue = T{0.0} + bc - gc;
70 hue = T{2.0} + rc - bc;
72 hue = T{4.0} + gc - rc;
75 hue = std::fmod( hue / T{6.0}, T{1.0} );
79#elif (TOHSV_METHOD == 2)
87 T d = q.
x - std::min(q.
w, q.
y);
96 static_assert(
"Invalid value for TOHSV_METHOD");
111template <std::
floating_po
int T>
114#define TORGB_METHOD 1
118#if (TORGB_METHOD == 1)
158#elif (TORGB_METHOD == 2)
159 T
h = std::fmod( T{100.0} +
input_hsv.
hue().value(), T{1.0} );
182#elif (TORGB_METHOD == 3)
190 saturate(
p - K.xxx(), T{0.0}, T{1.0} ),
195 static_assert(
"Invalid method defined for TORGB_METHOD");
210template <std::
floating_po
int T>
219 if ( approximately_equal_to( lightness, T{0.0} ) || approximately_equal_to( lightness, T{1.0} ) )
222 saturation = (
input_hsv.
value() - lightness) / std::min(lightness, T{1.0} - lightness);
235template <std::
floating_po
int T>
244 if ( approximately_equal_to( value, T{0.0} ) )
247 saturation = T{2.0} * (T{1.0} -
input_hsl.lightness() / value);
constexpr value_type saturation() const
constexpr Math::BasicDegree< value_type > hue() const
constexpr value_type value() const
constexpr value_type red() const
constexpr value_type blue() const
constexpr value_type g() const
constexpr value_type b() const
constexpr value_type r() const
constexpr value_type green() const
constexpr bool isNormalized() const
constexpr BasicDegree< T > modulo() const
bool approximately_equal_to(float input, float near_to, float tolerance=0.0002f)
BasicHSV< T > ToHSV(const BasicUnitRGB< T > &input)
BasicHSL< T > ToHSL(const BasicHSV< T > &input_hsv)
BasicUnitRGB< T > ToRGB(const BasicHSV< T > &input_hsv)
constexpr Type lerp(Type input_lower_bound, Type input_upper_bound, float percentage_zero_to_one)
constexpr const Type & saturate(const Type &value, const Type &lower_bound, const Type &upper_bound)