added modifier to partial extrusion to slightly change rake, slight changes to cat/dogears

This commit is contained in:
tessaK9 2026-03-13 13:14:25 +01:00
commit 8296c5e867
4 changed files with 26 additions and 25 deletions

View file

@ -15,7 +15,7 @@ module slice(points){
polyhedron(points = points_new, faces = faces, convexity = 10); polyhedron(points = points_new, faces = faces, convexity = 10);
} }
module bezier_extrude_partial(ctrl, shape, gap = 1, mod = function (t) 1, mod_x = function(t) 1, mod_y = function (t) 1, sections = 128){ module bezier_extrude_partial(ctrl, shape, merlon = 1, gap = 1, mod = function (t) 1, mod_x = function(t) 1, mod_y = function (t) 1, sections = 128){
B_0 = ctrl[0]; B_0 = ctrl[0];
B_1 = 3*(-ctrl[0] + ctrl[1]); B_1 = 3*(-ctrl[0] + ctrl[1]);
B_2 = 3*(ctrl[0] - 2*ctrl[1] + ctrl[2]); B_2 = 3*(ctrl[0] - 2*ctrl[1] + ctrl[2]);
@ -30,8 +30,8 @@ module bezier_extrude_partial(ctrl, shape, gap = 1, mod = function (t) 1, mod_x
slices = [for (i = [0 : sections]) slices = [for (i = [0 : sections])
let (t = i/sections, p = bezier(t), normal = normal(t), n = normal/norm(normal)) let (t = i/sections, p = bezier(t), normal = normal(t), n = normal/norm(normal))
[for (v = shape) [p.x+(mod(t) * mod_x(t) * n.x * v.x),p.y+(mod(t) * mod_x(t) * n.y * v.x), mod(t) * mod_y(t) * v.y]]]; [for (v = shape) [p.x+(mod(t) * mod_x(t) * n.x * v.x),p.y+(mod(t) * mod_x(t) * n.y * v.x), mod(t) * mod_y(t) * v.y]]];
for(i = [0 : 1+gap : sections-1]){ for(i = [0 : 1+gap : sections-merlon]){
slice([slices[i],slices[i+1]]); slice([slices[i],slices[i+merlon]]);
} }
} }

View file

@ -3,19 +3,20 @@ use <headband.scad>;
thickness = 2.7; thickness = 2.7;
height = 5.5; height = 5.5;
epsilon = 0.001;
module catear(){ module catear(){
ctrl_ear1 = [[49,96],[58,112],[63,137],[61.5,141]]; ctrl_ear1 = [[49,96],[58,112],[63,137],[61.5,141]];
ctrl_ear2 = [[61.5,141],[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.5], shape_band = [[thickness/2,height/2-0.25],
[thickness/2,-height/2+0.5], [thickness/2,-height/2+0.25],
[thickness/2-0.5,-height/2], [thickness/2-0.25,-height/2],
[-thickness/2+0.5,-height/2], [-thickness/2+0.25,-height/2],
[-thickness/2,-height/2+0.5], [-thickness/2,-height/2+0.25],
[-thickness/2,height/2-0.5], [-thickness/2,height/2-0.25],
[-thickness/2+0.5,height/2], [-thickness/2+0.25,height/2],
[thickness/2-0.5,height/2]]; [thickness/2-0.5,height/2]];
bezier_extrude(ctrl = ctrl_ear1, shape = shape_band, sections = 32); bezier_extrude(ctrl = ctrl_ear1, shape = shape_band, sections = 32);

View file

@ -21,4 +21,4 @@ module dogears(rightear = "flop", leftear = "flop"){
} }
} }
dogears(); dogears(rightear = "lflop");

View file

@ -3,26 +3,26 @@ use <bezier_extrusion.scad>;
module headband(thickness, height){ module headband(thickness, height){
rake_length = 3; rake_length = 3;
shape_band = [[thickness/2,height/2-0.5], shape_band = [[thickness/2,height/2-0.25],
[thickness/2,-height/2+0.5], [thickness/2,-height/2+0.25],
[thickness/2-0.5,-height/2], [thickness/2-0.25,-height/2],
[-thickness/2+0.5,-height/2], [-thickness/2+0.25,-height/2],
[-thickness/2,-height/2+0.5], [-thickness/2,-height/2+0.25],
[-thickness/2,height/2-0.5], [-thickness/2,height/2-0.25],
[-thickness/2+0.5,height/2], [-thickness/2+0.25,height/2],
[thickness/2-0.5,height/2]]; [thickness/2-0.25,height/2]];
shape_rake = [[0,-height/2], shape_rake = [[0,-height/2],
[0,height/2], [0,height/2],
[rake_length,height/2-2], [rake_length,height/2-2],
[rake_length,-height/2+2]]; [rake_length,-height/2+2]];
shape_halfband = [[thickness/2,height/2-0.5], shape_halfband = [[thickness/2,height/2-0.25],
[thickness/2,-height/2+0.5], [thickness/2,-height/2+0.25],
[thickness/2-0.5,-height/2], [thickness/2-0.25,-height/2],
[0,-height/2], [0,-height/2],
[0,height/2], [0,height/2],
[thickness/2-0.5,height/2]]; [thickness/2-0.25,height/2]];
ctrl_band = [[21,0],[77,56],[56,126],[0,126]]; ctrl_band = [[21,0],[77,56],[56,126],[0,126]];
ctrl_end = [[21,0],[20,-1],[18,-4],[17,-8]]; ctrl_end = [[21,0],[20,-1],[18,-4],[17,-8]];
@ -39,7 +39,7 @@ module headband(thickness, height){
translate([-17,-8]){ translate([-17,-8]){
rotate_extrude(convexity = 10, $fn = 16) polygon(shape_halfband); rotate_extrude(convexity = 10, $fn = 16) polygon(shape_halfband);
} }
bezier_extrude_partial(ctrl = ctrl_rake, shape = shape_rake, gap = 2, sections = 3*64+1); bezier_extrude_partial(ctrl = ctrl_rake, shape = shape_rake, merlon = 2, gap = 3, sections = 5*42+1 );
} }
} }