Advertisement
uwezi

animated sine wave complex number display

May 24th, 2020
4,843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
POV-Ray 13.04 KB | None | 0 0
  1. /*
  2. ; use with the following .ini-file
  3. ; POV-Ray animation ini file
  4. Antialias=On
  5. Antialias_Threshold=0.1
  6. Antialias_Depth=2
  7.  
  8. Input_File_Name="20200131_animated_sine.pov" ; change if needed
  9.  
  10. Initial_Frame=1
  11. Final_Frame=600
  12. Initial_Clock=0
  13. Final_Clock=3.375
  14.  
  15. Cyclic_Animation=off
  16. Pause_when_Done=off
  17.  
  18. ;convert -density 300 -delay 4 -loop 0 20200131_animated_sine*.png animated.gif
  19. ;ffmpeg -r 10 -i 20200131_animated_sine%03d.png -c:v libx264 -vf fps=25 -pix_fmt yuv420p out2.mp4
  20. ;ffmpeg -framerate 30 -pattern_type glob -i '*.png' -c:v libx264 -pix_fmt yuv420p out.mp4
  21. */
  22. // PoVRay 3.7 Scene File " ... .pov"
  23. // author:  ...
  24. // date:    ...
  25. //------------------------------------------------------------------------
  26. #version 3.7;
  27. global_settings{ assumed_gamma 1.0 }
  28. #default{ finish{ ambient 0.1 diffuse 0.9 }}
  29. //------------------------------------------------------------------------
  30. #include "colors.inc"
  31. #include "colours_x11.inc"
  32. #include "textures.inc"
  33. #include "glass.inc"
  34. #include "metals.inc"
  35. #include "golds.inc"
  36. #include "stones.inc"
  37. #include "woods.inc"
  38. #include "shapes.inc"
  39. #include "shapes2.inc"
  40. #include "functions.inc"
  41. #include "math.inc"
  42. #include "transforms.inc"
  43.  
  44. #declare start_zrot = 1.0;
  45. #declare stop_zrot  = 1.5;                            
  46. #declare start_xrot = 1.8;
  47. #declare stop_xrot  = 1.9;                            
  48.  
  49. //------------------------------------------------------------------------ right handed Coordinate system z up
  50. #declare Camera_0 = camera {/*ultra_wide_angle*/ angle 55  // front view from x+
  51.                             sky z
  52.                             location  <10.0 , 0.0 , 1.0>
  53.                             right    -x*image_width/image_height
  54.                             look_at   <0.0 , 0.0 , 1.0>}
  55. #declare Camera_1 = camera {/*ultra_wide_angle*/ angle 14  // diagonal view
  56.                             sky z
  57.                             right    -x*image_width/image_height
  58.                             location  <20.0,-20.0, 12.0 >
  59.                             look_at   <0.0 , 0 , 1.2> }
  60. #declare Camera_2 = camera {/*ultra_wide_angle*/ angle 55  //right side view from y-
  61.                             sky z
  62.                             location  <0.0 ,-10.0 , 1.0>
  63.                             right    -x*image_width/image_height
  64.                             look_at   <0.0 , 0.0 , 1.0>}
  65. #declare Camera_3 = camera {/*ultra_wide_angle*/ angle 65   // top view from z- (x right y up )
  66.                             sky z
  67.                             location  < 0,-0.001, 10>
  68.                             right    -x*image_width/image_height
  69.                             look_at   <0.0 , 0.0 , 1.0>}
  70. #declare Camera_4 = camera {/*ultra_wide_angle*/ angle 14  // diagonal view
  71.                             sky z
  72.                             right    -x*image_width/image_height
  73.                             location  <20.0,-20.0, 12.0 >
  74.                             look_at   <3.5 , 0 , 1.2> }
  75. #declare Camera_5 = camera { // front view
  76.                             orthographic
  77.                             sky z
  78.                             right    <10,0,0>
  79.                             up       <0,0,6>
  80.                             location  <3.5,-20.0, 0.0 >
  81.                             look_at   <3.5 , 0 , 0.0> }
  82. #declare Camera_6 = camera { // front view
  83.                             orthographic
  84.                             sky z
  85.                             right    <800,0,0>*0.012
  86.                             up       <0,0,600>*0.012
  87.                             location  <3.5,-20.0, 0.0 >
  88.                             look_at   <3.5 , 0 , 0.0>
  89.                            
  90. #switch(clock)
  91. #range(0,start_zrot)
  92.   rotate <0,0,0>
  93.   #break                            
  94. #range(start_zrot,stop_zrot)
  95.   translate<-3.5*(clock-start_zrot)/(stop_zrot-start_zrot),0,0>
  96.   rotate <0,0,-90*(clock-start_zrot)/(stop_zrot-start_zrot)>
  97.   #break                            
  98. #range(stop_zrot,start_xrot)
  99.   translate<-3.5,0,0>
  100.   rotate <0,0,-90>
  101.   #break                            
  102. #range(start_xrot,stop_xrot)
  103.   translate<-3.5,0,0>
  104.   rotate <0,0,-90>
  105.   rotate <-90*(clock-start_xrot)/(stop_xrot-start_xrot),0,0>
  106.   #break                            
  107. #else
  108.   translate<-3.5,0,0>
  109.   rotate <0,0,-90>
  110.   rotate <-90,0,0>
  111. #end                            
  112. }                            
  113. #declare Camera_7 = camera { // front view
  114.                             orthographic
  115.                             sky z
  116.                             right    <800,0,0>*0.012
  117.                             up       <0,0,600>*0.012
  118. #switch(clock)
  119. #range(0,start_zrot)                            
  120.                             location  <3.5,-20.0, 0.0 >
  121.   #break                            
  122. #range(start_zrot,stop_zrot)
  123.                             location  <3.5,-20.0, 10.0*(1-pow((clock-(start_zrot+stop_zrot)/2.0)/((stop_zrot-start_zrot)/2.0),2)) >
  124.   #break
  125. #else
  126.                             location  <3.5,-20.0, 0.0 >
  127. #end                              
  128.                             look_at   <3.5 , 0 , 0.0>
  129.                            
  130. #switch(clock)
  131. #range(0,start_zrot)
  132.   rotate <0,0,0>
  133.   #break                            
  134. #range(start_zrot,stop_zrot)
  135.   translate<-3.5*(clock-start_zrot)/(stop_zrot-start_zrot),0,0>
  136.   rotate <0,0,-90*(clock-start_zrot)/(stop_zrot-start_zrot)>
  137.   #break                            
  138. #range(stop_zrot,start_xrot)
  139.   translate<-3.5,0,0>
  140.   rotate <0,0,-90>
  141.   #break                            
  142. #range(start_xrot,stop_xrot)
  143.   translate<-3.5,0,0>
  144.   rotate <0,0,-90>
  145.   rotate <-90*(clock-start_xrot)/(stop_xrot-start_xrot),0,0>
  146.   #break                            
  147. #else
  148.   translate<-3.5,0,0>
  149.   rotate <0,0,-90>
  150.   rotate <-90,0,0>
  151. #end                            
  152. }                            
  153. camera{Camera_7}
  154. //------------------------------------------------------------------------
  155. // sun -------------------------------------------------------------------
  156. light_source{<-1500,+2500, 1500> color White}
  157. light_source{<-1500,-2500, 1500> color White}
  158. // sky -------------------------------------------------------------------
  159. sky_sphere{ pigment{ gradient <0,0,1>
  160.                      color_map{ [0   color rgb<1,1,1>         ]//White
  161.                                 [0.2 color rgb<0.20,0.30,0.56>*0.9]//~Navy
  162.                                 [0.8 color rgb<0.20,0.30,0.56>*0.9]//~Navy
  163.                                 [1.0 color rgb<1,1,1>         ]//White
  164.                               }
  165.                      scale 2 }
  166.            } // end of sky_sphere
  167. //------------------------------------------------------------------------
  168.  
  169. //------------------------------ the Axes --------------------------------
  170. //------------------------------------------------------------------------
  171. #macro Axis_( AxisLenN, AxisLenP, Dark_Texture,Light_Texture)
  172.  union{
  173.     cylinder { <0,0,-AxisLenN>,<0,0,AxisLenP>,0.05
  174.                texture{checker texture{Dark_Texture }
  175.                                texture{Light_Texture}          
  176.                        translate<0.0,0,0.0>}
  177.              }
  178.     cone{<0,0,0>,0.2,<0,0,0.7>,0 translate<0,0, AxisLenP>
  179.           texture{Dark_Texture}
  180.          }
  181.      } // end of union                  
  182. #end // of macro "Axis()"
  183. //------------------------------------------------------------------------
  184. #macro arrow( arrowLength, arrowDia, arrowColor)
  185.  union
  186.  {
  187.    cylinder
  188.    {
  189.      <0,0,0>, <0,0,arrowLength-1.5*arrowDia>, arrowDia/2
  190.      texture{ pigment{arrowColor} }
  191.    }
  192.    cone
  193.    {
  194.      <0,0,0>,arrowDia,<0,0,1.5*arrowDia>,0 translate<0,0,arrowLength-1.5*arrowDia>
  195.      texture{ pigment{arrowColor} }
  196.    }
  197.  }                
  198. #end
  199. //------------------------------------------------------------------------
  200. #macro AxisXYZ( AxisLenXn,AxisLenXp, AxisLenYn, AxisLenYp, AxisLenZn, AxisLenZp, Tex_Dark, Tex_Light)
  201. //--------------------- drawing of 3 Axes --------------------------------
  202. union{
  203.  object { Axis_(AxisLenXn,AxisLenXp, Tex_Dark, Tex_Light)   rotate< 0,90, 0>}// x-Axis
  204.  object { Axis_(AxisLenYn,AxisLenYp, Tex_Dark, Tex_Light)   rotate< 0,0,  0>}// y-Axis
  205.  object { Axis_(AxisLenZn,AxisLenZp, Tex_Dark, Tex_Light)   rotate<-90,0,  0>}// z-Axis
  206. } // end of union
  207. #end// of macro "AxisXYZ( ... )"
  208. //------------------------------------------------------------------------
  209.  
  210. #declare Texture_Text    = texture {
  211.                                pigment{ color rgb<0,0,1> }
  212.                                finish { phong 1}
  213.                              }
  214. #declare Texture_A_Dark  = texture {
  215.                                pigment{ color rgb<1,0.40,0> }
  216.                                finish { phong 1}
  217.                              }
  218. #declare Texture_A_Light = texture {
  219.                                pigment{ color rgb<1,1,1>}
  220.                                finish { phong 1}
  221.                              }
  222.  
  223. object{ AxisXYZ( .5,7.00, 1.5,1.5, 1.5,1.5, Texture_A_Dark, Texture_A_Light)}
  224. //-------------------------------------------------- end of coordinate axes
  225.  
  226.  text   { ttf "arial.ttf",  "U(t)",  0.005,  0
  227.           rotate<90,0,0>
  228.           texture{Texture_Text}
  229.           scale 0.75
  230.           translate <0.3,0,2>
  231.           no_shadow
  232.           }
  233.  
  234.  text   { ttf "arial.ttf",  "t",  0.005,  0
  235.           rotate<90,0,0>
  236.           texture{Texture_Text}
  237.           scale 0.75
  238.           translate <7,0,.5>
  239.           no_shadow
  240.           }
  241.  
  242.  text   { ttf "arial.ttf",  "Im(Z)",  0.005,  0
  243.           rotate<0,-90,0>
  244.           texture{Texture_Text}
  245.           scale 0.75
  246.           translate<0,0,0>
  247.  #switch(clock)
  248.    #range(0,start_xrot)
  249.      rotate <90,0,0>
  250.      #break
  251.    #range(start_xrot,stop_xrot)
  252.      rotate <90-90*(clock-start_xrot)/(stop_xrot-start_xrot),0,0>
  253.      #break
  254.    #else
  255.  #end    
  256.           translate <0,2.7,.2>
  257.           no_shadow
  258.           }
  259.  
  260.  text   { ttf "arial.ttf",  "Re(Z)",  0.005,  0
  261.           rotate<0,-90,0>
  262.           texture{Texture_Text}
  263.           scale 0.75
  264.  #switch(clock)
  265.    #range(0,start_xrot)
  266.      rotate <90,0,0>
  267.      #break
  268.    #range(start_xrot,stop_xrot)
  269.      rotate <90-90*(clock-start_xrot)/(stop_xrot-start_xrot),0,0>
  270.      #break
  271.    #else
  272.  #end    
  273.           translate <0,0.2,2.2>
  274.           no_shadow
  275.           }
  276.  
  277. //--------------------------------------------------------------------------
  278. //---------------------------- objects in scene ----------------------------
  279. //--------------------------------------------------------------------------
  280.                        
  281.                        
  282.   torus {
  283.     1, .01              // major and minor radius
  284.     rotate <0,0,90>      // so we can see it from the top
  285.     pigment { Black }
  286.     translate<3*clock,0,0>  
  287.   }                
  288.  
  289. #for (cl, 0, clock, 1/200)
  290. sphere { <0,0,0>, 0.025
  291.  
  292.          texture { pigment{ color Red } // rgb< 1, 0.0, 0.0>}
  293.                    finish { phong 1 reflection 0.00}
  294.                  } // end of texture
  295.  
  296.           scale<1,1,1>  
  297.  
  298.           translate<0,-1,0>  
  299.                    
  300.           rotate<-360*cl,0,0>
  301.          
  302.           translate<3*cl,0,0>  
  303.        }  // end of sphere -----------------------------------
  304. #end
  305.          
  306. sphere { <0,0,0>, 0.1
  307.  
  308.          texture { pigment{ color Red } // rgb< 1, 0.0, 0.0>}
  309.                    finish { phong 1 reflection 0.00}
  310.                  } // end of texture
  311.  
  312.           scale<1,1,1>  
  313.  
  314.           translate<0,-1,0>  
  315.                    
  316.           rotate<-360*clock,0,0>  
  317.  
  318.           translate<3*clock,0,0>  
  319.  
  320.  
  321.        }  // end of sphere -----------------------------------
  322.  
  323. #switch(clock)
  324.   #range(2.25,10)
  325.     cylinder { <-.1,0,0>,<-.1,0,sin(2*pi*clock)+1e-6>,0.04
  326.                texture { pigment { color Blue2 }}
  327.              }
  328.     cylinder { <-.1,0,sin(2*pi*clock)+1e-6>,<-.1,-cos(2*pi*clock)+1e-6,sin(2*pi*clock)+1e-6>,0.025
  329.                texture { pigment { color Chartreuse4 }}
  330.              }
  331.     cylinder { <-.1,0,0>,<-.1,-cos(2*pi*clock),sin(2*pi*clock)>,0.025
  332.                texture { pigment { color Red }}
  333.              }
  334.     #switch(clock)
  335.     #range(2.25,2.75)        
  336.       #for (cl, 2.25, clock, 1/200)
  337.         sphere
  338.         {
  339.           <0,0,0>, 0.025
  340.           texture
  341.           {
  342.             pigment{ color Magenta4 }
  343.             finish { phong 1 reflection 0.00}
  344.           }  
  345.           translate<-0.1,-.66,0>  
  346.           rotate<-360*cl,0,0>
  347.         }
  348.       #end
  349.       #break
  350.     #range(2.75,3.25)        
  351.       #for (cl, clock, 3.25, 1/200)
  352.         sphere
  353.         {
  354.           <0,0,0>, 0.025
  355.           texture
  356.           {
  357.             pigment{ color Magenta4 }
  358.             finish { phong 1 reflection 0.00}
  359.           }  
  360.           translate<-0.1,-.66,0>  
  361.           rotate<-360*cl,0,0>
  362.         }
  363.       #end
  364.       #break
  365.     #else
  366.       #for (cl, 3.25, clock, 1/200)
  367.         sphere
  368.         {
  369.           <0,0,0>, 0.025
  370.           texture
  371.           {
  372.             pigment{ color Magenta4 }
  373.             finish { phong 1 reflection 0.00}
  374.           }  
  375.           translate<-0.1,-.66,0>  
  376.           rotate<-360*cl,0,0>
  377.         }
  378.       #end
  379.     #end
  380.     #break
  381.   #else
  382. #end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement