Converts hue in degrees, saturation and value (both in [0, 1]) to red, green, blue. Takes a Vector3 and returns a Vector3, or takes h, s, v and returns r, g, b. The hue wraps, so -60 and 300 are the same, and a saturation of 0 gives a grey of the given value.
#import "Math";
assert(hsv_to_rgb(xyz(120, 1, 1)) == xyz(0, 1, 0));
r, g, b := hsv_to_rgb(0, 0, 0.25);
assert(r == 0.25 && g == 0.25 && b == 0.25);
assert(hsv_to_rgb(xyz(-60, 1, 1)) == hsv_to_rgb(xyz(300, 1, 1)));hsv_to_rgb :: (hsv: Vector3) -> Vector3
Parameters
- hsv: Vector3
Returns
hsv_to_rgb :: (
cx: float,
cy: float,
cz: float
) -> (r: float, g: float, b: float)
Parameters
- cx: float
- cy: float
- cz: float
Returns
- r: float
- g: float
- b: float