Neale Pickett
·
2025-12-30
flare.scad
1// A fillet is a sort of trumpet bell shape
2module fillet(h, d1, d2) {
3 if (d2 > d1) {
4 translate([0, 0, h]) mirror([0, 0, 1]) fillet(h, d2, d1);
5 } else {
6 dd = d1 - d2;
7 for (i = [0:1/$fa:1]) {
8 cylinder(h=(h+h*i)/2, d1=d1-dd*i, d2=d2);
9 }
10 }
11}
12
13// A patty is a cylinder with rounded sides, like a hamburger patty
14module patty(h, d) {
15 d_cyl = max(0, d-h);
16 cylinder(h=h, d=d_cyl, center=true);
17 rotate_extrude() {
18 translate([d_cyl/2, 0]) circle(h);
19 }
20}
21
22// A flare is a fillet with a patty on each end
23module flare(h, d1, d2) {
24 if (d2 > d1) {
25 translate([0, 0, h]) mirror([0, 0, 1]) flare(h, d2, d1);
26 } else {
27 f2 = log(h*20);
28 f1 = f2 * d1/d2;
29
30 translate([0, 0, 0]) patty(f1, d1);
31 translate([0, 0, f1/2]) fillet(h=h-(f1+f2)/2, d1=d1-f1, d2=d2-f2);
32 translate([0, 0, h]) patty(f2, d2);
33 }
34}
35
36// Set up the camera
37$vpt = [-0.86, 1.98, 10.24];
38$vpr = [78.10, 0.00, 23.60];
39$vpd = 140.00;
40
41flare(
42 20 + 10 * sin($t*360*7 + 0),
43 30 + 10 * sin($t*360*5 + 90),
44 30 + 10 * sin($t*360*3 + 0)
45 );
46
47