home *** CD-ROM | disk | FTP | other *** search
/ ANews 3 / AnewsCD3.iso / atari / GRAPHX / POV / 68030.060 / POV31G30 / POVRAY_3.1G / SCENES / MACROS / PYRAMID.POV < prev    next >
Text File  |  1999-10-30  |  1KB  |  50 lines

  1. // Persistence of Vision Ray Tracer POV-Ray 3.1 Sample Scene
  2. // by Chris Young
  3. //    Based on a POV-Ray 3.0 file by
  4. //    Sven Hilscher * 3D-Max usergroup germany
  5. //    email: sven@rufus.central.de
  6. // PYRAMID.POV demonstrates basic use of macros and local
  7. // identifiers in recursive calls.  Creates a fractal
  8. // pyramid from spheres.
  9. //
  10. // Note some spheres are redundant.  See PYRAMID2.POV
  11. // for a version which eliminates duplicate spheres.
  12.  
  13.  
  14. // Define the macro.  Parameters are:
  15. //   X:  position of sphere
  16. //   Y:  position of sphere
  17. //   Z:  position of sphere
  18. //   R:  radius of sphere
  19. //   L:  level of recursion
  20. #macro Pyramid(X,Y,Z,R,L)
  21.  
  22.   sphere { <X,Y,Z>,R}
  23.  
  24.   #if (L > 0)
  25.     #local New_L = L - 1;
  26.     #local New_R = R / 2;
  27.     #local Pos   = New_R * 3;
  28.  
  29.     Pyramid(X+Pos,Y,Z,New_R,New_L)
  30.     Pyramid(X-Pos,Y,Z,New_R,New_L)
  31.     Pyramid(X,Y+Pos,Z,New_R,New_L)
  32.     Pyramid(X,Y-Pos,Z,New_R,New_L)
  33.     Pyramid(X,Y,Z+Pos,New_R,New_L)
  34.     Pyramid(X,Y,Z-Pos,New_R,New_L)
  35.   #end       
  36. #end
  37.  
  38. union {
  39.   Pyramid(0,0,0,4,6)
  40.   pigment { rgb <0,1,1> } 
  41. }
  42.  
  43. light_source { <20,200,100>, rgb 1 }
  44.  
  45. background { color rgb <.4, .3, .2> }
  46.  
  47. camera { location <5,17,19>
  48.          look_at  <0,0,0>
  49. }
  50.