smoothed out the corners between catears and headband
This commit is contained in:
parent
b76d034e53
commit
8c0588eaf5
3 changed files with 49 additions and 1 deletions
18
scad/base/smoothing.scad
Normal file
18
scad/base/smoothing.scad
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
//smoothing smooths a corner, spanned by v1, v2 and v3 with radius r
|
||||
module smoothing(v1, v2, v3, r, th = 0){
|
||||
n1 = (v1-v2)/norm(v1-v2);
|
||||
n2 = (v3-v2)/norm(v3-v2);
|
||||
alpha = acos(n1*n2)/2;
|
||||
n3 = (n1+n2)/norm(n1+n2);
|
||||
|
||||
centre = v2+n3*(r/sin(alpha));
|
||||
l = r*sqrt((1/sin(alpha)^2)-1);
|
||||
|
||||
translate(th*n3){
|
||||
difference(){
|
||||
polygon([v2+l*n1,v2,v2+l*n2]);
|
||||
translate(centre)
|
||||
circle(r = r, $fn = 64);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
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]];
|
||||
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],
|
||||
|
|
@ -21,6 +23,34 @@ module catear(){
|
|||
|
||||
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(){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue