/* makes a sphere decorated with patterns that are arranged to display icosahedral symmetry pcm */ /* patterns are called indirectly through the decor_xx modules - decor_xx(x,y,z,scale,hthick,hrot,radius) where x,y,and z are the coordinates on the unit sphere that determine the position and orientation of the decoration scale is scale factor for decoration hthick is thickness of decoration in mm hrot is rotation about z axis before pattern is placed radius is distance from center of sphere to place decoration decor_14 calls cylinder(h=hthick,r=sc,center=true,$fn=96); decor_103 calls p20_01(sc,hthick,35,htrans) decor_102 calls p10_02(sc,hthick,35,htrans) decor_555a calls sierpinski(sc,hthick,35,htrans) decor_5c5 calls circle_01(sc,hthick,25,htrans) decor_5x5 calls rosette_03(sc,hthick,rsphere=35,hrot) decor_6x6 calls rosette_05(sc,hthick,rsphere=35,hrot) */ /* output is one of four spheres if i = 1 output is 35 mm truncated sphere decorated with a 10 ray rosette with two circles on each ray if i = 2 output is 35 mm truncated sphere decorated with a 20 ray rosette if i = 3 output is 35 mm truncated sphere decorated with a pattern of 3 Sierpinski triangles if i = 4 output is 35 mm truncated sphere decorated with 3 ray rosettes placed at the vertices of a dodecahedon, 5 ray rosettes placed at the centers of the faces of the above dodecahedron - and circles placed at the midpoints of the edges of the above dodecahedron */ //i= 1; //i = 2; i = 3; //i = 4; gr = (1 + sqrt(5))/2; rgr = 1/gr; norm = sqrt(1+gr*gr); norm2 = 5*gr/sqrt(3-gr); norm3 = 2*gr; // 22.23876 = atan(sqrt(3)*(sqrt(5)-2)) // thanks to d j moews for deriving this angle ang2 = 22.23876; ang1 = 60 - ang2; if (i == 1) translate ([0,0,29]) union() { // add base ring difference() { decor_14(0,0,-1,22,2,0,28); translate([0,0,1]) decor_14(0,0,-1,19,4,0,28); } difference() { sphere(r=35,center=true,$fn=96); // subtracts decorations decor_102( 0, 1/norm, gr/norm,.63,25,36,35.6); decor_102(0, -1/norm, gr/norm,.63,25,36,35.6); decor_102( 0, 1/norm, -gr/norm,.63,25,0,35.6); decor_102(0, -1/norm, -gr/norm,.63,25,0,35.6); decor_102( 1/norm, gr/norm, 0,.63,25,-18,35.6); decor_102(-1/norm, gr/norm, 0,.63,25,18,35.6); decor_102( 1/norm, -gr/norm, 0,.63,25,18,35.6); decor_102(-1/norm,-gr/norm,0,.63,25,-18,35.6); decor_102(gr/norm, 0, 1/norm,.63,25,0,35.6); decor_102(gr/norm, 0, -1/norm,.63,25,36,35.6); decor_102(-gr/norm, 0, 1/norm,.63,25,0,35.6); decor_102(-gr/norm, 0, -1/norm,.63,25,36,35.6); decor_14(0,0,-1,20,16,0,28); sphere(r=33,center=true,$fn=96); }} else if (i == 2) translate ([0,0,29]) union() { // add base ring difference() { decor_14(0,0,-1,22,2,0,28); translate([0,0,1]) decor_14(0,0,-1,19,4,0,28); } difference() { sphere(r=35,center=true,$fn=96); // subtracts decorations decor_103( 0, 1/norm, gr/norm,.63,25,36,35.6); decor_103(0, -1/norm, gr/norm,.63,25,36,35.6); decor_103( 0, 1/norm, -gr/norm,.63,25,0,35.6); decor_103(0, -1/norm, -gr/norm,.63,25,0,35.6); decor_103( 1/norm, gr/norm, 0,.63,25,-18,35.6); decor_103(-1/norm, gr/norm, 0,.63,25,18,35.6); decor_103( 1/norm, -gr/norm, 0,.63,25,18,35.6); decor_103(-1/norm,-gr/norm,0,.63,25,-18,35.6); decor_103(gr/norm, 0, 1/norm,.63,25,0,35.6); decor_103(gr/norm, 0, -1/norm,.63,25,36,35.6); decor_103(-gr/norm, 0, 1/norm,.63,25,0,35.6); decor_103(-gr/norm, 0, -1/norm,.63,25,36,35.6); decor_14(0,0,-1,20,16,0,28); sphere(r=33,center=true,$fn=96); }} else if (i == 3) translate ([0,0,29]) union() { // add base ring difference() { decor_14(0,0,-1,22,2,0,28); translate([0,0,1]) decor_14(0,0,-1,19,4,0,28); } difference() { sphere(r=35,center=true,$fn=96); // subtracts decorations decor_555a( 1.0/sqrt(3), 1.0/sqrt(3), 1.0/sqrt(3), .335,30,-ang1,35.6); decor_555a( 1.0/sqrt(3), 1.0/sqrt(3), -1.0/sqrt(3), .335,30,-ang2,35.6); decor_555a( 1.0/sqrt(3), -1.0/sqrt(3), 1.0/sqrt(3), .335,30, ang1,35.6); decor_555a( 1.0/sqrt(3), -1.0/sqrt(3), -1.0/sqrt(3), .335,30, ang2,35.6); decor_555a( -1.0/sqrt(3), 1.0/sqrt(3), 1.0/sqrt(3), .335,30, ang1,35.6); decor_555a( -1.0/sqrt(3), 1.0/sqrt(3), -1.0/sqrt(3), .335,30, ang2,35.6); decor_555a( -1.0/sqrt(3), -1.0/sqrt(3), 1.0/sqrt(3), .335,30,-ang1,35.6); decor_555a( -1.0/sqrt(3), -1.0/sqrt(3), -1.0/sqrt(3), .335,30,-ang2,35.6); decor_555a( 0.00000, rgr/sqrt(3) , gr/sqrt(3) ,.335,30,60,35.6); decor_555a( 0.00000, rgr/sqrt(3) , -gr/sqrt(3) ,.335,30,0,35.6); decor_555a( 0.00000, -rgr/sqrt(3) , gr/sqrt(3) ,.335,30,60,35.6); decor_555a( 0.00000, -rgr/sqrt(3) , -gr/sqrt(3) ,.335,30,0,35.6); decor_555a( rgr/sqrt(3) , gr/sqrt(3) , 0.00000,.335,30,30,35.6); decor_555a( rgr/sqrt(3) , -gr/sqrt(3) , 0.00000,.335,30,-30,35.6); decor_555a( -rgr/sqrt(3) , gr/sqrt(3) , 0.00000,.335,30,-30,35.6); decor_555a( -rgr/sqrt(3) , -gr/sqrt(3) , 0.00000,.335,30,30,35.6); decor_555a( gr/sqrt(3) , 0.00000, rgr/sqrt(3) ,.335,30, 0,35.6); decor_555a( gr/sqrt(3) , 0.00000, -rgr/sqrt(3) ,.335,30,60,35.6); decor_555a( -gr/sqrt(3) , 0.00000, rgr/sqrt(3) ,.335,30, 0,35.6); decor_555a( -gr/sqrt(3) , 0.00000, -rgr/sqrt(3) ,.335,30,60,35.6); decor_14(0,0,-1,20,16,0,28); sphere(r=33,center=true,$fn=96); } } else if (i ==4) translate ([0,0,29]) union() { // add base ring difference() { decor_14(0,0,-1,22,2,0,28); translate([0,0,1]) decor_14(0,0,-1,19,4,0,28); } difference() { sphere(r=35,center=true,$fn=96); //coordinates of vertices decor_5x5( 1.0/sqrt(3), 1.0/sqrt(3), 1.0/sqrt(3), .62,25,-ang1,35.6); decor_5x5( 1.0/sqrt(3), 1.0/sqrt(3), -1.0/sqrt(3), .62,25,-ang2,35.6); decor_5x5( 1.0/sqrt(3), -1.0/sqrt(3), 1.0/sqrt(3), .62,25, ang1,35.6); decor_5x5( 1.0/sqrt(3), -1.0/sqrt(3), -1.0/sqrt(3), .62,25, ang2,35.6); decor_5x5( -1.0/sqrt(3), 1.0/sqrt(3), 1.0/sqrt(3), .62,25, ang1,35.6); decor_5x5( -1.0/sqrt(3), 1.0/sqrt(3), -1.0/sqrt(3), .62,25, ang2,35.6); decor_5x5( -1.0/sqrt(3), -1.0/sqrt(3), 1.0/sqrt(3), .62,25,-ang1,35.6); decor_5x5( -1.0/sqrt(3), -1.0/sqrt(3), -1.0/sqrt(3), .62,25,-ang2,35.6); decor_5x5( 0.00000, rgr/sqrt(3) , gr/sqrt(3) ,.62,25,60,35.6); decor_5x5( 0.00000, rgr/sqrt(3) , -gr/sqrt(3) ,.62,25,0,35.6); decor_5x5( 0.00000, -rgr/sqrt(3) , gr/sqrt(3) ,.62,25,60,35.6); decor_5x5( 0.00000, -rgr/sqrt(3) , -gr/sqrt(3) ,.62,25,0,35.6); decor_5x5( rgr/sqrt(3) , gr/sqrt(3) , 0.00000,.62,25,30,35.6); decor_5x5( rgr/sqrt(3) , -gr/sqrt(3) , 0.00000,.62,25,-30,35.6); decor_5x5( -rgr/sqrt(3) , gr/sqrt(3) , 0.00000,.62,25,-30,35.6); decor_5x5( -rgr/sqrt(3) , -gr/sqrt(3) , 0.00000,.62,25,30,35.6); decor_5x5( gr/sqrt(3) , 0.00000, rgr/sqrt(3) ,.62,25, 0,35.6); decor_5x5( gr/sqrt(3) , 0.00000, -rgr/sqrt(3) ,.62,25,60,35.6); decor_5x5( -gr/sqrt(3) , 0.00000, rgr/sqrt(3) ,.62,25, 0,35.6); decor_5x5( -gr/sqrt(3) , 0.00000, -rgr/sqrt(3) ,.62,25,60,35.6); // coordinates of center of faces decor_6x6(0,(2+2*gr+rgr)/norm2,(2+gr)/norm2,.62,20,36,35.6); decor_6x6(0,-(2+2*gr +rgr)/norm2, (2+gr)/norm2,.62,20,36,35.6); decor_6x6(0,(2+2*gr +rgr)/norm2,-(2+gr)/norm2,.62,20,0,35.6); decor_6x6(0,-(2+2*gr +rgr)/norm2, -(2+gr)/norm2,.62,20,0,35.6); decor_6x6((2+2*gr +rgr)/norm2,(2+gr)/norm2,0,.62,20,-18,35.6); decor_6x6(-(2+2*gr +rgr)/norm2,(2+gr)/norm2,0,.62,20,18,35.6); decor_6x6((2+2*gr+rgr)/norm2,-(2+gr)/norm2,0,.62,20,18,35.6); decor_6x6(-(2+2*gr+rgr)/norm2,-(2+gr)/norm2,0,.62,20,-18,35.6); decor_6x6((2+gr)/norm2,0,(2+2*gr +rgr)/norm2,.62,20,0,35.6); decor_6x6((2+gr)/norm2,0, -(2+2*gr +rgr)/norm2,.62,20,36,35.6); decor_6x6(-(2+gr)/norm2,0,(2+2*gr+rgr)/norm2,.62,20,0,35.6); decor_6x6(-(2+gr)/norm2,0,-(2+2*gr +rgr)/norm2,.62,20,36,35.6); // coordinates of center of edges decor_5c5(0,0,2*gr/norm3, 2.6,25,0,35.6); decor_5c5(0,0,-2*gr/norm3, 2.6,25,0,35.6); decor_5c5(0,2*gr/norm3,0, 2.6,25,0,35.6); decor_5c5(0,-2*gr/norm3,0, 2.6,25,0,35.6); decor_5c5(2*gr/norm3,0,0, 2.6,25,0,35.6); decor_5c5(-2*gr/norm3,0,0, 2.6,25,0,35.6); decor_5c5(-1/norm3,-(1+rgr)/norm3,(1+gr)/norm3,2.6,25,0,35.6); decor_5c5(-1/norm3,(1+rgr)/norm3,(1+gr)/norm3, 2.6,25,0,35.6); decor_5c5(-1/norm3,(1+rgr)/norm3,-(1+gr)/norm3,2.6,25,0,35.6); decor_5c5(-1/norm3,-(1+rgr)/norm3,-(1+gr)/norm3,2.6,25,0,35.6); decor_5c5(1/norm3,(1+rgr)/norm3,(1+gr)/norm3, 2.6,25,0,35.6); decor_5c5(1/norm3,-(1+rgr)/norm3,(1+gr)/norm3, 2.6,25,0,35.6); decor_5c5(1/norm3,(1+rgr)/norm3,-(1+gr)/norm3, 2.6,25,0,35.6); decor_5c5(1/norm3,-(1+rgr)/norm3,-(1+gr)/norm3,2.6,25,0,35.6); decor_5c5(-(1+gr)/norm3,-1/norm3,(1+rgr)/norm3, 2.6,25,0,35.6); decor_5c5((1+gr)/norm3,-1/norm3,-(1+rgr)/norm3, 2.6,25,0,35.6); decor_5c5((1+gr)/norm3,-1/norm3,(1+rgr)/norm3, 2.6,25,0,35.6); decor_5c5(-(1+gr)/norm3,-1/norm3,-(1+rgr)/norm3, 2.6,25,0,35.6); decor_5c5(-(1+gr)/norm3,1/norm3,(1+rgr)/norm3, 2.6,25,0,35.6); decor_5c5((1+gr)/norm3,1/norm3,(1+rgr)/norm3, 2.6,25,0,35.6); decor_5c5((1+gr)/norm3,1/norm3,-(1+rgr)/norm3, 2.6,25,0,35.6); decor_5c5(-(1+gr)/norm3,1/norm3,-(1+rgr)/norm3,2.6,25,0,35.6); decor_5c5((1+rgr)/norm3,(1+gr)/norm3,-1/norm3, 2.6,25,0,35.6); decor_5c5(-(1+rgr)/norm3,(1+gr)/norm3,-1/norm3,2.6,25,0,35.6); decor_5c5((1+rgr)/norm3,-(1+gr)/norm3,-1/norm3,2.6,25,0,35.6); decor_5c5(-(1+rgr)/norm3,-(1+gr)/norm3,-1/norm3,2.6,25,0,35.6); decor_5c5(-(1+rgr)/norm3,(1+gr)/norm3,1/norm3, 2.6,25,0,35.6); decor_5c5((1+rgr)/norm3,(1+gr)/norm3,1/norm3, 2.6,25,0,35.6); decor_5c5((1+rgr)/norm3,-(1+gr)/norm3,1/norm3, 2.6,25,0,35.6); decor_5c5(-(1+rgr)/norm3,-(1+gr)/norm3,1/norm3,2.6,25,0,35.6); decor_14(0,0,-1,20,16,0,28); sphere(r=33,center=true,$fn=96); } } module decor_14(x2,y2,z2,sc,hthick,htrans,r2) { translate(v=[r2*x2,r2*y2,r2*z2]) rotate(a = [-acos(z2/sqrt(x2*x2+y2*y2+z2*z2)), 0, -atan2(x2, y2)]) translate([0,0,htrans]) cylinder(h=hthick,r=sc,center=true,$fn=96); } module decor_5c5(x2,y2,z2,sc,hthick,htrans,r2) { translate(v=[r2*x2,r2*y2,r2*z2]) rotate(a = [-acos(z2/sqrt(x2*x2+y2*y2+z2*z2)), 0, -atan2(x2, y2)]) circle_01(sc,hthick,35,htrans); } module decor_5x5(x2,y2,z2,sc,hthick,htrans,r2) { translate(v=[r2*x2,r2*y2,r2*z2]) rotate(a = [-acos(z2/sqrt(x2*x2+y2*y2+z2*z2)), 0, -atan2(x2, y2)]) rosette_03(sc,hthick,35,htrans); } module decor_6x6(x2,y2,z2,sc,hthick,htrans,r2) { translate(v=[r2*x2,r2*y2,r2*z2]) rotate(a = [-acos(z2/sqrt(x2*x2+y2*y2+z2*z2)), 0, -atan2(x2, y2)]) rosette_05(sc,hthick,35,htrans); } module rosette_03(scx,ht,rr,htrans) { rotate([0,180,0]) intersection() { translate ([0,0,rr]) difference() { sphere(r=rr,center=true,$fn=96); sphere(r=rr-1.5,center=true,$fn=96); } scale(scx,scx,1) rotate([0,0,htrans]) linear_extrude(height=ht) import ("dxf_files/rosette_03.dxf"); } } module rosette_05(scx,ht,rr,htrans) { rotate([0,180,0]) intersection() { translate ([0,0,rr]) difference() { sphere(r=rr,center=true,$fn=96); sphere(r=rr-1.5,center=true,$fn=96); } scale(scx,scx,1) rotate([0,0,htrans]) linear_extrude(height=ht) import ("dxf_files/rosette_05.dxf"); } } module circle_01(scx,ht,rr,htrans) { rotate([0,180,0]) intersection() { translate ([0,0,rr]) difference() { sphere(r=rr,center=true,$fn=96); sphere(r=rr-1.5,center=true,$fn=96); } scale(scx,scx,1) rotate([0,0,htrans]) linear_extrude(height=ht) circle(r=1,$fn=48); } } module decor_102(x2,y2,z2,sc,hthick,htrans,r2) { translate(v=[r2*x2,r2*y2,r2*z2]) rotate(a = [-acos(z2/sqrt(x2*x2+y2*y2+z2*z2)), 0, -atan2(x2, y2)]) p10_02(sc,hthick,35,htrans); } module p10_02(scx,ht,rr,htrans) { rotate([0,180,0]) intersection() { translate ([0,0,rr]) difference() { sphere(r=rr,center=true,$fn=96); sphere(r=rr-1.5,center=true,$fn=96); } scale(scx,scx,1) rotate([0,0,htrans]) linear_extrude(height=ht) import ("dxf_files/p10.dxf"); } } module decor_103(x2,y2,z2,sc,hthick,htrans,r2) { translate(v=[r2*x2,r2*y2,r2*z2]) rotate(a = [-acos(z2/sqrt(x2*x2+y2*y2+z2*z2)), 0, -atan2(x2, y2)]) p20_01(sc,hthick,35,htrans); } module p20_01(scx,ht,rr,htrans) { rotate([0,180,0]) intersection() { translate ([0,0,rr]) difference() { sphere(r=rr,center=true,$fn=96); sphere(r=rr-1.5,center=true,$fn=96); } scale(scx,scx,1) rotate([0,0,htrans]) linear_extrude(height=ht) import ("dxf_files/p20.dxf"); } } module decor_555a(x2,y2,z2,sc,hthick,htrans,r2) { translate(v=[r2*x2,r2*y2,r2*z2]) rotate(a = [-acos(z2/sqrt(x2*x2+y2*y2+z2*z2)), 0, -atan2(x2, y2)]) sierpinski(sc,hthick,35,htrans); } module sierpinski(scx,ht,rr,htrans) { rotate([0,180,0]) intersection() { translate ([0,0,rr]) difference() { sphere(r=rr,center=true,$fn=96); sphere(r=rr-1.5,center=true,$fn=96); } scale(scx,scx,1) rotate([0,0,htrans]) linear_extrude(height=ht) import ("dxf_files/sierpinski_triangle_3.dxf"); } }