// Persistence of Vision Ray Tracer Scene Description File // File: ?.pov // Vers: 3.5 // Desc: scence template // Date: 10/06/04 // Auth: mrg // #version 3.5; #include "colors.inc" #include "rand.inc" #include "math.inc" #include "mrg_misc3.inc" #include "golds.inc" #include "metals.inc" global_settings { assumed_gamma 1.0 ambient_light color rgb <1,1,1> } background { color rgb 0 } #declare lclock=clock+24; #declare cpos1=<1,2.0, -9.0>*1.5; #declare cpos2=<11,5, -7.0>*1; #declare cpos=cpos1*(1-trans(lclock-12))+cpos2*trans(lclock-12); #declare cpos=vrotate(cpos1,trans((lclock-12)/2)*20*(x-1.5*y)); camera { location cpos // location <33,0, 0>*3 right x*image_width/image_height look_at 3*z angle 40 } #declare T_off=.6; //amount of current off time #declare T_rot=12; //time for a full rotation = 1 cycle #declare loopa=360/T_rot*lclock-90; #declare T_p5=T_rot/2; //time for 1/2 rotation (=battery cycle) #declare n_rot=int(lclock/T_rot); //number of rotations #declare t_int=lclock-n_rot*T_rot; // amount of time "into" the current rotation #declare tofL= n_rot+T_p5*(ltrans((t_int-T_off/2)/(T_p5-T_off))-ltrans((t_int-T_off/2-T_p5)/(T_p5-T_off))); #declare n_tp5=int(lclock/T_p5); //number of elapsed half cycles #declare tp5_int=lclock-n_tp5*T_p5; // amount of time "into" the current half cycle #declare tofB= n_tp5+(T_p5-T_off)*ltrans((tp5_int-T_off/2)/(T_p5-T_off)); #declare cdraw=0; #if(abs(tp5_int-T_p5/2)<=(T_p5-T_off)/2) #declare cdraw=1; #end #declare cylrad = .15; //battery union{ difference{ cylinder{-x,x,.5} cylinder{-1.2*x,1.2*x,.45} pigment{Blue*.05+Gray*.2} } union{ cylinder{-.95*x,.95*x,.45 } cylinder{.95*x,1.10*x,.15 } texture{T_Chrome_3B} } intersection{ union{ box{-.15*x-.025*y,.15*x+.025*y-.5*z translate -.4*z+.8*x} box{-.15*y-.025*x,.15*y+.025*x-.5*z translate -.4*z+.8*x} box{-.15*x-.025*y,.15*x+.025*y-.5*z translate -.4*z-.8*x} /* text { ttf "timesbd.ttf", "Duragizer", 2.5, 0 scale .32 translate -.85*z -.7*x-.1*y } text { ttf "symbol.ttf", "-", 2.5, 0 scale .45 translate -.85*z -.95*x-.1*y } text { ttf "symbol.ttf", "+", 2.5, 0 scale .45 translate -.85*z +.75*x-.1*y } */ } cylinder{-x,x,.501} pigment{Black} no_shadow no_reflection } translate -2*y } #declare wire_texture=texture{ pigment{color rgbt <.70,.4,.3,.7>} finish{ambient .3 diffuse .3 phong .3 phong_size 8} }; //commutator radius #declare ccro=.5; #declare ccri=.3; #declare wire_radius=.1; //wires merge{ cylinder{-2.05*x,2.05*x,wire_radius translate -2*y} cylinder{-2.05*y,0.05*y,wire_radius translate 2*x } cylinder{-2.05*y,0.05*y,wire_radius translate -2*x } difference{ cylinder{-2.05*x,2.05*x,.1 } union{ box{-.125*(z+y)-(ccro+.1)*x,+.125*(z+y)+(ccro+.1)*x } //brushes cylinder{-z,z,ccro } } } texture{wire_texture} } #declare bpath = array[6]; #declare bpath[0]=-(ccro+.05)*x; #declare bpath[1]=-2*x; #declare bpath[2]=-2*x-2*y; #declare bpath[3]=2*x-2*y; #declare bpath[4]=2*x; #declare bpath[5]=+(ccro+.05)*x; //brushes difference{ box{-.125*(z+y)-(ccro+.1)*x,+.125*(z+y)+(ccro+.1)*x } //brushes cylinder{-z,z,ccro } texture{T_Brass_4E} } //D-contacts union{ difference{ cylinder{-.125*z,.125*z,ccro } union{ cylinder{-.3*z,.3*z,ccri } box{-.15*x-z-1.2*ccro*y,+.15*x+z+1.2*ccro*y } } texture{T_Brass_4E} } //loop #declare loopl=5; merge{ merge{ cylinder{0,2.05*z,.1 translate x*(ccri-wire_radius)} cylinder{0,2.05*z,.1 translate -x*(ccri-wire_radius)} cylinder{-x*(ccri-1.5*wire_radius),-(loopl/2+.05)*x,.1 translate 2*z} cylinder{x*(ccri-1.5*wire_radius),(loopl/2+.05)*x,.1 translate 2*z} cylinder{-.05*z,loopl*z,.1 translate 2*z+loopl/2*x} cylinder{-.05*z,loopl*z,.1 translate 2*z-loopl/2*x} cylinder{-(loopl/2+.05)*x,(loopl/2+.05)*x,.1 translate (loopl+2)*z} } texture{wire_texture} } rotate loopa*z } //splines for charge paths #declare lpath = array[8]; #declare lpath[0]=vrotate(x*(ccri-wire_radius)+.05*z,loopa*z); #declare lpath[1]=vrotate(x*(ccri-wire_radius)+2*z,loopa*z); #declare lpath[2]=vrotate(2*z+loopl/2*x,loopa*z); #declare lpath[3]=vrotate(2*z+loopl/2*x+loopl*z,loopa*z); #declare lpath[4]=vrotate(2*z-loopl/2*x+loopl*z,loopa*z); #declare lpath[5]=vrotate(2*z-loopl/2*x,loopa*z); #declare lpath[6]=vrotate(-x*(ccri-wire_radius)+2*z,loopa*z); #declare lpath[7]=vrotate(-x*(ccri-wire_radius)+.05*z,loopa*z); #declare foo1 = function { spline { linear_spline 0,bpath[0] #declare sc=1; #declare plb=0; #while (sc<6) #declare plb=plb+vlength(bpath[sc]-bpath[sc-1]); plb,bpath[sc] #declare sc=sc+1; #end } } #declare foo2 = function { spline { linear_spline 0,lpath[0] #declare sc=1; #declare pll=0; #while (sc<8) #declare pll=pll+vlength(lpath[sc]-lpath[sc-1]); pll,lpath[sc] #declare sc=sc+1; #end } } #declare ds=.2; #declare vc=1; #declare cposs=0; #while (cposs} finish{ambient .5 diffuse 0} no_shadow no_reflection } #declare cposs=cposs+ds; #end #declare cposs=0; #while (cposs} finish{ambient .5 diffuse 0} no_shadow no_reflection } #declare cposs=cposs+ds; #end //things to draw while the current is on #if(cdraw>.5) //draw the current #declare testc=0; #while(testc<5) cylinder{ bpath[testc], bpath[testc+1],.03 pigment{color rgb <1,.7,.5>}} #declare testc=testc+1; #end #declare testc=0; #while(testc<7) cylinder{ lpath[testc], lpath[testc+1],.03 pigment{color rgb <1,.7,.5>}} #declare testc=testc+1; #end //draw the force markers //Make_Vector(vec,head_length,post_diameter,head_diameter) #declare testa=loopa-int(loopa/360)*360; #declare idir=-1; #if (abs(testa-180)<90) #declare idir=+1; #end #declare hl=.3; #declare pd =hl/5; #declare hd= pd*2; #declare fmax=1.5; #declare side_F=fmax*sin(radians(loopa))*idir; object{Make_Vector(side_F*z,hl,pd,hd) pigment{color Orange} translate (2+loopl)*z} object{Make_Vector(-side_F*z,hl,pd,hd) pigment{color Orange} translate (2)*z} object{Make_Vector(-idir*fmax*y,hl,pd,hd) pigment{color Orange} translate (2+loopl/2)*z+vrotate(loopl/2*x,testa*z)} object{Make_Vector(idir*fmax*y,hl,pd,hd) pigment{color Orange} translate (2+loopl/2)*z+vrotate(-loopl/2*x,testa*z)} object{orient_text(-idir*(fmax+.3)*y+(2+loopl/2)*z+vrotate(loopl/2*x,testa*z),cpos,"F",.6) pigment{color Orange} finish{ambient .5 diffuse 0} } object{orient_text(idir*(fmax+.3)*y+(2+loopl/2)*z+vrotate(-loopl/2*x,testa*z),cpos,"F",.6) pigment{color Orange} finish{ambient .5 diffuse 0} } #end //bfield #declare bline1=merge{ cylinder{-20*x,20*x,.03 } cone{-.35*x,0,0,.15 translate 4*x} cone{-.35*x,0,0,.15 translate -4*x} pigment{color rgbt Blue*1.4+<.3,.3,.3,.0>} finish{ambient .5 diffuse 0} }; #declare dbs=1.75; #declare nb_side=1; #declare nbcz=-nb_side; #while (nbcz<=nb_side) #declare nbcy=-nb_side; #while (nbcy<=nb_side) object{bline1 translate (nbcz*z+nbcy*y)*dbs+(2+loopl/2)*z} #declare nbcy=nbcy+1; #end #declare nbcz=nbcz+1; #end object{orient_text((2+loopl/2)*z+dbs*y-4*x+.6*y,cpos,"B",.6) pigment{color rgbt Blue*1.4+<.3,.3,.3,.0>} finish{ambient .5 diffuse 0} } light_source { <0, 0, 0> // light's position (translated below) color rgb <1, 1, 1> // light's color translate <30, 30, -30>//place it to the left (neg x), above (pos y) and behind (neg z) vantage point } /**/ // ----------------------------------------