radius = 5; depth = 2; diff_h = (pow(radius,2)/depth - depth)/2; diff_radius = (pow(radius,2)/depth - depth)/2 + depth; difference(){ translate([0,0,0]) cylinder(r=radius,h=depth); translate([0,0,diff_radius]) sphere(r=diff_radius); }