// CHERRY / Coil in the white '04.04 // by Tsutomu HIGO URL: http://www.asahi-net.or.jp/~nj2t-hg/ #version 3.5; global_settings { max_trace_level 4 assumed_gamma 2.2 } camera { location <0, -50, -240> angle 78 look_at <-50, -115, 0> } #declare Media = media { emission 0.05 intervals 10 samples 1, 1 confidence 0.9999 variance 1/100 density { crackle turbulence 0.4 color_map { [0.3 color rgbt <0, 0, 0, 1>] [0.4 color rgb <0, 0.3, 0>] [0.5 color rgb <0, 0, 0.4>] [0.9 color rgb <1, 1, 1>] } scale <5, 30, 5> } } #macro coil (R, N, A0, Av) // N is the number of winding merge { intersection { box { <-2, -2, -2>, <2, 2, 0> } sphere { <0, 0, 0>, R } } #declare Xdi = 0; #declare Yi = 0; #declare I = 1; #while (I < 2*N+2) intersection { box { <-2*I-2, -2*I-2, (-2*I-2)*(0.5+0.5*pow(-1,I))>, <2*I+2, 2*I+2, (2*I+2)*(0.5+0.5*pow(-1,I+1))> } torus { 2*I, R } rotate z*-pow(-1,I)*(A0*cos(I*Av)) #declare Xi = Xdi+pow(-1,I)*2*I*cos(pi/180*(A0*cos(I*Av))); #declare Xdi = Xi+pow(-1,I)*2*I*cos(pi/180*(A0*cos(I*Av))); #declare Yi = Yi-2*I*sin(pi/180*(A0*cos(I*Av)))-2*(I-1)*sin(pi/180*(A0*cos((I-1)*Av))); translate } #declare I = I+1; #end intersection { box { <-2, -2, -2>, <2, 2, 0> } sphere { <0, 0, 0>, R } translate } pigment { color rgb <1, 1, 1> } finish { ambient 0.1 diffuse 0.5 phong 0.1 reflection 0.3 } } #end union { intersection { box { <-1000, -100, -1000>, <1000, 60, 1000> } sphere { 0, 500 scale <2,0.15,2> } pigment { color rgbf<1, 1, 1, 1> } finish { ambient 0 diffuse 0 } interior { media { Media } } hollow } object { coil (1.5, 4, 20, 0.23) scale 10 } rotate y*-60 rotate x*-30 rotate z*-10 } background { color rgb <1, 1, 1> }