#include "colors.inc" #include "math.inc" #include "metals.inc" global_settings { assumed_gamma 1.0 ambient_light rgb <1,1,1> max_trace_level 10} #declare ltime =clock+.1; #declare camera_scale=300; camera { // location <8, 15 , 15> location camera_scale*<6, 2, -12> look_at <0, 0, 2.2> angle 10/camera_scale } #declare linesize=.004; #declare Etexture= texture{pigment { color rgbt <.8,.1,.1,.0> } finish{ambient .9 diffuse .5}}; #declare Btexture= texture {pigment { color rgbt <.1,.1,.8,0> } finish{ambient .9 diffuse .5}}; #declare wavelength=1; //length of one cycle #declare waveheight=wavelength/10; //amplitude of wave #declare Ea = waveheight; #declare k = 2*pi/wavelength; #declare Ey = function(tt,z_dist) { Ea*sin(k*z_dist-2*pi*tt) } #declare Bx = function(tt,z_dist) { Ea*sin(k*z_dist-2*pi*tt) } #declare Esy = function(tt,z_dist) { Ea*(sin(k*z_dist-2*pi*tt)-sin(-k*z_dist-2*pi*tt)) } #declare Bsx = function(tt,z_dist) { Ea*(sin(k*z_dist-2*pi*tt)+sin(-k*z_dist-2*pi*tt)) } #declare stwave_section_length = 2*wavelength; #declare num_sect_per_wave=60; //number of sections used to wave #declare z_wave_start = stwave_section_length; #declare z_wave_end = 10*wavelength; //draw the mirrors #declare mirror_thickness=.02*wavelength; #declare mirror_texture= texture{T_Chrome_5B}; cylinder{0*z,mirror_thickness*z, 1.5*waveheight texture{mirror_texture} } cylinder{stwave_section_length*z,(stwave_section_length+mirror_thickness)*z, 1.5*waveheight texture{mirror_texture} } //draw the E wave section #declare znow=z_wave_start; #declare dz = wavelength/num_sect_per_wave; #declare p1=Ey(ltime,znow)*y+znow*z; union{ #while(znow.2*waveheight) cylinder { p1, p1+dpr,arrow_width } cone{p1+dpr,arrow_cap_width,p1+dp,0} #end #end texture{Etexture} } //B arrows #declare znow=z_wave_start; union{ #while(znow.2*waveheight) cylinder { p1, p1+dpr,arrow_width } cone{p1+dpr,arrow_cap_width,p1+dp,0} #end #end texture{Btexture} } #declare axis = cylinder{-0*z,+z,.00225 scale 20*wavelength*z+x+y pigment{color rgb <1,1,1>} finish{ambient 1}} union{ object{axis} // object{axis rotate y*180} object{axis rotate +y*90} object{axis rotate -x*90} } //draw the E wave section #declare znow=0; #declare dz = wavelength/num_sect_per_wave; #declare p1=Esy(ltime,znow)*y+znow*z; union{ #while(znow.2*waveheight) cylinder { p1, p1+dpr,arrow_width } cone{p1+dpr,arrow_cap_width,p1+dp,0} #end #end texture{Etexture} } //B arrows #declare znow=0; union{ #while(znow < stwave_section_length-dz) #declare znow = znow+dz; #declare p1=znow*z; #declare dp=Bsx(ltime,znow)*x+znow*z-p1; #declare dpr=vnormalize(dp)*(vlength(dp)-arrow_cap_height); #if(vlength(dp)>.2*waveheight) cylinder { p1, p1+dpr,arrow_width } cone{p1+dpr,arrow_cap_width,p1+dp,0} #end #end texture{Btexture} }