//oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo// // // // Windows users: to start rendering this image, press Alt+G or the 'Run' // // button on the toobar. // // // // Experienced windows users: try right-clicking on the line below ... // // // // +w320 +h240 // +w800 +h600 +a0.3 +am2 // // +kff30 for animation // // // See the docs for full explanations of new features such as the above. // // // //oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo// // author: Florian Simon (2001 Fabien Mosen) // date: 2012/05/28 // Persistence Of Vision raytracer version 3.5 sample file. #include "colors.inc" #include "functions.inc" #include "logo.inc" #include "shapes.inc" #include "textures.inc" #include "Woods.inc" #include "stones.inc" #include "glass.inc" #include "metals.inc" //global_settings {max_trace_level 5} // // camera // camera{ orthographic // location <5, 10, -20> // // right<-3.5, 0, 0> // // up<0, 3.5, 0> // sky<0, 0, 1> look_at 0 } // // ?????? // light_source{ <15, 10, -10> // color White parallel // point_at 0 } //#default{ // texture{ // finish{ // ambient 0.4 // // phong 0.6 // // phong_size 10 // } // } //} // background{color White} // // Macro spring total length = hh * 2 + pitch * (2 + N) = 1.2 + 0.4*7 = 4.0 // #macro Spring (X,Y,Z,pitch) #declare r0 = 0.7 ; // radius of spring #declare rr = 0.08; // radius of wire // #declare pitch = 0.4 ; // pitch defines distance between "rings" #declare hh = 0.6 ; // sticklength #declare N = 5 ; // times #declare M = 20 ; // 2pi/M ; defines how "fine" the spring is (number of spheres per ring) #declare pi2 = 2*3.1415926535 ; // 2pi #declare dphi = pi2 / M ; #declare dp = pitch / M ; #declare dr = r0 / M ; union{ #declare h = 0; // start part (1) Bou no bubun Stick object{ sphere_sweep{ linear_spline, 2, <0, h , 0> rr #declare h = h + hh ; <0, h , 0> rr texture {T_Silver_5A} //no_shadow// } } // start part (2) Chuusin kara hankei made drill at the beginning #declare MM = 0 ; #declare r1 = 0; #while ( MM < M ) object{ sphere_sweep{ linear_spline, 2, rr #declare MM = MM + 1 ; #declare r1 = r0 /(1+ exp(-(MM-M/2)/M*7.0)) ; #declare h = h+ dp; rr texture {T_Silver_5A} } } #end // central part #declare NN = 0 ; #while ( NN < N ) #declare MM = 0 ; #while ( MM < M ) object{ sphere_sweep{ linear_spline, 2, rr #declare MM = MM + 1 ; #declare h = h+ dp; rr texture {T_Silver_5A} } } #end #declare NN = NN+1 ; #end // finish part (1) Chuusin ni tikaduku drill at the end #declare MM = 0 ; #while ( MM < M ) object{ sphere_sweep{ linear_spline, 2, rr #declare MM = MM + 1 ; #declare r1 = r0 /(1+ exp((MM-M/2)/M*7.0)) ; #declare h = h+ dp; rr texture{ pigment{color White*0.3} finish{ ambient 1.0 // phong 0.6 // phong_size 10 } } no_shadow } } #end // finish part (2) Bou no bubun end stick object{ sphere_sweep{ linear_spline, 2, <0, h , 0> rr #declare h = h + hh ; <0, h , 0> rr texture{ pigment{color White*0.3} finish{ ambient 1.0 // phong 0.6 // phong_size 10 } } no_shadow } } //scale 2.0 translate<0,-h,0> rotate <0, 0, 90> translate } #end // macro end; // // define atom // #declare atom1=object{ Sphere // ? no_shadow texture {T_Gold_4B} scale 0.5 // ????? }; // define ita #declare ita=object{Cube scale <0.25,1,1> //texture{pigment{color White*0.5} finish{ ambient 1.0 phong 0.6 phong_size 10 }// texture {DMFWood4} finish{ ambient 1.0 phong 0.6 phong_size 10 } } #macro Omega(p,N1) sin((pi/2)*(p/N1)) // Normal angular velocity value #end // use this for cyclic animation // #macro Omega(p,N1) // (p/N1)*N1 // Normal angular velocity value ( sin((pi/2)*(p/N1)) ) // // approximation of p * sin((pi/2)*(p/N1)) --> so that we can have a nice cyclic animation // #end #macro Elong(p,n,N1) 0.1*sin((p*n)/(N1+1)*pi) // Elongation of the single atoms (N=number of atoms, p="index" of Omega, n=number of atom) #end #macro ElongS(p,n,N1) Elong(p,n,N1)*sin(Omega(p,N1)*pi2*clock) #end #macro ElongA(p,n,N1) ElongS(p,n,N1)*7 // 7 means N+2 in the macro of spring #end #macro Nspring(N1) #declare p = 1 ; #declare pi2 = 2*pi ; // 2pi #union { #while (p<=N1) #declare n = 1 ; object{ita translate <-0.25,0,0> translate<-(5*N1+4)/2,(2*N1-2)-(p-1)*4,0>} object{Spring (0,0,0,0.4+ElongS(p,n,N1)) translate<-(5*N1+4)/2,(2*N1-2)-(p-1)*4,0>} #while (n translate<-(5*N1+4)/2,(2*N1-2)-(p-1)*4,0>} object{Spring ((5*n)+ElongA(p,n,N1),0,0,0.4+(ElongS(p,n+1,N1)-ElongS(p,n,N1))) translate<-(5*N1+4)/2,(2*N1-2)-(p-1)*4,0>} // 5 because of length of spring + atom (= 5) #declare n = n +1 ; #end // end while (n<=N) object{atom1 translate <(5*N1-0.5)+ElongA(p,N1,N1),0,0> translate<-(5*N1+4)/2,(2*N1-2)-(p-1)*4,0>} object{Spring ((5*N1)+ElongA(p,N1,N1),0,0,0.4+-ElongS(p,N1,N1)) translate<-(5*N1+4)/2,(2*N1-2)-(p-1)*4,0>} object{ita translate <5*(N1+1)-1+0.25,0,0> translate<-(5*N1+4)/2,(2*N1-2)-(p-1)*4,0>} #declare p = p + 1 ; #end // end while (p<=N) scale 2.8 scale 10/(5*N1+5) // ideal render window ratio is 5:4 } #end object{Nspring(5)} //------------------------------------------------------------------------------------------------------ // Nspring(X) ---> X is the number of atoms //------------------------------------------------------------------------------------------------------