catears-v2/headband.scad

35 lines
No EOL
1.4 KiB
OpenSCAD

use <bezierExtrusion.scad>;
module headband(thickness, height){
rake_length = 2.5;
shape_band = [[thickness/2,height/2-0.5],
[thickness/2,-height/2+0.5],
[thickness/2-0.5,-height/2],
[-thickness/2+0.5,-height/2],
[-thickness/2,-height/2+0.5],
[-thickness/2,height/2-0.5],
[-thickness/2+0.5,height/2],
[thickness/2-0.5,height/2]];
shape_rake = [[0,-height/2],
[0,height/2],
[rake_length,height/2-2],
[rake_length,-height/2+2]];
ctrl_band = [[21,0],[77,56],[56,126],[0,126]];
ctrl_end = [[21,0],[20,-1],[18,-4],[17,-10]];
ctrl_rake = [[-52,86],[-40,139.5],[40,139.5],[52,86]];
fillet = function (t) (t < 0.75) ? 1 : sqrt(1-((4*t)-3)^2)/1.5 + 0.33;
rake = function (t) (-cos(64 * 360 * t) > 0.33) ? 1 : 0.1;
union(){
bezier_extrude(ctrl = ctrl_band, shape = shape_band, sections = 128);
mirror([1,0,0]) bezier_extrude(ctrl = ctrl_band, shape = shape_band, sections = 128);
bezier_extrude(ctrl = ctrl_end, shape = shape_band, mod_x = fillet, sections = 16);
mirror([1,0,0]) bezier_extrude(ctrl = ctrl_end, shape = shape_band, mod_x = fillet, sections = 16);
bezier_extrude(ctrl = ctrl_rake, shape = shape_rake, mod_x = rake, sections = 512);
}
}
headband(thickness = 2.5, height = 5.5);