MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / ToHSV

Method ToHSV

Source/Engine/Core/Math/Color.cpp:172–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170}
171
172Float3 Color::ToHSV() const
173{
174 const float rgbMin = Math::Min(R, G, B);
175 const float rgbMax = Math::Max(R, G, B);
176 const float rgbRange = rgbMax - rgbMin;
177 const float hue = rgbMax == rgbMin ? 0.0f : rgbMax == R ? Math::Mod((G - B) / rgbRange * 60.0f + 360.0f, 360.0f) : rgbMax == G ? (B - R) / rgbRange * 60.0f + 120.0f : rgbMax == B ? (R - G) / rgbRange * 60.0f + 240.0f : 0.0f;
178 const float saturation = rgbMax == 0.0f ? 0.0f : rgbRange / rgbMax;
179 const float value = rgbMax;
180 return Float3(hue, saturation, value);
181}
182
183void Color::Lerp(const Color& start, const Color& end, float amount, Color& result)
184{

Callers 8

DrawPolyFunction · 0.45
ColorPickerDialogClass · 0.45
ColorSelectorClass · 0.45
UpdateMouseMethod · 0.45
DrawMethod · 0.45
UpdateMouseMethod · 0.45
DrawMethod · 0.45
OnMouseUpMethod · 0.45

Calls 4

Float3Class · 0.85
MinFunction · 0.70
MaxFunction · 0.70
ModFunction · 0.70

Tested by

no test coverage detected