spherical.scad
1 module spherical_dish(width, height, depth, inverted){ 2 3 //same thing as the cylindrical dish here, but we need the corners to just touch - so we have to find the hypotenuse of the top 4 chord = pow((pow(width,2) + pow(height, 2)),0.5); //getting diagonal of the top 5 6 // the distance you have to move the dish up so it digs in depth millimeters 7 chord_length = (pow(chord, 2) - 4 * pow(depth, 2)) / (8 * depth); 8 //the radius of the dish 9 rad = (pow(chord, 2) + 4 * pow(depth, 2)) / (8 * depth); 10 direction = inverted ? -1 : 1; 11 12 translate([0,0,0 * direction]){ 13 if (geodesic){ 14 $fa=20; 15 scale([chord/2/depth, chord/2/depth]) { 16 geodesic_sphere(r=depth); 17 } 18 } else { 19 $fa=6.5; 20 // rotate 1 because the bottom of the sphere looks like trash. 21 scale([chord/2/depth, chord/2/depth]) { 22 sphere(r=depth); 23 } 24 } 25 } 26 }