-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsphere.scad
45 lines (40 loc) · 830 Bytes
/
sphere.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use <cube.scad>
module half_sphere(d, r) {
if (d == undef) {
d = 2 * r;
intersection() {
sphere(r=r);
cube2([d, d, d], center_xy = true);
}
} else {
intersection() {
sphere(d=d);
cube2([d, d, d], center_xy = true);
}
}
}
/*half_sphere(r=3);*/
/*half_sphere(d=6);*/
module half_sphere_shell(d, r, thickness)
{
difference() {
half_sphere(d, r);
if (d == undef) {
sphere(r=r-thickness);
} else {
sphere(d=d-2*thickness);
}
}
}
/*half_sphere_shell(d=10, thickness=1);*/
module ellipsoid(x, y, z) {
scale([1, y / x, z / x]) sphere(d=x);
}
/*ellipsoid(10, 20, 30);*/
module half_ellipsoid(x, y, z) {
intersection() {
sphere2(x, y, z);
cube2([x, y, z], center_xy = true);
}
}
/*half_ellipsoid(10, 20, 30);*/