home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #7 / amigamamagazinepolishissue1998.iso / varia / povray3 / povray3_fpu / pov3demo / anim / vect1 / vect1.pov < prev   
Text File  |  1997-12-12  |  2KB  |  86 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. // An object that rotates one full circle of 360 degrees
  21. #declare Arm = 
  22.  union{
  23.    cylinder{0,3*x,.3}
  24.    sphere{0,.5}
  25.    sphere{3*x,.5}
  26.    pigment{Red} 
  27.    rotate ClockRot  
  28.  }
  29.  
  30. // A point on the object that is rotating
  31. #declare Attach_Point=vrotate(x*3,ClockRot)
  32.  
  33. // A point where we will anchor the push rod
  34. #declare Fixed_Point =x*8
  35.  
  36. // This rod runs from the Attach_Point to the Fixed_Point.
  37. // It varies in length as the Arm rotates.
  38. #declare Long_Rod=
  39.  union{
  40.    sphere{Attach_Point,.2}
  41.    cylinder {Attach_Point,Fixed_Point,0.2 }
  42.    pigment{Green}
  43.  }
  44.  
  45. // Use the vlength function to compute the length.
  46. #declare Long_Length=vlength(Attach_Point - Fixed_Point)
  47.  
  48. // We want a fixed length short, fat rod that follows the same angle
  49. // as the long rod.  Compute a unit vector that is parallel to
  50. // the long rod.
  51.  
  52. #declare Normalized_Point = vnormalize(Attach_Point-Fixed_Point)
  53.  
  54. #declare Short_Length=4
  55.  
  56. #declare Short_Rod=
  57.   union{
  58.     sphere{0,.5}
  59.     cylinder {0,Short_Length*Normalized_Point,0.5}
  60.     translate Fixed_Point  // move into place
  61.     pigment{Blue}
  62.   }
  63.  
  64. union {
  65.   object{Arm}
  66.   union {
  67.     object{Long_Rod}
  68.     object{Short_Rod}
  69.     translate -z/2
  70.   }
  71.   translate -x*4
  72. }
  73.  
  74. text{ttf Font concat("Angle=",str(Clock360,1,1)),0.1,0 scale 2 pigment{Red} translate <-3.5,3.5,0>}
  75. text{ttf Font concat("Length=",str(Long_Length,1,1)),0.1,0 scale 2 pigment{Green} translate <-3.5,-5,0>}
  76.  
  77. camera {
  78.    location  <0, 0, -120>
  79.    direction <0, 0.5,  11>
  80.    look_at   <0, 0,   0>
  81. }
  82.  
  83. light_source { <5000, 10000, -20000> color White}
  84. plane { z, 1/3 pigment {checker color rgb <1,.8,.8> color rgb <1,1,.8>} }
  85.  
  86.