-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtorus-tape-test.scad
More file actions
64 lines (45 loc) · 1.21 KB
/
Copy pathtorus-tape-test.scad
File metadata and controls
64 lines (45 loc) · 1.21 KB
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
use <dotSCAD/function_grapher.scad>
use <dotSCAD/path_extrude.scad>
r = 90 / 2;
R = 300 / 2;
k = 50;
ext_angle = asin(k / (2 * (R + r)));
D = R + r - (R - r) * sqrt(1 - (pow(k / (2 * (R + r)), 2)));
diff_h = (R - r) * (1 - sqrt(1 - (pow(k / (2 * (R + r)), 2))));
module torus_segment() {
rotate([0, 0, -ext_angle])
rotate_extrude(angle=2 * ext_angle, $fn=360)
translate([R, 0, 0])
circle(r=r);
translate([R - diff_h / 2, 0, 0])
rotate([90, 0, 0])
#cylinder(d=D, h=k, center=true);
}
p1 = [for (i=[-200:10:200])
[for (j=[-200:10:200])
[i, j, (i + R - diff_h / 2) * tan(ext_angle)]
]
];
shape = [for (i=[0:60:360]) [sin(i), cos(i)]];
path = [for (i = [0:0.5:360])
[D * sin(i) / 2,
D * cos(i) / 2,
(D * sin(i) / 2 + R - (diff_h) / 2) * tan(ext_angle)]
];
lin_path = [for (i=[0:5:360])
[
i * PI / 180 * D / 2,
0,
(D * cos(i) / 2 + R - (diff_h) / 2) * tan(ext_angle)
]
];
echo(lin_path);
// rotate([90, 0, 0])
// function_grapher(p2);
rotate([90, 0, 0])
path_extrude(shape, path);
path_extrude(shape, lin_path);
*%rotate([90, 0, 0])
function_grapher(p1);
translate([-R + diff_h / 2, 0, 0])
torus_segment($fn=120);