#include "colors.inc" #include "metals.inc" #include "finish.inc" #include "math.inc" #include "automobile_bug.inc" global_settings { max_trace_level 10 ambient_light rgb<1, 1, 1> } // An area light (creates soft shadows) // WARNING: This special light can significantly slow down rendering times! light_source { 0*x // light's position (translated below) color rgb 1.0 // light's color area_light <-8, 0, -8> <8, 0, 8> // lights spread out across this distance (x * z) 4, 4 // total number of lights in grid (4x*4z = 16 lights) adaptive 0 // 0,1,2,3... circular // make the shape of the light circular orient // orient light translate .3*<0, 80, -50> // position of light } background{SummerSky} plane { //grassy plane y, -.75 texture { pigment { color rgb DarkWood } finish { phong 20 ambient 1 diffuse 0} } } camera { location <-10, 10 ,-50> look_at <0, 10, 0> angle 40 } #declare c_v0=1.099/.05; #declare c_r=10; #declare a_c0=c_v0*c_v0/c_r; #declare dat_t=+0.001; #declare dat_x=+0.001; #declare dat_y=+0.001; #declare dat_q=+0.001;; #fopen MyFile "bare_loop_data.txt" read #read (MyFile,maxdata) //first data is number of points #declare thisdata = min(frame_number,maxdata); #declare i=1; #while (i<=thisdata) #read (MyFile,dat_t,dat_x,dat_y,dat_q) #declare i=i+1; #end #fclose MyFile //keep car cenetered on track... #declare car_z=0; #if(dat_t>0) #declare car_z = dat_q/360*1.8; #end #if(dat_t>5) #declare car_z = 1.8; #end //normal force vs weight #declare Fn_to_w=a_c0/9.81+3*cos(dat_q*pi/180)-2; #if(dat_q<=0.0) #declare Fn_to_w=1; #end #if(dat_q>=360) #declare Fn_to_w=1; #end #declare wlength =2; union{ object{automobile_bug rotate y*-90 translate -.4*x scale <2.5/3.2,1.3/1.5,.8/.9> translate -1.3/2*y //center car on center of block } union{ //weight vector cylinder { <0, -.3, 0>, <0, -wlength, 0>, .1 } cone { <0, -wlength, 0>, .3, <0, -.3-wlength, 0>, .00001 } pigment{color Red} finish{ambient 1} rotate -dat_q*z } #if(Fn_to_w>.1) union{ //Normal vector cylinder { <0, .5, 0>, <0, .2+wlength*Fn_to_w, 0>, .1 } cone { <0, .2+wlength*Fn_to_w, 0>, .3, <0, .5+wlength*Fn_to_w, 0>, .00001 } pigment{color Yellow} finish{ambient 1} } #end rotate dat_q*z translate dat_x*x+dat_y*y+car_z*z } //pavement #declare p_rad =10+1.3/2; #declare p_width=1.8; #declare p_n_blocks = 120; #declare p_ds = 2*pi*p_rad/p_n_blocks; #declare p_block=union{ box { <-p_ds/2, 0, -p_width/2>, pigment{color rgb <.7,.7,.7>}} box { <-p_ds/2, .001, -p_width/2>, pigment{color rgb <1,1,.1>} scale <1,1,.1>} } #declare i=0; union{ #while(i<=p_n_blocks) object{p_block translate -p_rad*y rotate z*i/p_n_blocks*360 translate p_rad*y+z*i*p_ds*1.8/(2*pi*p_rad) } object{p_block translate -i*p_ds*x } object{p_block translate +i*p_ds*x+z*1.8 } #declare i=i+1; #end translate -1.3/2*y}