-
Notifications
You must be signed in to change notification settings - Fork 41
/
ogive.scad
56 lines (46 loc) · 1.4 KB
/
ogive.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
module arch(x,y,r) {
union() {
intersection () {
translate([x,y,0]) circle(r);
translate([-x,y,0]) circle(r);
}
translate([0,y/2,0]) square(size=[2 *(r-x), y],center=true);
}
}
module ogive_arch(width,height,sharpness) {
assign(base=width/2, length = width * sharpness)
assign(radius = (base * base + length * length) / (2 * base))
assign(x= radius - base,y = height-length)
arch(x,y,radius);
}
module ogive_archway(width,height,sharpness,thickness) {
difference () {
ogive_arch(width,height,sharpness);
ogive_arch(width- 2* thickness,height-thickness,sharpness);
}
}
module ogive_solid_archway(width,height,sharpness,thickness,depth) {
linear_extrude(height=depth)
ogive_archway(width,height,sharpness,thickness);
}
function v_sum_r(v,n,k) =
k > n ? 0 : v[k] + v_sum_r(v,n,k+1);
function v_sum(v,n) = v_sum_r(v,n-1,0);
module variable_nested_archway (width,height,sharpness,thickness,depth,n) {
union() {
for (i=[0:n-1]) {
assign(dt = v_sum(thickness,i+1) ) {
ogive_solid_archway(width + 2 * dt, height+ dt, sharpness,thickness[i],depth[i]);
}
}
}
}
module remove_ground() {
difference() {
child(0);
translate([0,-49.9,0]) cube([100,100,100],center=true);
}
}
$fa = 0.01; $fs = 0.5;
remove_ground()
variable_nested_archway(15,30,0.8,[2,4,2,4],[1,3,5,7],4);