Cylinder
Code Example
float cylinderSDF(vec3 p, float h, float r) {
vec2 d = abs(vec2(length(p.xz), p.y)) - vec2(r, h);
return min(max(d.x, d.y), 0.) + length(max(d, 0.));
}
float cylinderSDF(vec3 p, float h, float r) {
vec2 d = abs(vec2(length(p.xz), p.y)) - vec2(r, h);
return min(max(d.x, d.y), 0.) + length(max(d, 0.));
}