lygia
/v1.1.6
/sdf
/spiralSDF
)Returns a spiral SDF
Use:
spiralSDF(<vec2> st, <float> turns)
#ifndef FNC_SPIRALSDF
#define FNC_SPIRALSDF
float spiralSDF(vec2 st, float t) {
#ifdef CENTER_2D
st -= CENTER_2D;
#else
st -= 0.5;
#endif
float r = dot(st, st);
float a = atan(st.y, st.x);
return abs(sin(fract(log(r) * t + a * 0.159)));
}
#endif
Use:
spiralSDF(<float2> st, <float> turns)
#ifndef FNC_SPIRALSDF
#define FNC_SPIRALSDF
float spiralSDF(float2 st, float t) {
#ifdef CENTER_2D
st -= CENTER_2D;
#else
st -= 0.5;
#endif
float r = dot(st, st);
float a = atan2(st.y, st.x);
return abs(sin(frac(log(r) * t + a * 0.159)));
}
#endif
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