lygia
/sdf
/linkSDF
)generate the SDF of a link
Use:
<float> linkSDF( <vec3> p, <float> le, <float> r1, <float> r2 )
#ifndef FNC_LINKSDF
#define FNC_LINKSDF
float linkSDF( vec3 p, float le, float r1, float r2 ) {
vec3 q = vec3( p.x, max(abs(p.y)-le,0.0), p.z );
return length(vec2(length(q.xy)-r1,q.z)) - r2;
}
#endif
Use:
<float> linkSDF( <float3> p, <float> le, <float> r1, <float> r2 )
#ifndef FNC_LINKSDF
#define FNC_LINKSDF
float linkSDF( float3 p, float le, float r1, float r2 ) {
float3 q = float3( p.x, max(abs(p.y)-le,0.0), p.z );
return length(float2(length(q.xy)-r1,q.z)) - r2;
}
#endif
Use:
<float> linkSDF( <float3> p, <float> le, <float> r1, <float> r2 )
#ifndef FNC_LINKSDF
#define FNC_LINKSDF
float linkSDF( float3 p, float le, float r1, float r2 ) {
float3 q = float3( p.x, max(abs(p.y)-le,0.0), p.z );
return length(float2(length(q.xy)-r1,q.z)) - r2;
}
#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