changed the extrusion to include scaling in one axis, implemented a headband with catears and saved the geogebra file used to model everything here

This commit is contained in:
tessaK9 2026-03-12 10:48:09 +01:00
commit b5a30db507
3 changed files with 43 additions and 7 deletions

View file

@ -7,7 +7,7 @@ module extrusion(points){
polyhedron(points = points_new, faces = faces, convexity = 10); polyhedron(points = points_new, faces = faces, convexity = 10);
} }
module bezier_extrude(ctrl, shape, mod = function (t) 1, sections = 64){ module bezier_extrude(ctrl, shape, 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]);
@ -21,13 +21,11 @@ module bezier_extrude(ctrl, shape, mod = function (t) 1, sections = 64){
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) * n.x * v.x),p.y+(mod(t) * n.y * v.x), mod(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]]];
extrusion(slices); extrusion(slices);
} }
wave = function (x) 0.75+0.25*cos(3*360*x);
shape = [[0,0.5],[0.8,0],[0.5,-1],[-0.5,-1],[-0.8,0]]; shape = [[0,0.5],[0.8,0],[0.5,-1],[-0.5,-1],[-0.8,0]];
ctrl = [[0,0],[0,10],[10,0],[10,10]]; ctrl = [[0,0],[20,10],[0,20],[10,0]];
bezier_extrude(ctrl = ctrl, shape = shape, mod = wave); wave = function (x) 0.75+0.25*cos(3*360*x);
bezier_extrude(ctrl = ctrl, shape = shape, mod = wave, sections = 8192);

BIN
geogebra-catears.ggb Normal file

Binary file not shown.

38
headband_me.scad Normal file
View file

@ -0,0 +1,38 @@
use <bezierExtrusion.scad>;
thickness = 2.5;
height = 6;
rake_length = 2.2;
shape_band = [[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],
[thickness/2,-height/2+0.5]];
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]];
ctrl_ear1 = [[49,96],[58,112],[63,137],[61.5,141]];
ctrl_ear2 = [[61.5,141],[60,145],[42.5,140.5],[18,123]];
chamfer = 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 = 256);
mirror([1,0,0]) bezier_extrude(ctrl = ctrl_band, shape = shape_band, sections = 256);
bezier_extrude(ctrl = ctrl_end, shape = shape_band, mod_x = chamfer, sections = 32);
mirror([1,0,0]) bezier_extrude(ctrl = ctrl_end, shape = shape_band, mod_x = chamfer, sections = 64);
bezier_extrude(ctrl = ctrl_ear1, shape = shape_band, sections = 32);
bezier_extrude(ctrl = ctrl_ear2, shape = shape_band, sections = 32);
mirror([1,0,0]){
bezier_extrude(ctrl = ctrl_ear1, shape = shape_band, sections = 32);
bezier_extrude(ctrl = ctrl_ear2, shape = shape_band, sections = 32);
}
bezier_extrude(ctrl = ctrl_rake, shape = shape_rake, mod = rake, sections = 512);
}