25 lines
762 B
Text
25 lines
762 B
Text
#include "circleSDF.msl"
|
|
|
|
/*
|
|
contributors: Patricio Gonzalez Vivo
|
|
description: Returns an almond-shaped sdf
|
|
use: <float> vesicaSDF(<float2> st, <float> w)
|
|
examples:
|
|
- https://raw.githubusercontent.com/patriciogonzalezvivo/lygia_examples/main/draw_shapes.frag
|
|
license:
|
|
- Copyright (c) 2021 Patricio Gonzalez Vivo under Prosperity License - https://prosperitylicense.com/versions/3.0.0
|
|
- Copyright (c) 2021 Patricio Gonzalez Vivo under Patron License - https://lygia.xyz/license
|
|
*/
|
|
|
|
#ifndef FNC_VESICASDF
|
|
#define FNC_VESICASDF
|
|
float vesicaSDF(float2 st, float w) {
|
|
float2 offset = float2(w*0.5,0.);
|
|
return max( circleSDF(st-offset),
|
|
circleSDF(st+offset));
|
|
}
|
|
|
|
float vesicaSDF(float2 st) {
|
|
return vesicaSDF(st, 0.5);
|
|
}
|
|
#endif
|