Capsule
Code Example
float capsuleSDF(vec3 p, float h, float r) {
vec3 ba = vec3(0., h, 0.);
float d = clamp(dot(p, ba) / dot(ba, ba), 0., 1.);
return length(p - ba * d) - r;
}
float capsuleSDF(vec3 p, float h, float r) {
vec3 ba = vec3(0., h, 0.);
float d = clamp(dot(p, ba) / dot(ba, ba), 0., 1.);
return length(p - ba * d) - r;
}