//boid04 was ideal in smooth collision avoidance swarming. //bodi05 attempts to make them go somewhere //boid08b attempts to make them be "near center, not at center, with x*(1/x) //trail03 made a growing mess of string. trail 04 will attempt to make something that looks like worms. // by Greg M. Johnson http://members.xoom.com/gregjohn/animation.html. #include "colors.inc" #include "textures.inc" #include "stones.inc" #include "metals.inc" #macro Reorient(Axis1,Axis2) #local vX1=vnormalize(Axis1); //john vansickle #local vX2=vnormalize(Axis2); #local vY=vnormalize(vcross(vX1,vX2)); #local vZ1=vnormalize(vcross(vX1,vY)); #local vZ2=vnormalize(vcross(vX2,vY)); matrix < vX1.x, vY.x,vZ1.x, vX1.y,vY.y,vZ1.y, vX1.z,vY.z, vZ1.z, 0,0,0 > matrix < vX2.x,vX2.y,vX2.z, vY.x,vY.y, vY.z, vZ2.x,vZ2.y,vZ2.z, 0,0,0 > #end background {White} #declare num=100 ; //number of actors #declare framenum=375; #declare RRR=seed(2022) ; #declare UMAX=.007 ; //maximum initial postion #declare VMAX=.07 ; //maximum initial velocity #declare colorp= array[num+1] #declare actorp= array[num+1] #declare actorv= array[num+1] #declare actoravoid= array[num+1] #fopen MyFile2 "c:\pov31\include\trailchase04.inc" write #write(MyFile2,"#declare position=array[", framenum, "][", num, "][6] {\n") //initialize #declare n=0 ; #while (n; //color assignment of each actor #declare actorp[n]=UMAX*; //this is position of each actor. #declare actorv[n]=VMAX*vnormalize(); // this is velocity of each actor. //#declare tee=tee+1; //#end #declare actoravoid[n]=<0,0,0>; // this is the vector to be avoided. #declare n=n+1 ; #end //#declare actave=<0,0,0>; #declare tt=1;// #while(tt; #declare n=n+1 ; #end #declare i=0 ; #while (i//2*cos(tt/375*3*pi),0,2*sin(tt/375*3*pi)>; #declare n=0 ; #while (n0) #write(MyFile,",") #end #write(MyFile,"{ ") #local iJ=0; #while(iJ0) #write(MyFile,",") #end #write(MyFile,MyDataArray[iI][iJ]) #local iJ=iJ+1; #end #write(MyFile, " }\n" ) #local iI=iI+1; #end #write(MyFile, "}\n" ) */ //#debug str(n,2,2) #declare n=n+1 ; #end #write(MyFile2,"}, ") //#declare actorv[0]=vnormalize(); #declare tt=tt+1 ; #debug " " #debug str(tt,2,2) #debug "\n" #end #write(MyFile2,"} ") #fclose Myfile2 /* //display #declare n=0 ; #while (n,.6,<2,0,0>,0 //sphere {<0,0,0>,.25 cylinder {<0,0,0>,<0.25,0,0>,0.2//5 Reorient(x,actorv[n][tee]) translate actorp[n][tee] //pigment{Coral} pigment {color colorp[n]} finish{ambient 0.3} //pigment {rgb 1/pow(tt,0.15)} } #declare tee=tee+1; #end #declare n=n+1 ; #end */ camera { //location <0, 100, 0> location <0, -5,-35>*(1+tt/350/6) look_at <0, 0, 0> angle 30//5 rotate <0,60*tt/350,0> // Reorient(-z,actorv[0]) // translate actorp[0] } light_source{<10,200,-50>rgb 1.2} light_source{<10,-200,50>rgb .2} fog { fog_type 1 distance 2000 rgb <.2,.3,.7>}