-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteardrops.scad
132 lines (119 loc) · 2.19 KB
/
teardrops.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
//
// RepRap Mendel Akimbo
//
// A Mendel variant, which improves the frame's clearance and stability
// by increasing its triangulation.
//
// Copyright 2012 by Ron Aldrich.
//
// Licensed under GNU GPL v2
//
// teardrops.scad
//
// Generates 2d and 3d teardrop profiles.
//
module hexircle(r, $fn)
{
intersection()
{
circle(r=r/cos(30), $fn=6);
translate([0, r*3/4])
square([r*2, r/2], center=true);
}
rotate([0, 0, 180/$fn])
circle(r=r, $fn=$fn);
}
module teardrop(h, r, center=false, $fn)
{
render(convexity=1)
cylinder(h=h, r=r, center=center, $fn=$fn);
translate([0, r/2*sqrt(2), 0])
cylinder(h=h, r=r*cos(45), center=center, $fn=4);
}
octircle(h=1, r=10, $fn=40, center=true);
module hexylinder(h, r, center=false, $fn)
{
render(convexity=1)
intersection()
{
rotate([0, 0, 0])
cylinder(h=h, r=r/cos(30), center=center, $fn=6);
if (center)
{
translate([0, r*3/4, 0])
cube([r*2, r/2, h+.1], center=true);
}
else
{
translate([0, r*3/4, h/2])
cube([r*2, r/2, h+.1], center=true);
}
}
rotate([0, 0, 180/$fn])
cylinder(h=h, r=r, $fn=$fn, center=center);
}
module hexasphere(r, $fn)
{
render(convexity=1)
{
intersection()
{
cylinder(h=r, r1=r/cos(30), r2=r/cos(30)/2, $fn=$fn);
translate([0, 0, r*3/4])
cube([r*2, r*2, r/2], center=true);
}
sphere(r, $fn);
}
}
module octircle(r, $fn)
{
a=r/(1+sqrt(2));
b=(r-a)/2;
intersection()
{
rotate(45/2)
circle(r=r/cos(45/2), $fn=8);
translate([0, r-b/2])
square([r*2, b], center=true);
}
rotate(180/$fn)
circle(r=r, $fn=$fn);
}
module octylinder(h, r, center=false, $fn)
{
a=r/(1+sqrt(2));
b=(r-a)/2;
hull()
{
intersection()
{
rotate([0, 0, 45/2])
cylinder(h=h, r=r/cos(45/2), center=center, $fn=8);
if (center)
{
translate([0, r-b/2, 0])
cube([r*2, b, h+.1], center=true);
}
else
{
translate([0, r-b/2, h/2])
cube([r*2, b, h+.1], center=true);
}
}
cylinder(h=h, r=r, $fn=$fn, center=center);
}
}
module octasphere(r, $fn)
{
a=r/(1+sqrt(2));
b=(r-a)/2;
render(convexity=1)
intersection()
{
translate([0, 0, a])
cylinder(h=r-a, r1=r, r2=a, $fn=$fn);
translate([0, 0, r-b/2])
cube([r*2, r*2, b], center=true);
}
sphere(r, $fn=$fn);
}