/* * Copyright (c) 2022 - 2023 Thomas Buck (thomas@xythobuz.de) * Philipp Schönberger (mail@phschoen.de) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * See . */ function sphere_r_at_h(h, r) = r * sin(acos(h / r)); function sphere_angle_at_rh(h, r) = acos(h / r); module fully_rounded_cube(p,r,center) { for(x=[r,p[0]-r], y=[r,p[1]-r], z=[r,p[2]-r]) { translate([x,y,z]) sphere(r,$fn=$fn/4); } } module rounded_cube(x, y, z, r) { hull() for (tx = [r, x - r]) for (ty = [r, y - r]) translate([tx, ty, 0]) cylinder(d = r * 2, h = z); } module eps(dir="z") { if(dir== "x") tranlate([-$e,0,0]) children(); if(dir== "y") translate([0,-$e,0]) children(); if(dir== "z") translate([0,0,-$e]) children(); }