-
Notifications
You must be signed in to change notification settings - Fork 1
/
exploring-nested-cylinders.js
59 lines (48 loc) · 1.25 KB
/
exploring-nested-cylinders.js
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// NB not working (yet)
function main () {
var shapes = [];
for(var i=0; i < 10; i++) {
shapes.push(
rotate([0,0,i*10],
halfHollowCylinder(4+i, 3.5+i, 1 - i)
)
)
shapes.push(
rotate([0,0,i*10],
partialHollowCylinder(4.5+i, 4+i, 1)
)
)
}
return union(
shapes
)
}
function partialCylinder() {
return difference(
cylinder({ r: 4, h: 10, fn: 45}),
cylinder({ r: 3, h: 10, fn: 45 }),
translate([0,0,4], cube({ size: [4,4,6]})),
translate([-4,0,7], cube({ size: [4,4,3]})),
translate([0,-4,7], cube({ size: [4,4,3]}))
)
}
function hollowCylinder(r, ir, h) {
return difference(
cylinder( { r: r, h: h, fn: 45} ),
cylinder( { r: ir, h: h, fn: 45 } )
)
}
function halfHollowCylinder(r, ir, h) {
return difference(
cylinder( { r: r, h: h, fn: 45} ),
cylinder( { r: ir, h: h, fn: 45 } ),
translate([-r,0,0], cube({size: [r*2,r,h]}))
)
}
function partialHollowCylinder(r, ir, h) {
return difference(
cylinder( { r: r, h: h, fn: 45} ),
cylinder( { r: ir, h: h, fn: 45 } ),
translate([-r,0,0], cube({size: [r*2,r,h]}))
)
}