44 lines
1 KiB
OpenSCAD
44 lines
1 KiB
OpenSCAD
$fn = 200;
|
|
|
|
w = 1;
|
|
h = 1;
|
|
|
|
function fn(a, b) = round(sqrt(pow(a[0]-b[0],2) + (pow(a[1]-b[1], 2))));
|
|
|
|
module shape(i) cylinder(h, max(w/2*((i^2.1)*0.01),0.5), max(w/2*((i^2.1)*0.01),0.5), $fn=12);
|
|
|
|
function b_pts(pts, n, idx) =
|
|
len(pts)>2 ?
|
|
b_pts([for(i=[0:len(pts)-2])pts[i]], n, idx) * n*idx
|
|
+ b_pts([for(i=[1:len(pts)-1])pts[i]], n, idx) * (1-n*idx)
|
|
: pts[0] * n*idx
|
|
+ pts[1] * (1-n*idx);
|
|
|
|
module b_curve(pts)
|
|
let (idx=fn(pts[0], pts[len(pts)-1]), n = 1/idx) {
|
|
for (i= [0:idx-1])
|
|
hull(){
|
|
translate(b_pts(pts, n, i)) shape(i); // change i to 1 for constant with
|
|
translate(b_pts(pts, n, i+1)) shape(i); // change i to 1 for constant with
|
|
};
|
|
}
|
|
|
|
module spike() {
|
|
polygon([[0, 0], [10, 0], [5, 50]]);
|
|
}
|
|
|
|
blade = 8;
|
|
|
|
module fan() {
|
|
for (i = [0 : blade]){
|
|
rotate( i * 360/blade, [0, 0, 1])
|
|
b_curve([[0, 0], [20, 30], [10, 45], [0, 37]]);
|
|
}
|
|
|
|
cylinder(h, d = 35);
|
|
}
|
|
|
|
difference() {
|
|
fan();
|
|
cylinder(h, d = 5);
|
|
};
|