lygia
/color
/space
/lch2lab
)Converts a Lch ot Lab color space. Note: LCh is simply Lab but converted to polar coordinates (in degrees).
Use:
<vec3|vec4> lch2lab(<vec3|vec4> color)
#ifndef FNC_LCH2LAB
#define FNC_LCH2LAB
vec3 lch2lab(vec3 lch) {
return vec3(
lch.x,
lch.y * cos(lch.z * 0.01745329251),
lch.y * sin(lch.z * 0.01745329251)
);
}
vec4 lch2lab(vec4 lch) { return vec4(lch2lab(lch.xyz),lch.a);}
#endif
Use:
<float3|float4> lch2lab(<float3|float4> color)
#ifndef FNC_LCH2LAB
#define FNC_LCH2LAB
float3 lch2lab(float3 lch) {
return float3(
lch.x,
lch.y * cos(lch.z * 0.01745329251),
lch.y * sin(lch.z * 0.01745329251)
);
}
float4 lch2lab(float4 lch) { return float4(lch2lab(lch.xyz),lch.a);}
#endif
Use:
<float3|float4> lch2lab(<float3|float4> color)
#ifndef FNC_LCH2LAB
#define FNC_LCH2LAB
float3 lch2lab(float3 lch) {
return float3(
lch.x,
lch.y * cos(lch.z * 0.01745329251),
lch.y * sin(lch.z * 0.01745329251)
);
}
float4 lch2lab(float4 lch) { return float4(lch2lab(lch.xyz),lch.a);}
#endif
fn lch2lab(lch: vec3f) -> vec3f {
return vec3f(
lch.x,
lch.y * cos(lch.z * 0.01745329251),
lch.y * sin(lch.z * 0.01745329251)
);
}
LYGIA is dual-licensed under the Prosperity License and the Patron License for sponsors and contributors.
Sponsors and contributors are automatically added to the Patron License and they can ignore the any non-commercial rule of the Prosperity Licensed software (please take a look to the exception).
It's also possible to get a permanent comercial license hook to a single and specific version of LYGIA.
Sign up for the news letter bellow, joing the LYGIA's channel on Discord or follow the Github repository