diff --git a/bezierExtrusion.scad b/bezierExtrusion.scad index 8b8590d..de1da09 100644 --- a/bezierExtrusion.scad +++ b/bezierExtrusion.scad @@ -7,7 +7,7 @@ module extrusion(points){ 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_1 = 3*(-ctrl[0] + ctrl[1]); 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]) 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); } -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]]; -ctrl = [[0,0],[0,10],[10,0],[10,10]]; -bezier_extrude(ctrl = ctrl, shape = shape, mod = wave); \ No newline at end of file +ctrl = [[0,0],[20,10],[0,20],[10,0]]; +wave = function (x) 0.75+0.25*cos(3*360*x); +bezier_extrude(ctrl = ctrl, shape = shape, mod = wave, sections = 8192); \ No newline at end of file diff --git a/geogebra-catears.ggb b/geogebra-catears.ggb new file mode 100644 index 0000000..6feb030 Binary files /dev/null and b/geogebra-catears.ggb differ diff --git a/headband_me.scad b/headband_me.scad new file mode 100644 index 0000000..1c03be0 --- /dev/null +++ b/headband_me.scad @@ -0,0 +1,38 @@ +use ; + +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); +} \ No newline at end of file