home *** CD-ROM | disk | FTP | other *** search
/ ANews 3 / AnewsCD3.iso / atari / GRAPHX / POV / 68030.060 / POV31G30 / POVRAY_3.1G / SCENES / ANIMATE / VECT2 / VECT2.POV < prev   
Text File  |  1999-10-30  |  2KB  |  100 lines

  1. // Persistence Of Vision raytracer version 3.1 sample file.
  2. // File by Chris Young
  3. // Demonstrates various new vector math functions.
  4. // Animate this scene with clock values +k0.0 to +k1.0
  5.  
  6. global_settings { assumed_gamma 2.2 }
  7.  
  8. #include "colors.inc"
  9.  
  10. #declare Font="cyrvetic.ttf"
  11.  
  12. // Basic clock runs from 0.0 to 1.0 but we want to move more
  13. //  than that.  Define a scaled version.
  14.  
  15. #declare Clock360 = 360*clock;
  16. #declare ClockRot = Clock360*z;
  17.  
  18.  
  19. #declare Vector_Arrow= 
  20.  union{
  21.    cylinder{0,2.5*x,.2}
  22.    cone{2.5*x,.3,3*x,0}
  23.  }
  24.  
  25. #declare X_axis=
  26.   union{
  27.     object{Vector_Arrow}
  28.     object{Vector_Arrow scale <-1,1,1>}
  29.     scale <1.5, .3, .3>
  30.     pigment{rgb<1,.4,0>}
  31.   }
  32. #declare Y_axis=object{X_axis rotate z*90}
  33. #declare Z_axis=object{X_axis rotate y*90}
  34.  
  35. #declare A=object{Vector_Arrow pigment{Red}}
  36. #declare B=object{Vector_Arrow rotate ClockRot translate -z/100 pigment{Green}}
  37. #declare A_point   = x;
  38. #declare B_point   = vrotate(x,ClockRot);
  39. #declare A_dot_B   = vdot(A_point,B_point);   //float result
  40. #declare C_point   = vcross(A_point,B_point); //vector result
  41. #if (vlength(C_point) != 0.0)
  42.   #declare C=object{Vector_Arrow rotate -y*90 scale <1,1,C_point.z> pigment{Blue}}
  43. #end
  44.  
  45. union {
  46.   object{A}
  47.   object{B}
  48.   #ifdef (C)
  49.     object{C}
  50.   #end
  51.   object{X_axis}
  52.   object{Y_axis}
  53.   object{Z_axis}
  54.   
  55.   rotate <-20,35,0>
  56.   translate <2.5,1,-3.25>
  57. }
  58.  
  59. text{ttf Font 
  60.   concat("A=<",
  61.          str(A_point.x,1,1),",",
  62.          str(A_point.y,1,1),",",
  63.          str(A_point.z,1,1),">"
  64.         ),0.1,0
  65.   pigment{Red}
  66.   translate <-5,3,0>
  67. }
  68. text{ttf Font
  69.   concat("B=<",
  70.          str(B_point.x,1,1),",",
  71.          str(B_point.y,1,1),",",
  72.          str(B_point.z,1,1),">"
  73.         ),0.1,0
  74.   pigment{ Green }
  75.   translate <-5,2,0>
  76. }
  77. text{ttf Font concat("vdot(A,B)=",str(A_dot_B,1,2)),0.1,0 pigment{Magenta*.7} translate <-5,-2,0>}
  78. text{ttf Font "C=vcross(A,B)=", 0.1,0 pigment{Blue} translate <-5,-3,0>}
  79. text{ttf Font
  80.   concat("<",
  81.          str(C_point.x,1,1),",",
  82.          str(C_point.y,1,1),",",
  83.          str(C_point.z,1,1),">"
  84.         ),0.1,0 
  85.   pigment{Blue} 
  86.   translate <-4,-4,0>
  87. }
  88.  
  89.  
  90. camera {
  91.    location  <0, 0, -100>
  92.    direction <0, 0,  12>
  93.    look_at   <0, 0,   0>
  94. }
  95.  
  96. light_source { <5000, 10000, -20000> color White*.5}
  97. light_source { <-5000, -10000, -20000> color White*.5}
  98. plane { -z, -.05 pigment {checker color rgb <1,.8,.8> color rgb <1,1,.8>} }
  99.  
  100.