-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathsuperformula_vase.scad
72 lines (58 loc) · 1.61 KB
/
superformula_vase.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
use <trim_shape.scad>
use <bezier_curve.scad>
use <path_scaling_sections.scad>
use <sweep.scad>
use <ptf/ptf_rotate.scad>
use <bijection_offset.scad>
use <shape_superformula.scad>
/* [Superformula] */
phi_step = 0.025;
m = 8;
n = 5;
n3 = 8;
/* [Offset] */
d = 0.1;
/* [Curve] */
r1 = 1;
r2 = 2;
h1 = 5;
h2 = 8;
t_step = 0.025;
twist = 90;
module superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist) {
function cal_sections(shapt_pts, edge_path, twist) =
let(
sects = path_scaling_sections(shapt_pts, edge_path),
leng = len(sects),
twist_step = twist / leng
)
[
for(i = [0:leng - 1])
[
for(p = sects[i])
ptf_rotate(p, twist_step * i)
]
];
superformula = shape_superformula(phi_step, m, m, n, n, n3);
edge_path = bezier_curve(t_step, [
[1, 0, 0],
[4, 0, 3],
[2, 0, 4],
[r1, 0, h1],
[1, 0, 6],
[r2, 0, h2],
]);
offseted = bijection_offset(superformula, d, epsilon = 0.0000001);
edge_path2 = [for(p = edge_path) p + [d, 0, 0]];
superformula2 = trim_shape(offseted, 3, len(offseted) - 1, epsilon = 0.0001);
sections = cal_sections(superformula, edge_path, twist);
outer_sections = cal_sections(superformula2, edge_path2, twist);
difference() {
sweep(outer_sections);
sweep(sections);
}
linear_extrude(d)
rotate(twist - twist / len(sections))
polygon(superformula2);
}
superformula_vase(phi_step, m, n, n3, d, r1, r2, h1, h2, t_step, twist);