#declare chrome = texture { pigment { color rgbf < 0.5 0.5 0.5 0>} finish { diffuse 0.1 specular 0.5 reflection 0.5 roughness 0.005 metallic } } //#declare chrome = texture { pigment { color rgbf < 0.5 0.5 0.5 0>} finish { diffuse 0.5 specular 0.5 reflection 0.0 roughness 0.005 metallic } } #declare glow = texture { pigment { color rgb <1,1,1> } finish { ambient 0.9 } } #declare mirror = texture { pigment { color rgbf < 0 0 0 0>} finish { diffuse 0 ambient 0 specular 0 reflection 1 roughness 0.005 } } //this macro makes knurl teeth to be subtracted from a cylinder #macro knurl_teeth(k_x, k_y, from_z,to_z,k_radius,k_space) #local k_num=int(k_radius*2*3.14159/k_space); #local k_ang=360/k_num; #local k_i=0; #while (k_i rotate 45*z translate (k_radius)*y rotate (k_ang*k_i*z) translate } #local k_i = k_i+1; #end #end #macro mag_mirror(base_lr,mid_lr,head_lr,head_ud) union { //base cylinder { <0,0,0> <0,0,0.6> 2 } cylinder { <0,0,0> <0,0,0.75> 1.85 } torus { 1.85 .15 rotate 90*x translate 0.6*z } //screws difference { union { cylinder { <-1.5,0,0> <-1.5,0,0.85> 0.2 } sphere { <-1.5,0,0.85> 0.2 } } knurl_teeth(-1.5,0, 0,1, 0.2,0.03) } difference { union { cylinder { <1.5,0,0> <1.5,0,0.85> 0.2 } sphere { <1.5,0,0.85> 0.2 } } knurl_teeth(1.5,0, 0,1, 0.2,0.03) } difference { union { cylinder { <-0.9,-0.9,0> <-0.9,-0.9,1> 0.14 } torus { 0.11 0.03 rotate 90*x translate <-0.9,-0.9,1> } sphere { <-0.9,-0.9,1.08> 0.14 } } knurl_teeth(-0.9,-0.9, 0,1.03, 0.14,0.03) } //part of the hinge that attaches to the base union { //top half box { <-0.12,0.91,-0.2> <0.12,0.33,-0.5> } cylinder { <0,0.5,0> <0,0.91,0> 0.34 } //caps the top to match torus torus { 0.34 0.01 translate 0.32*y } cylinder { <0,0.32,0> <0,0.9,0> 0.35 } torus { 0.34 0.01 translate 0.9*y } //bottom half, with detailing difference { union { box { <-0.12,-0.91,-0.2> <0.12,-0.33,-0.5> } torus { 0.34 0.01 translate -0.9*y } cylinder { <0,-0.9,0> <0,-0.32,0> 0.35 } torus { 0.34 0.01 translate -0.32*y } cylinder { <0,-0.91,0> <0,-0.5,0> 0.34 } } difference { cylinder { <0,-0.7,0> <0,-1,0> 0.28 } cylinder { <0,-0.7,0> <0,-1,0> 0.27 } } cylinder { <-0.02,-1.29,0> <0.02,-1.29,0> 0.45 rotate 25*y } cylinder { <-0.02,-1.29,0> <0.02,-1.29,0> 0.45 rotate 115*y } } translate <0,0.3,1.15> } //this is the whole arm structure and mirror assembly, arranaged from //the base outward union { //first (base-mounted) vertical hinge and arm torus { 0.34 0.01 translate -0.3*y } cylinder { <0,-0.3,0> <0,0.3,0> 0.35 } torus { 0.34 0.01 translate 0.3*y } cylinder { <0,0,0> <0,0,3> 0.15 } //arm //bottom half of next hinge that rotates at end of arm difference { union { torus { 0.34 0.01 translate -0.9*y } cylinder { <0,-0.9,0> <0,-0.32,0> 0.35 } torus { 0.34 0.01 translate -0.32*y } cylinder { <0,-0.91,0> <0,-0.5,0> 0.34 } } difference { cylinder { <0,-0.7,0> <0,-1,0> 0.28 } cylinder { <0,-0.7,0> <0,-1,0> 0.27 } } cylinder { <-0.02,-1.29,0> <0.02,-1.29,0> 0.45 rotate -10*y } cylinder { <-0.02,-1.29,0> <0.02,-1.29,0> 0.45 rotate 80*y } translate <0,0.6,3> } union { //top half of hinge -- this segment rotates around this cylinder { <0,0,0> <0,0.31,0> 0.34 } torus { 0.34 0.01 translate 0.3*y } cylinder { <0,-0.3,0> <0,0.3,0> 0.35 } torus { 0.34 0.01 translate -0.3*y } //arm cylinder { <0,0,0> <0,0,2> 0.15 } //bottom half of next hinge difference { union { torus { 0.34 0.01 translate -0.9*y } cylinder { <0,-0.9,0> <0,-0.32,0> 0.35 } torus { 0.34 0.01 translate -0.32*y } cylinder { <0,-0.91,0> <0,-0.5,0> 0.34 } } difference { cylinder { <0,-0.7,0> <0,-1,0> 0.28 } cylinder { <0,-0.7,0> <0,-1,0> 0.27 } } cylinder { <-0.02,-1.29,0> <0.02,-1.29,0> 0.45 rotate 35*y } cylinder { <-0.02,-1.29,0> <0.02,-1.29,0> 0.45 rotate 125*y } translate <0,0.6,2> } union { //third (last) vertical hinge //top half of hinge cylinder { <0,0,0> <0,0.31,0> 0.34 } torus { 0.34 0.01 translate 0.3*y } cylinder { <0,-0.3,0> <0,0.3,0> 0.35 } torus { 0.34 0.01 translate -0.3*y } //center of horizontal hinge that is attached to this hinge union { torus { 0.34 0.01 rotate 90*z translate 0.3*x } cylinder { <-0.3,0,0> <0.3,0,0> 0.35 } torus { 0.34 0.01 rotate 90*z translate -0.3*x } translate 0.5*z } union { //horizontal (mirror-mounted) hinge torus { 0.34 0.01 rotate 90*z translate -0.9*x } cylinder { <-0.9,0,0> <-0.32,0,0> 0.35 } torus { 0.34 0.01 rotate 90*z translate -0.32*x } torus { 0.34 0.01 rotate 90*z translate 0.32*x } cylinder { <0.9,0,0> <0.32,0,0> 0.35 } torus { 0.34 0.01 rotate 90*z translate 0.9*x } //horizontal hinge has end caps difference { intersection { sphere { <0,0,-0.6> 0.75 } box { <-2,-2,0> <2,2,2> } cylinder { <0,0,0> <0,0,2> 0.36 } } knurl_teeth(0,0, 0,1, 0.36,0.03) rotate -90*y translate -0.91*x } difference { intersection { sphere { <0,0,-0.6> 0.75 } box { <-2,-2,0> <2,2,2> } cylinder { <0,0,0> <0,0,2> 0.36 } } knurl_teeth(0,0, 0,1, 0.36,0.03) rotate 90*y translate 0.91*x } //horizontal hinge tightener union { sphere { <0,0,0> 0.1 } cone { <0,-0.09,0> 0.03 <0,-0.27,0> 0.08 } cone { <0,-0.27,0> 0.08 <0,-0.35,0> 0.04 } rotate -20*z rotate 40*x translate <-1.13,0,0> } //hinge-to-mirror case mounts box { <-0.9,-0.15,0.2> <-0.33,0.15,0.5> } box { <0.9,-0.15,0.2> <0.33,0.15,0.5> } // the mirror assembly union { // back of mirror case difference { union { cylinder { <0,0,0.1921> <0,0,0.45> 2.4379 } torus { 2.4379 0.25 rotate 90*x translate <0,0,0.4421> } cone { <0,0,0.7016> 4.4624 <0,0,0.2> 2.5 } torus { 4.45 0.05 rotate 90*x translate <0,0,0.75> } } //make it hollow, so we can put a light inside cone { <0,0,0.71> 4.35 <0,0,0.2> 2.4 } cylinder { <0,0,0.71> <0,0,0.75> 4.35 } //slits in back of case #local i=0; #while (i<36) #if (i!=0&i!=9&i!=18&i!=27) union { cylinder { <0,3.0,0.1> <0,3.0,0.8> 0.06 } box { <-0.06,3.0,0.1> <0.06,4.0,0.8> } cylinder { <0,4.0,0.1> <0,4.0,0.8> 0.06 } rotate (i*10)*z } #end #local i=i+1; #end //hole for light bulb access panel intersection { box { <-1.5,-4,0> <1.5,0,2> } cylinder { <0,0,0> <0,0,2> 2.0 } } } //light bulb access panel - hole edges intersection { box { <-1.5,-4,0> <1.5,0,2> } cylinder { <0,0,0> <0,0,2> 2.0 } union { cylinder { <-2,0,0.2421> <2,0,0.2421> 0.05 } cylinder { <-1.5,0,0.2421> <-1.5,-3,0.2421> 0.05 } cylinder { <1.5,0,0.2421> <1.5,-3,0.2421> 0.05 } torus { 2.0 0.05 rotate 90*x translate 0.2421*z } //should round out joints with little toruses, but I'm lazy } } //light bulb access panel difference { union { intersection { box { <-1.39,-4,0.1921> <1.39,-0.11,0.24> } cylinder { <0,0,0.18> <0,0,0.25> 1.89 } } cylinder { <-1.39,-0.11,0.2421> <1.39,-0.11,0.2421> 0.05 } cylinder { <-1.39,-0.11,0.2421> <-1.39,-1.2806,0.2421> 0.05 } cylinder { <1.39,-0.11,0.2421> <1.39,-1.2806,0.2421> 0.05 } sphere { <-1.39,-0.11,0.2421> 0.05 } sphere { <1.39,-0.11,0.2421> 0.05 } //for cylinder-torus joint; they don't completely fill gaps sphere { <-1.39,-1.2806,0.2421> 0.05 } sphere { <1.39,-1.2806,0.2421> 0.05 } intersection { torus { 1.89 0.05 rotate 90*x translate 0.2421*z } box { <-1.39,-4,0> <1.39,0,2> } } } //screw hole cylinder { <0,-1.7,0> <0,-1.7,2> 0.09 } //light bulb access panel - slits #local i=-3; #while (i<=3) #local bot_y=sqrt(1.6*1.6-(i/3)*(i/3)); #if (i=0) #local bot_y=1.4; #end cylinder { 0.06 } cylinder { 0.06 } box { } #local i=i+1; #end } //round out screw hole torus { 0.09 0.03 rotate 90*x translate <0,-1.7,0.2221> } //put screw head in screw hole difference { cone { <0,-1.7,0.18> 0.07 <0,-1.7,0.24> 0.01 } box { <-0.035,-0.01,-0.035> <0.035,0.01,0.035> rotate 45*y rotate 10*z translate <0,-1.7,0.18> } box { <-0.035,-0.01,-0.035> <0.035,0.01,0.035> rotate 45*y rotate 100*z translate <0,-1.7,0.18> } } //light source (used for light from slits, not for front light) //(an area light would probably be better for casting rough //shadows) light_source { <0,-0.7,1.5> color rgb <0.5,0.5,0.48> } // mirror case difference { union { cylinder { <0,0,0.75> <0,0,2.2> 4.5 } cylinder { <0,0,2.3> <0,0,2.75> 4.5 } torus { 4.45 0.05 rotate 90*x translate <0,0,2.2> } torus { 4.45 0.05 rotate 90*x translate <0,0,2.3> } } union { cylinder { <0,0,0.7> <0,0,2.85> 4.1 } sphere { <0,0,18> 15.80 } } } // front face - metal ring around light and mirror torus { 4.45 0.05 rotate 90*x translate <0,0,2.75> } difference { cylinder { <0,0,1.76> <0,0,2.80> 4.45 } cylinder { <0,0,1.76> <0,0,2.90> 4.25 } } torus { 4.25 0.17 rotate 90*x translate <0,0,2.63> } // circle of light difference { difference { cylinder { <0,0,1.75> <0,0,2.75> 4.1 } cylinder { <0,0,1.75> <0,0,2.75> 3.4 } } sphere { <0,0,18> 15.80 texture { glow } } } // mirror difference { cylinder { <0,0,1.77> <0,0,2.75> 3.4 } sphere { <0,0,18> 15.80 } texture { mirror } } translate <0,-0.6,0.25> } // this transform moves the horizontal hinge, and mirror assmbly rotate head_ud*x translate <0,0,0.5> } // this transform moves last vertical hinge, and outward, relative // to middle hinge rotate head_lr*y translate <0,0.6,2> } // this transform moves second arm and outwards, relative to first hinge rotate mid_lr*y translate <0,0.6,3> } // this transform moves everything (except the base) rotate base_lr*y translate <0,0.3,1.15> } texture { chrome } } #end