// PoVRay 3.6 Scene File "Impulse_2.pov" // author: Florian Simon // date: 2011/11/24 #version 3.6; global_settings{ assumed_gamma 1.0 } //--------------------------------------- #include "colors.inc" #include "textures.inc" #include "glass.inc" #include "metals.inc" #include "golds.inc" #include "stones.inc" #include "woods.inc" #include "shapes.inc" #include "shapes2.inc" #include "functions.inc" #include "math.inc" #include "transforms.inc" #include "shapes_lo.inc" #include "Clock_Splitting.inc" // light ---------------------------------------- light_source{ <1500,2500,-2500> color rgb<1,1,1> } //--------------------------------------- sky_sphere{ pigment{color rgb<1,1,1>}} //--------------------------------------- // sky ------------------------------------------------------------------- sky_sphere{ pigment{ gradient <0,1,0> color_map{ [0 color rgb<1,1,1> ]//White [0.4 color rgb<0.14,0.14,0.56>]//~Navy [0.6 color rgb<0.14,0.14,0.56>]//~Navy [1.0 color rgb<1,1,1> ]//White } scale 2 } } // end of sky_sphere //------------------------------------------------------------------------ //------------------------------ the Axes -------------------------------- //------------------------------------------------------------------------ #macro Axis_( AxisLen, Dark_Texture,Light_Texture) union{ cylinder { <0,-AxisLen,0>,<0,AxisLen,0>,0.05 texture{checker texture{Dark_Texture } texture{Light_Texture} translate<0.1,0,0.1>} } cone{<0,AxisLen,0>,0.2,<0,AxisLen+0.7,0>,0 texture{Dark_Texture} } } // end of union #end // of macro "Axis()" //------------------------------------------------------------------------ #macro AxisXYZ( AxisLenX, AxisLenY, AxisLenZ, Tex_Dark, Tex_Light) //--------------------- drawing of 3 Axes -------------------------------- union{ #if (AxisLenX != 0) object { Axis_(AxisLenX, Tex_Dark, Tex_Light) rotate< 0,0,-90>}// x-Axis text { ttf "arial.ttf", "x", 0.15, 0 texture{Tex_Dark} rotate<20,-45,0> scale 0.75 translate no_shadow} #end // of #if #if (AxisLenY != 0) object { Axis_(AxisLenY, Tex_Dark, Tex_Light) rotate< 0,0, 0>}// y-Axis text { ttf "arial.ttf", "y", 0.15, 0 texture{Tex_Dark} rotate<10,0,0> scale 0.75 translate <-0.65,AxisLenY+0.50,-0.10> rotate<0,-45,0> no_shadow} #end // of #if #if (AxisLenZ != 0) object { Axis_(AxisLenZ, Tex_Dark, Tex_Light) rotate<90,0, 0>}// z-Axis text { ttf "arial.ttf", "z", 0.15, 0 texture{Tex_Dark} rotate<20,-45,0> scale 0.85 translate <-0.75,0.2,AxisLenZ+0.10> no_shadow} #end // of #if } // end of union #end// of macro "AxisXYZ( ... )" //------------------------------------------------------------------------ #declare Texture_A_Dark = texture { pigment{ color rgb<1,0.45,0>} finish { phong 1} } #declare Texture_A_Light = texture { pigment{ color rgb<1,1,1>} finish { phong 1} } object{ AxisXYZ( 4.50, 3.00, 5.00, Texture_A_Dark, Texture_A_Light) translate <-1,-1,3>} //-------------------------------------------------- end of coordinate axes // ground ----------------------------------------------------------------- //---------------------------------<<< settings of squared plane dimensions #declare RasterScale = 1.0; #declare RasterHalfLine = 0.025; #declare RasterHalfLineZ = 0.025; //------------------------------------------------------------------------- #macro Raster(RScale, HLine) pigment{ gradient x scale RScale color_map{[0.000 color rgbt<1,1,1,0>*0.6] [0+HLine color rgbt<1,1,1,0>*0.6] [0+HLine color rgbt<1,1,1,1>] [1-HLine color rgbt<1,1,1,1>] [1-HLine color rgbt<1,1,1,0>*0.6] [1.000 color rgbt<1,1,1,0>*0.6]} } #end// of Raster(RScale, HLine)-macro //------------------------------------------------------------------------- plane { <0,1,0>, 0 // plane with layered textures texture { pigment{color White*1.1} finish {ambient 0.45 diffuse 0.85}} texture { Raster(RasterScale,RasterHalfLine ) rotate<0,0,0> } texture { Raster(RasterScale,RasterHalfLineZ) rotate<0,90,0>} rotate<0,0,0> translate <-1,-1,3> } //------------------------------------------------ end of squared plane XZ // textures----------------------------------- #declare Texture_R = texture{ pigment{ color rgbf< 0.0, 0.6, 0.0, 0.8> } finish { phong 1 } } #declare Texture_L = texture{ pigment{ color rgbf< 1.0, 0.3, 0.0, 0.9> } finish { phong 1 } } // end of textures ---------------------------------- //------------------------------------------------------- //--------------OBJECTS---------------------------------- //------------------------------------------------------- #declare Total=19 ; #declare StepNr=1 ; // camera --------------------------------------------------------------------- #declare Camera_0 = camera {/*ultra_wide_angle*/ angle 75 // front view location <0.0 , 1.0 ,-9.0> right x*image_width/image_height look_at <0.0 , 1.2 , 0.0>} #declare Camera_1 = camera {/*ultra_wide_angle*/ angle 75 // diagonal view location <2.0 , 3.5 ,-7.0> right x*image_width/image_height look_at <-1.0 , 1.2 , 0.0>} #declare Camera_2 = camera {/*ultra_wide_angle*/ angle 90 // right side view location <3.0 , 1.0 , 0.0> right x*image_width/image_height look_at <0.0 , 1.0 , 0.0>} #declare Camera_3 = camera {/*ultra_wide_angle*/ angle 90 // top view location <0.0 , 3.0 ,-0.001> right x*image_width/image_height look_at <0.0 , 1.0 , 0.0>} #declare Camera_S = camera { angle 55 location < -3.60, 3.60, -10.00> right x*image_width/image_height look_at < 0, 0.60, 0.00>} #declare Camera_M3 = camera { angle 55 location < -3.60-4.7*Sclock_01(3,Total), 3.60-Sclock_01(3,Total)*1.6, -10.00*(1-Sclock_01(3,Total))> right x*image_width/image_height look_at < 0.00, 0.60, 0.00>} #declare Camera_R = camera { angle 55 location < -8.3, 2, 0> right x*image_width/image_height look_at < 0.00, 0.60, 0.00>} #declare Camera_B6 = camera { angle 55 location < -8.30+4.7*Sclock_01(6,Total), 2.00+Sclock_01(6,Total)*1.6, Sclock_01(6,Total)*-10> right x*image_width/image_height look_at < 0.00, 0.60, 0.00>} #declare Camera_M10 = camera { angle 55 location < -3.60-4.7*Sclock_01(10,Total), 3.60-Sclock_01(10,Total)*1.6, -10.00*(1-Sclock_01(10,Total))> right x*image_width/image_height look_at < 0.00, 0.60, 0.00>} #declare Camera_B13 = camera { angle 55 location < -8.30+4.7*Sclock_01(13,Total), 2.00+Sclock_01(13,Total)*1.6, Sclock_01(13,Total)*-10> right x*image_width/image_height look_at < 0.00, 0.60, 0.00>} #declare Camera_M17 = camera { angle 55 location < -3.60-4.7*Sclock_01(17,Total), 3.60-Sclock_01(17,Total)*1.6, -10.00*(1-Sclock_01(17,Total))> right x*image_width/image_height look_at < 0.00, 0.60, 0.00>} // end of camera -------------------------------------------------------------- camera{Camera_S} // camera set // elastic 2-dim. collision equations ------------------------------------------------ #declare v0 = 4.000 ; // velocity ball 1 #declare s0 = -4.000 ; // start position of ball 1 #declare r = 0.300 ; // radius #declare r1 = 0.400 ; // radius 1 #declare r2 = 0.260 ; // radius 2 #declare X = 0.000 ; // Abs. X translate overall #declare Y = 0.500 ; // Abs. Y translate overall #declare Z = 0.000 ; // Abs. Z translate overall #declare XR = 000 ; // Abs. X rotate overall #declare YR = 000 ; // Abs. X rotate overall #declare ZR = 000 ; // Abs. X rotate overall #declare mr = (4/3)*pi*pow(r,3) ; #declare m1 = (4/3)*pi*pow(r1,3) ; // mass #declare m2 = (4/3)*pi*pow(r2,3) ; #declare Alpha2 = (2*pi/360) * 45 ; // angle (radian) // Position Correction #declare dz = sin(Alpha2)*r ; #declare d1z = sin(Alpha2)*r1 ; // Z-Axis #declare d2z = sin(Alpha2)*r2 ; #declare dx = cos(Alpha2)*r ; #declare d1x = cos(Alpha2)*r1 ; // X-Axis #declare d2x = cos(Alpha2)*r2 ; // mr collidates with mr #declare p = mr*v0 ; #declare p1_a = p*sin(Alpha2) ; #declare p2_a = p*cos(Alpha2) ; // m1 collidates with m2 (p2_xx was non moving ball) #declare p1 = m1*v0 ; #declare E0 = p1*p1/(2*m1) ; #declare E2 = E0*((4*m1*m2*pow(cos(Alpha2),2))/(pow((m1+m2),2))) ; #declare E1 = E0-E2 ; #declare ks = E1/E0 ; // ks = pow(( ( sqrt( ( m2*m2)-(m1*m1*sin(Alpha)*sin(Alpha) ) ) + m1*cos(Alpha) )/( m1 + m2 ) ),2) ; #declare p1_1a = sqrt((2*E1*m1)) ; #declare p2_1a = sqrt((2*E2*m2)) ; #declare Alpha1 = pi-(Alpha2+acos((-pow(p1,2)+pow(p1_1a,2)+pow(p2_1a,2))/(2*p1_1a*p2_1a))) ; // m2 collidates with m1 #declare p2 = m2*v0 ; #declare E02 = p2*p2/(2*m2) ; #declare E22 = E02*((4*m1*m2*pow(cos(Alpha2),2))/(pow((m1+m2),2))) ; #declare E12 = E02-E22 ; #declare ks2 = E12/E02 ; // ks = pow(( ( sqrt( ( m2*m2)-(m1*m1*sin(Alpha)*sin(Alpha) ) ) + m1*cos(Alpha) )/( m1 + m2 ) ),2) ; #declare p1_2a = sqrt((2*E12*m2)) ; #declare p2_2a = sqrt((2*E22*m1)) ; #declare Alpha12 = pi-(Alpha2+acos((-pow(p2,2)+pow(p1_2a,2)+pow(p1_2a,2))/(2*p1_2a*p1_2a))) ; // elastic 2-dim. collision equations ---------------------end------------------------ // animation if loop #if ( clock, r texture { Texture_R } translate< dx , 0 , dz > } translate rotate } object{ sphere{ <0,0,0>, r texture { Texture_L } translate< s0-dx+v0*Sclock_01(StepNr,Total) , 0 , -dz > } translate rotate } #else #declare StepNr = StepNr +1 ; #if ( clock, r texture { Texture_R } translate< dx+(cos(Alpha2)*p2_a/mr)*Sclock_01(StepNr,Total) , 0 , dz+(sin(Alpha2)*p2_a/mr)*Sclock_01(StepNr,Total) > } translate rotate } object{ sphere{ <0,0,0>, r texture { Texture_L } translate< -dx+(sin(Alpha2)*p1_a/mr)*Sclock_01(StepNr,Total) , 0 , -dz-(cos(Alpha2)*p1_a/mr)*Sclock_01(StepNr,Total) > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_M3} #if ( clock, r texture { Texture_R } translate< dx , 0 , dz > } translate rotate } object{ sphere{ <0,0,0>, r texture { Texture_L } translate< s0-dx , 0 , -dz > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_R} #if ( clock, r texture { Texture_R } translate< dx , 0 , dz > } translate rotate } object{ sphere{ <0,0,0>, r texture { Texture_L } translate< s0-dx+v0*Sclock_01(StepNr,Total) , 0 , -dz > } translate rotate } #else #declare StepNr = StepNr +1 ; #if ( clock, r texture { Texture_R } translate< dx+(cos(Alpha2)*p2_a/mr)*Sclock_01(StepNr,Total) , 0 , dz+(sin(Alpha2)*p2_a/mr)*Sclock_01(StepNr,Total) > } translate rotate } object{ sphere{ <0,0,0>, r texture { Texture_L } translate< -dx+(sin(Alpha2)*p1_a/mr)*Sclock_01(StepNr,Total) , 0 , -dz-(cos(Alpha2)*p1_a/mr)*Sclock_01(StepNr,Total) > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_B6} #if ( clock, r texture { Texture_R } translate< dx , 0 , dz > } translate rotate } object{ sphere{ <0,0,0>, r texture { Texture_L } translate< s0-dx , 0 , -dz > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_S} #if ( clock, r*(1+(((r2/r)-1)*Sclock_01(StepNr,Total))) texture { Texture_R } translate< dx*(1+(((d2x/dx)-1)*Sclock_01(StepNr,Total))) , 0 , dz*(1+(((d2z/dz)-1)*Sclock_01(StepNr,Total))) > } translate rotate } object{ sphere{ <0,0,0>, r*(1+(((r1/r)-1)*Sclock_01(StepNr,Total))) texture { Texture_L } translate< (s0-dx)*(1+((((s0-d1x)/(s0-dx))-1)*Sclock_01(StepNr,Total))) , 0 , -dz*(1+(((d1z/dz)-1)*Sclock_01(StepNr,Total))) > } translate rotate } #else #declare StepNr = StepNr +1 ; #if ( clock, r2 texture { Texture_R } translate< d2x , 0 , d2z > } translate rotate } object{ sphere{ <0,0,0>, r1 texture { Texture_L } translate< s0-d1x+v0*Sclock_01(StepNr,Total) , 0 , -d1z > } translate rotate } #else #declare StepNr = StepNr +1 ; ////////////////////////////\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ #if ( clock, r2 texture { Texture_R } translate< d2x+(cos(Alpha2)*p2_1a/m2)*Sclock_01(StepNr,Total) , 0 ,d2z+(sin(Alpha2)*p2_1a/m2)*Sclock_01(StepNr,Total) > } translate rotate } object{ sphere{ <0,0,0>, r1 texture { Texture_L } translate< -d1x+(cos(Alpha1)*p1_1a/m1)*Sclock_01(StepNr,Total) , 0 , -d1z-(sin(Alpha1)*p1_1a/m1)*Sclock_01(StepNr,Total) > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_M10} #if ( clock, r2 texture { Texture_R } translate< d2x, 0 , d2z > } translate rotate } object{ sphere{ <0,0,0>, r1 texture { Texture_L } translate< s0-d1x , 0 , -d1z > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_R} #if ( clock, r2 texture { Texture_R } translate< d2x, 0 , d2z > } translate rotate } object{ sphere{ <0,0,0>, r1 texture { Texture_L } translate< s0-d1x+v0*Sclock_01(StepNr,Total) , 0 , -d1z > } translate rotate } #else #declare StepNr = StepNr +1 ; #if ( clock, r2 texture { Texture_R } translate< d2x+(cos(Alpha2)*p2_1a/m2)*Sclock_01(StepNr,Total) , 0 ,d2z+(sin(Alpha2)*p2_1a/m2)*Sclock_01(StepNr,Total) > } translate rotate } object{ sphere{ <0,0,0>, r1 texture { Texture_L } translate< -d1x+(cos(Alpha1)*p1_1a/m1)*Sclock_01(StepNr,Total) , 0 , -d1z-(sin(Alpha1)*p1_1a/m1)*Sclock_01(StepNr,Total) > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_B13} #if ( clock, r2 texture { Texture_R } translate< d2x, 0 , d2z > } translate rotate } object{ sphere{ <0,0,0>, r1 texture { Texture_L } translate< s0-d1x , 0 , -d1z > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_S} #if ( clock, r2*(1+(((r1/r2)-1)*Sclock_01(StepNr,Total))) texture { Texture_R } translate< d2x*(1+(((d1x/d2x)-1)*Sclock_01(StepNr,Total))) , 0 , d2z*(1+(((d1z/d2z)-1)*Sclock_01(StepNr,Total))) > } translate rotate } object{ sphere{ <0,0,0>, r1*(1+(((r2/r1)-1)*Sclock_01(StepNr,Total))) texture { Texture_L } translate< (s0-d1x)*(1+((((s0-d2x)/(s0-d1x))-1)*Sclock_01(StepNr,Total))) , 0 , -d1z*(1+(((d2z/d1z)-1)*Sclock_01(StepNr,Total))) > } translate rotate } #else #declare StepNr = StepNr +1 ; #if ( clock, r1 texture { Texture_R } translate< d1x, 0 , d1z > } translate rotate } object{ sphere{ <0,0,0>, r2 texture { Texture_L } translate< s0-d2x+v0*Sclock_01(StepNr,Total) , 0 , -d2z > } translate rotate } #else #declare StepNr = StepNr +1 ; #if ( clock, r1 texture { Texture_R } translate< d1x+(cos(Alpha2)*p2_2a/m1)*Sclock_01(StepNr,Total) , 0 , d1z+(sin(Alpha2)*p2_2a/m1)*Sclock_01(StepNr,Total) > } translate rotate } object{ sphere{ <0,0,0>, r2 texture { Texture_L } translate< -d2x+(cos(Alpha12)*p1_2a/m2)*Sclock_01(StepNr,Total) , 0 , -d2z-(sin(Alpha12)*p1_2a/m2)*Sclock_01(StepNr,Total) > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_M17} #if ( clock, r1 texture { Texture_R } translate< d1x , 0 , d1z > } translate rotate } object{ sphere{ <0,0,0>, r2 texture { Texture_L } translate< s0-d2x , 0 , -d2z > } translate rotate } #else #declare StepNr = StepNr +1 ; camera{Camera_R} #if ( clock, r1 texture { Texture_R } translate< d1x , 0 , d1z > } translate rotate } object{ sphere{ <0,0,0>, r2 texture { Texture_L } translate< s0-d2x+v0*Sclock_01(StepNr,Total) , 0 , -d2z > } translate rotate } #else //19 #declare StepNr = StepNr +1 ; object{ sphere{ <0,0,0>, r1 texture { Texture_R } translate< d1x+(cos(Alpha2)*p2_2a/m1)*Sclock_01(StepNr,Total) , 0 , d1z+(sin(Alpha2)*p2_2a/m1)*Sclock_01(StepNr,Total) > } translate rotate } object{ sphere{ <0,0,0>, r2 texture { Texture_L } translate< -d2x+(cos(Alpha12)*p1_2a/m2)*Sclock_01(StepNr,Total) , 0 , -d2z-(sin(Alpha12)*p1_2a/m2)*Sclock_01(StepNr,Total) > } translate rotate } #end #end #end #end #end #end #end #end #end #end // 19 end's #end #end #end #end #end #end #end #end // end of animation if loop