// Persistence of Vision Ray Tracer Scene Description File // File: Sierp_Surprise.inc // Vers: 3.5 // Desc: makes anim using Sierpinkski Triangle // Date: 17/02/2004 // Auth: James Taylor // Web : www.jimbobjim.pwp.blueyonder.co.uk #include "colors.inc" #include "rand.inc" #include "random_colour.inc" #include "io_macs.inc" // +fn +kff300 +oframes/output #local do_rad = yes; #if(do_rad) #include "rad_def.inc" global_settings { radiosity { Rad_Settings(Radiosity_Debug, off, off) } } #end //##################################################################### // perspective (default) camera camera { location <0.0, 0.0, -5.0> look_at <0.0, 0.0, 0.0> right x*image_width/image_height angle 25 } //##################################################################### // create a regular point light source light_source { 0*x // light's position (translated below) color rgb <1,1,1> // light's color translate <-20, 40, -20> } //##################################################################### background{White} #declare RS = seed(1); #local N_Spheres = 1500; //number of spheres in triangle #local sierp_array = array[N_Spheres]; #local start_point = array[N_Spheres]; #local speed = array[N_Spheres]; #local Direction = array[N_Spheres]; #local i=0; #while(i; #local i=i+1; #end #if(clock=0) #local X = rand(RS); #local Y = rand(RS); #local k = 1; #while(k<=N_Spheres) #local N = rand(RS); #if(N<= 1/3) #local X = 0.5 * X; #local Y = 0.5 * Y; #end #if(1/3 < N & N <= 2/3) #local X = 0.5 * (0.5 + X); #local Y = 0.5 * (1.0 + Y); #end #if(2/3 < N) #local X = 0.5 * (1.0 + X); #local Y = 0.5 * Y; #end #local sierp_array[k-1] = - 0.5; //k-1 because array goes from 0 to (N_Spheres - 1) #local k = k + 1; #end Save_Array(sierp_array,"data.dat") #debug concat("\nThis should only appear of FRAME 1!!! \n") #end #local sierp_array = Load_Array("data.dat") #local max_distance = 3; #local Sierp_Point = 0.5; //clock value when Sierpinski Triangle appears #local i=0; #while(i; //loop to determine speed for each sphere. units of pov units/frame #local Distance = vlength(sierp_array[i] - start_point[i]); //loop to determine direction of each sphere #local speed[i] = Distance / (final_frame * Sierp_Point); #local Direction[i] = speed[i] * vnormalize( sierp_array[i] - start_point[i] ); //loop to place the spheres sphere{<0,0,0> 0.005 translate (start_point[i] + frame_number*Direction[i]) Random_Colour()} #local i=i+1; #end