Skip to content

Instantly share code, notes, and snippets.

@zikes
Created May 22, 2020 00:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zikes/f4ee592ad66621aabc7395b2cf0ea34b to your computer and use it in GitHub Desktop.
Save zikes/f4ee592ad66621aabc7395b2cf0ea34b to your computer and use it in GitHub Desktop.
OpenSCAD Spherical Cap
module spherical_cap(height,diameter) {
R=(pow(diameter/2,2)+pow(height,2))/(height*2);
translate([0,0,-R+height])difference() {
sphere(r=R,$fn=100);
translate([0,0,-height])cube(size=[R*2,R*2,R*2], center=true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment