// BOLTNUT / Sphere with 8 Bolts Sept. '07 // by Tsutomu HIGO URL:http://www.asahi-net.or.jp/~nj2t-hg/ #version 3.6; global_settings { assumed_gamma 2.2 max_trace_level 6 } //BOLTNUT SIZE DATA #declare Sznut = array[2][6][8] { { { 5, 4.134, 5.4, 0.8, 8.79, 4.6, 3.5, 7.9}, { 6, 4.917, 6.4, 1.0,11.05, 5.1, 4.0, 9.9}, { 8, 6.647, 8.4,1.25,14.38, 6.6, 5.3,12.9}, {10, 8.376,10.4, 1.5,17.77, 8.2, 6.4,15.9}, {12,10.106,12.5,1.75,20.03,10.6, 7.5,17.9}, {16,13.835,16.7, 2.0,26.75,14.5,10.0,23.8} }, { { 5, 4.134, 5.4, 0.8, 8.79, 5.0, 3.5, 7.9}, { 6, 4.917, 6.4, 1.0,11.05, 5.6, 4.0, 9.9}, { 8, 6.647, 8.4,1.25,14.38, 7.3, 5.3,12.9}, {10, 8.376,10.4, 1.5,17.77, 9.1, 6.4,15.9}, {12,10.106,12.5,1.75,20.03,11.8, 7.5,17.9}, {16,13.835,16.7, 2.0,26.75,16.1,10.0,23.8} } } //Sznutstle : Sznut [A][*][*] A = 0-standard, 1-thick //Sznutsize : Sznut [*][B][*] B = 0-M5, 1-M6, 2-M8, 3-M10, 4-M12, 5-M16 //NUT #macro Nut (Sznutstle, Sznutsize, Nr0, C) #declare NatD = Sznut[Sznutstle][Sznutsize][4]; #declare NatW = Sznut[Sznutstle][Sznutsize][7]; #declare NatH = Sznut[Sznutstle][Sznutsize][5]; #declare NatId = Sznut[Sznutstle][Sznutsize][2]; #declare BoltH = Sznut[Sznutstle][Sznutsize][6]; #declare BoltD = 0.98*Sznut[Sznutstle][Sznutsize][0]; #declare Pich = Sznut[Sznutstle][Sznutsize][3]; intersection { cylinder {-1*y, 1.2*NatH*y, BoltD/2/0.98-Pich*1.732/1.828/8*4.5 inverse} #if (C = 1) box {<0, -1, -2*NatD/2> <2*NatW/2, 2*NatH, 0> rotate y*30 inverse} #end box {<-NatW/2, 0, -NatD/2> } box {<-NatW/2, -0.1, -NatD/2> rotate y* 60} box {<-NatW/2, -0.1, -NatD/2> rotate y*120} cone {1.00001*NatH*y, 0.99999*NatW/2, -0.00001*y, 0.99999*NatW/2+1.75*NatH} cone {1.00001*NatH*y, 0.99999*NatW/2+1.75*NatH, -0.00001*y, 0.99999*NatW/2} cone {1.00001*NatH*y, 0.99999*NatId/2, (1.00001*NatH-NatH/1.5)*y, 0 inverse} cone {-0.00001*y, 0.99999*NatId/2, (NatH/1.5)*y, 0 inverse} intersection { cylinder {-1*y, 1.2*NatH*y, BoltD/2/0.98} object { union { #declare N = int(1.2*NatH/Pich)+1; #while (N > -1) #declare Nr = Nr0; #while (Nr > 0) box { <-Pich/2, -Pich/2, -Pich/2> < Pich/2, Pich/2, Pich/2> rotate z*45 rotate x*-atan(Pich/(3.14*BoltD))*180/3.14*1.5 scale <1.732/1.828, 1/1.414, 1> translate x*(BoltD/2+Pich*1.732/1.828/8) translate y*(Pich*N-Pich/Nr0*Nr) rotate y*Nr/Nr0*360 } #declare Nr = Nr-1; #end #declare N = N-1; #end } inverse } inverse } } #end //BOLT #macro Bolt (Sznutstle, Sznutsize, Bl, Nbl, Bls, Nbls, Nr0) #declare NatD = Sznut[Sznutstle][Sznutsize][4]; #declare NatW = Sznut[Sznutstle][Sznutsize][7]; #declare NatH = Sznut[Sznutstle][Sznutsize][5]; #declare NatId = Sznut[Sznutstle][Sznutsize][2]; #declare BoltH = Sznut[Sznutstle][Sznutsize][6]; #declare BoltD = 0.98*Sznut[Sznutstle][Sznutsize][0]; #declare Pich = Sznut[Sznutstle][Sznutsize][3]; #declare BoltL = Bl-Nbl*Pich; #declare BoltLs = Bls-(Nbls+1)*Pich; merge { intersection { box {<-NatW/2, 0, -NatD/2> } box {<-NatW/2, -0.1, -NatD/2> rotate y* 60} box {<-NatW/2, -0.1, -NatD/2> rotate y*120} box {<-NatW/2, -0.1, -NatD/2> rotate y*120} cone {1.00001*BoltH*y, 0.99999*NatW/2, -0.00001*y, 0.99999*NatW/2+1.75*BoltH} } cylinder {0.001*y, -BoltLs*y, BoltD/2} intersection { //box {<-2*NatW/2, 1.1*BoltH, -2*NatD/2> <2*NatW/2, -1.1*BoltL, 0> rotate y*30 inverse} //cutting cone { -(BoltL+BoltD/2-Pich*0.7)*y, 0, 0*y, BoltL+BoltD/2-Pich*0.7 } cylinder {-BoltLs*y, -BoltL*y, BoltD/2} object { union { #declare N = int((BoltL-BoltLs)/Pich)+1; #while (N > -1) #declare Nr = Nr0; #while (Nr > 0) #if(N > 2) #declare Dd = 0; #else #declare Dd = Pich*1.732/1.828*7/8*(3*Nr0-N*Nr0-Nr)/2/Nr0; #end box {<-Pich/2, -Pich/2, -Pich/2> < Pich/2, Pich/2, Pich/2> rotate z*45 rotate x*-atan(Pich/(3.14*BoltD))*180/3.14*1.5 scale <1.732/1.828, 1/1.414, 1> translate x*(BoltD/2+Pich*1.732/1.828/8+Dd) translate y*-(BoltLs+Pich*N+Pich/Nr0*Nr) rotate y*Nr/Nr0*360 } #declare Nr = Nr-1; #end #declare N = N-1; #end } inverse } } } #end //MAIN camera { location <-300, 150, -100> angle 26 look_at <0, 0, 0> } light_source {<-50, 50, -200> color red 0.5 green 0.5 blue 0.5} #declare Texs = texture { pigment {color rgb <1, 1, 1>} finish { ambient .2 diffuse 1 reflection 0.8 specular 1 roughness 0.1 } } #declare Bolts= union { object {Bolt (0, 4, 50, 6, 5, 3, 24) rotate y*45 translate <0, 0, 0>} object {Nut (0, 4, 24, 0) rotate y*45 translate <0, -Pich*12, 0>} texture {Texs} no_shadow }; #declare Hole= union { object {Bolt (0, 4, 50, 6, 5, 3,24) rotate y*45 translate <0, 0, 0>} object {Nut (0, 4, 24, 0) rotate y*45 translate <0, -Pich*12, 0>} texture {Texs} no_shadow }; union { intersection { sphere {<0, 0, 0> 45} box {<-100, -40, -100> <100, 40, 100>} box {<-100, -40, -100> <100, 40, 100> rotate x*109.4712 rotate y*0 } box {<-100, -40, -100> <100, 40, 100> rotate x*109.4712 rotate y*120} box {<-100, -40, -100> <100, 40, 100> rotate x*109.4712 rotate y*240} object { Bolt (0, 4, 150, 6, 5, 3, 24) rotate y*45 translate <0, 59.5, 0> inverse} object { Bolt (0, 4, 150, 6, 5, 3, 24) rotate y*45 translate <0, 59.5, 0> rotate x*109.4712 rotate y*0 inverse} object { Bolt (0, 4, 150, 6, 5, 3, 24) rotate y*45 translate <0, 59.5, 0> rotate x*109.4712 rotate y*120 inverse} object { Bolt (0, 4, 150, 6, 5, 3, 24) rotate y*45 translate <0, 59.5, 0> rotate x*109.4712 rotate y*240 inverse} interior { ior 1.25 fade_distance 200 fade_power 1 caustics 1.0 } texture { pigment {color rgbt <0.3, 0.6, 1, 0.7>} finish { ambient .4 diffuse .5 reflection 0.6 specular 0.4 phong 0.8 roughness 0.1 } } } union {Bolts translate y*59.5 } union {Bolts rotate y*0 translate y*59.5 rotate x*109.4712} union {Bolts rotate y*0 translate y*59.5 rotate x*109.4712 rotate y*120} union {Bolts rotate y*0 translate y*59.5 rotate x*109.4712 rotate y*240} union {Bolts rotate y*180 translate y*59.5 rotate x*180} union {Bolts rotate y*180 translate y*59.5 rotate x*(180-109.4712) rotate y*300} union {Bolts rotate y*180 translate y*59.5 rotate x*(180-109.4712) rotate y*60 } union {Bolts rotate y*180 translate y*59.5 rotate x*(180-109.4712) rotate y*180} rotate <170, 110, 80> no_shadow } background {color rgbt <0.01, 0, 0.2>}