POV-Ray : Newsgroups : povray.newusers : Is there a better way of achieving this simple thing : Is there a better way of achieving this simple thing Server Time
29 Jul 2024 00:28:34 EDT (-0400)
  Is there a better way of achieving this simple thing  
From: Elija
Date: 14 Apr 2007 07:25:01
Message: <web.4620b972335b34117fd315660@news.povray.org>
I have just downloaded POV-RAY and and am having my first real go at it.

Is there a better way than this of achieving the pyramid of spheres?

=====================================================================

#include "colors.inc"
#include "metals.inc"


camera {
 location <0, 10, -15>
 look_at  <0, 0,  0>
}

light_source { <2, 14, -23> color White}

#declare s = 5;
union {
 #declare l = 0;
 #while (l < s)
  union {
   #declare xco = 0;
   #declare zco = 0;
   #while (zco < s - l)
    union {
     #while (xco < 5 - l)
      sphere {
       <0, 0, 0>, 1
       texture {
        T_Chrome_5E
       }
       translate x * 2 * xco
      }
      #declare xco = xco + 1;
     #end
     translate -4 * x
     translate 2 * zco * z
     #declare xco = 0;
     #declare zco = zco + 1;

    }
   #end
   translate y * (l * 1.25)
   translate x * l
   translate z * l
   #declare l = l + 1;
  }
 #end
 translate -4 * x
}


plane {
 <0, 1, 0>, -1
 pigment {
  checker color Red, color Blue
 }
}

=====================================================================

Thanks for any pointers


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.