-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtrefoil_knot.scad
56 lines (45 loc) · 1.01 KB
/
trefoil_knot.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
// size of the knot
size = 10;
// step every degree, less is more points and moother curve but longer to compute
step = 3;
// use sphere as dot else cube
useSphere = true;
// sphere or cube size
sphereSize = 1;
// use hull() to smooth the curve
useHull = true;
// sphere resolution
$fn = 50;
Trefoil_knot() {
if (useSphere) {
sphere(sphereSize);
} else {
cube(sphereSize);
}
}
module Trefoil_knot() {
for(i = [0:step:360 - step]) {
if (useHull) {
hull() {
dot(i) {
children(0);
}
dot(i + step) {
children(0);
}
}
} else {
dot(i) {
children(0);
}
}
}
}
// 2 stroke infinity symbol
// https://en.wikipedia.org/wiki/Lemniscate_of_Bernoulli
// https://en.wikipedia.org/wiki/Trefoil_knot
function trefoil_knot(angle) = [size / 2 * (sin(angle) + 2 * sin(2 * angle)), size / 2 * (cos(angle) - 2 * cos(2 * angle)), size / 2 * (-sin(3 * angle))];
module dot(angle) {
translate(trefoil_knot(angle))
children(0);
}