catears-v2/scad/catears.scad

64 lines
No EOL
1.8 KiB
OpenSCAD

use <base/bezier_extrusion.scad>;
use <base/headband.scad>;
use <base/smoothing.scad>;
thickness = 2.7;
height = 5.5;
epsilon = 0.001; //needs to be small but greater 0 so that the model doesn't break
smoothing = true;
module catear(){
ctrl_ear1 = [[49,96],[58,112],[63,137],[61.5,141]];
ctrl_ear2 = [[61.5+1.5*epsilon,141-4*epsilon],[60,145],[42.5,140.5],[18,123]];
shape_band = [[thickness/2,height/2-0.4],
[thickness/2,-height/2+0.4],
[thickness/2-0.4,-height/2],
[-thickness/2+0.4,-height/2],
[-thickness/2,-height/2+0.4],
[-thickness/2,height/2-0.4],
[-thickness/2+0.4,height/2],
[thickness/2-0.4,height/2]];
bezier_extrude(ctrl = ctrl_ear1, shape = shape_band, sections = 32);
bezier_extrude(ctrl = ctrl_ear2, shape = shape_band, sections = 32);
//smoothing the corners between ears and headband
if(smoothing){
//these values are approximations to intersections and tangents
c1 = [18.3,123.21];
v1 = [18.33,123.2];
v2 = [18.35,123.25];
v3 = [18.27,123.22];
c2 = [48.75,95.56];
v4 = [48.85,95.35];
v5 = [49,96];
v6 = [48.65,95.8];
k = 4; //pick k such that 0.4/k < layer height
for(i = [0 : k]){
linear_extrude(height-i*0.8/k, center = true, convexity = 10){
smoothing(v1,c1,v2,r=2.5,th=thickness/2-(k-i)*0.4/k);
smoothing(v2,c1,v3,r=4,th=thickness/2-(k-i)*0.4/k);
smoothing(v4,c2,v5,r=4,th=thickness/2-(k-i)*0.4/k);
smoothing(v5,c2,v6,r=2.5,th=thickness/2-(k-i)*0.4/k);
}
}
}
}
module catears(){
union(){
headband(thickness = thickness, height = height);
catear();
mirror([1,0,0]) catear();
}
}
catears();