diff --git a/bezier_extrusion.scad b/bezier_extrusion.scad index b59ec2d..a759aa6 100644 --- a/bezier_extrusion.scad +++ b/bezier_extrusion.scad @@ -1,3 +1,4 @@ +// extrusion takes a list of polygons (list of points in 3d space) and connects these into one big polyeder module extrusion(points){ //points[0] must have its points ordered clockwise n = len(points); @@ -8,12 +9,13 @@ module extrusion(points){ polyhedron(points = points_new, faces = faces, convexity = 10); } +//ctrl is a list containing 4 control points of the bezier curve. shape is polygon in the 2d plane which is being extruded. mod is a function [0,1] -> |R scaling the shape, mod_x in the x-direction (of the shape), mod_y in the y-direction. if partial is true, then the polyeder is rendered in slices with length given by merlon and gap size given by gap, section defines the number of sections the bezier curve is broken into module bezier_extrude(ctrl, shape, mod = function (t) 1, mod_x = function(t) 1, mod_y = function (t) 1, partial = false, merlon = 1, gap = 1, sections = 128){ B_0 = ctrl[0]; B_1 = 3*(-ctrl[0] + ctrl[1]); B_2 = 3*(ctrl[0] - 2*ctrl[1] + ctrl[2]); B_3 = -ctrl[0] + 3*(ctrl[1] - ctrl[2]) + ctrl[3]; - function bezier(t) = B_0 + t*B_1 + (t^2)*B_2 + (t^3)*B_3; + function bezier(t) = B_0 + t*B_1 + (t^2)*B_2 + (t^3)*B_3; Bn_0 = [B_1.y,-B_1.x]; Bn_1 = [2*B_2.y,(-2)*B_2.x]; @@ -33,6 +35,7 @@ module bezier_extrude(ctrl, shape, mod = function (t) 1, mod_x = function(t) 1, } } +//some thing to play arounf with shape = [[0,0.5],[0.8,0],[0.5,-1],[-0.5,-1],[-0.8,0]]; ctrl = [[0,0],[0,20],[20,20],[20,0]]; wave1 = function (x) 0.75+0.25*cos(8*360*x); diff --git a/catears.scad b/catears.scad index e969819..bf73e73 100644 --- a/catears.scad +++ b/catears.scad @@ -3,7 +3,7 @@ use ; thickness = 2.7; height = 5.5; -epsilon = 0.001; +epsilon = 0.001; //needs to be small but greater 0 so that the model doesn't break module catear(){ diff --git a/dogear.scad b/dogear.scad index 9fd6dec..9fbb113 100644 --- a/dogear.scad +++ b/dogear.scad @@ -1,18 +1,19 @@ use ; +//a1, a2, a3, a4 are the four angles of the pairs of hinges on the ear from bottom to tip module dogearAllOptions(a1, a2, a3, a4){ translate([25,0,0]){ union(){ linear_extrude(height = 6, center = false, convexity = 10){ polygon(points = [[-33,0],[-25,0],[-25,7]]); } - hinge(a1, lb = 25, la = 5.5); - translate([12.5,0,0]) hinge(a2, lb = 0, la = 5.5); - translate([25,0,0]) hinge(a3, lb = 0, la = 5.5); + hinge(a1, len_before = 25, len_after = 5.5); + translate([12.5,0,0]) hinge(a2, len_after = 5.5); + translate([25,0,0]) hinge(a3, len_after = 5.5); - translate([0,37,0]) hinge(a1, lb = 8, la = 5.5); - translate([12.5,37,0]) hinge(a2, lb = 0, la = 5.5); - translate([25,37,0]) hinge(a3, lb = 0, la = 8); + translate([0,37,0]) hinge(a1, len_before = 8, len_after = 5.5); + translate([12.5,37,0]) hinge(a2, len_after = 5.5); + translate([25,37,0]) hinge(a3, len_after = 8); translate([34,0,0]){ cube([7,18.5,6]); @@ -23,11 +24,11 @@ module dogearAllOptions(a1, a2, a3, a4){ translate([40,11,0]){ rotate(-45,[0,0,1]){ - hinge(a4, lb = 7, la = 7); + hinge(a4, len_before = 7, len_after = 7); translate([14.1,3.5,0]){ cylinder(h = 6, r = 3.5, center = false, $fn=32); } - translate([0,17.3,0]) hinge(a4, lb = 21, la = 24.6); + translate([0,17.3,0]) hinge(a4, len_before = 21, len_after = 24.6); translate([31.4,20.8,0]) cylinder(h = 6, r = 3.5, center = false, $fn=32); } } diff --git a/dogears.scad b/dogears.scad index 4a4f41b..90110ef 100644 --- a/dogears.scad +++ b/dogears.scad @@ -3,6 +3,7 @@ use ; thickness = 2.7; +//options for ears include low flopness ("lflop"), regular flopness ("flop"), high flopness ("vflop"), very high flopness ("vvflop"), very very high flopness ("vvvflop") module dogears(rightear = "flop", leftear = "flop"){ union() { translate([54,96,-3]){ @@ -17,8 +18,9 @@ module dogears(rightear = "flop", leftear = "flop"){ } } } + //height needs to be 6 since the dogears are 6 high headband(thickness = thickness, height = 6); } } -dogears(rightear = "lflop"); \ No newline at end of file +dogears(); \ No newline at end of file diff --git a/geogebra-catears.ggb b/geogebra-catears.ggb deleted file mode 100644 index 6feb030..0000000 Binary files a/geogebra-catears.ggb and /dev/null differ diff --git a/headband.scad b/headband.scad index ed50209..c64c0ea 100644 --- a/headband.scad +++ b/headband.scad @@ -39,7 +39,7 @@ module headband(thickness, height){ translate([-17,-8]){ rotate_extrude(convexity = 10, $fn = 16) polygon(shape_halfband); } - bezier_extrude(ctrl = ctrl_rake, shape = shape_rake, partial = true, merlon = 2, gap = 3, sections = 5*42+1 ); + bezier_extrude(ctrl = ctrl_rake, shape = shape_rake, partial = true, merlon = 2, gap = 3, sections = (2+3)*42+1); } } diff --git a/hinge.scad b/hinge.scad index 9a95024..1ab23f9 100644 --- a/hinge.scad +++ b/hinge.scad @@ -1,4 +1,5 @@ -module hinge(deg, lb, la){ +//deg is the amount in degrees the hinge should be able to pivot, len_before the length of the section before the hinge, len_after the length of the section after the hinge +module hinge(deg, len_before = 0, len_after = 0){ cut_points = [[6,0,5.5], [6,7,5.5], @@ -47,7 +48,7 @@ module hinge(deg, lb, la){ rotate(90, [1,0,0]) cylinder(h = 4.5, r = 1.25, center = true, $fn = 16); } translate([3,2.5,2.25]) cube([4,2,2.5], center = false); - translate([-lb,0,0]) cube([lb,7,6], center = false); - translate([7,0,0]) cube([la,7,6], center = false); + translate([-len_before,0,0]) cube([len_before,7,6], center = false); + translate([7,0,0]) cube([len_after,7,6], center = false); } } \ No newline at end of file