home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / varia / povray3 / povray3_040 / pov3demo / anim / vect2 / vect2.pov < prev   
Text File  |  1997-12-12  |  2KB  |  100 lines

  1. // Persistence Of Vision raytracer version 3.0 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. #version 3.0
  7. global_settings { assumed_gamma 2.2 }
  8.  
  9. #include "colors.inc"
  10.  
  11. #declare Font="cyrvetic.ttf"
  12.  
  13. // Basic clock runs from 0.0 to 1.0 but we want to move more
  14. //  than that.  Define a scaled version.
  15.  
  16. #declare Clock360 = 360*clock
  17. #declare ClockRot = Clock360*z
  18.  
  19.  
  20. #declare Vector_Arrow= 
  21.  union{
  22.    cylinder{0,2.5*x,.2}
  23.    cone{2.5*x,.3,3*x,0}
  24.  }
  25.  
  26. #declare X_axis=
  27.   union{
  28.     object{Vector_Arrow}
  29.     object{Vector_Arrow scale <-1,1,1>}
  30.     scale <1.5, .3, .3>
  31.     pigment{rgb<1,.4,0>}
  32.   }
  33. #declare Y_axis=object{X_axis rotate z*90}
  34. #declare Z_axis=object{X_axis rotate y*90}
  35.  
  36. #declare A=object{Vector_Arrow pigment{Red}}
  37. #declare B=object{Vector_Arrow rotate ClockRot translate -z/100 pigment{Green}}
  38. #declare A_point   = x
  39. #declare B_point   = vrotate(x,ClockRot)
  40. #declare A_dot_B   = vdot(A_point,B_point) //float result
  41. #declare C_point   = vcross(A_point,B_point) //vector result
  42. #if (vlength(C_point) != 0.0)
  43.   #declare C=object{Vector_Arrow rotate -y*90 scale <1,1,C_point.z> pigment{Blue}}
  44. #end
  45.  
  46. union {
  47.   object{A}
  48.   object{B}
  49.   #ifdef (C)
  50.     object{C}
  51.   #end
  52.   object{X_axis}
  53.   object{Y_axis}
  54.   object{Z_axis}
  55.   
  56.   rotate <-20,35,0>
  57.   translate <2.5,1,-3.25>
  58. }
  59.  
  60. text{ttf Font 
  61.   concat("A=<",
  62.          str(A_point.x,1,1),",",
  63.          str(A_point.y,1,1),",",
  64.          str(A_point.z,1,1),">"
  65.         ),0.1,0
  66.   pigment{Red}
  67.   translate <-5,3,0>
  68. }
  69. text{ttf Font
  70.   concat("B=<",
  71.          str(B_point.x,1,1),",",
  72.          str(B_point.y,1,1),",",
  73.          str(B_point.z,1,1),">"
  74.         ),0.1,0
  75.   pigment{ Green }
  76.   translate <-5,2,0>
  77. }
  78. text{ttf Font concat("vdot(A,B)=",str(A_dot_B,1,2)),0.1,0 pigment{Magenta*.7} translate <-5,-2,0>}
  79. text{ttf Font
  80.   concat("C=vcross(A,B)=<",
  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 <-5,-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.