POV-Ray : Newsgroups : povray.general : for loops : Re: for loops Server Time
5 Aug 2024 14:15:41 EDT (-0400)
  Re: for loops  
From: Peter Hertel
Date: 10 Sep 2002 18:02:33
Message: <3d7e6bf9@news.povray.org>
> Is it possible to use a for loop, or is the easiest way to use the brute
> force method?

Hi!
Yes, POV-Ray supports loops

This creates 10 red spheres along the x axis:

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

#declare Q = 0;
#while (Q < 10)

sphere {<Q,0,0>,.5
    texture {pigment { rgb <1,0,0> }}
}

#declare Q = Q+1;
#end

light_source { <0,0,-5> rgb 1}

Hope that helps!

(Check out the docs [6.2.6.4]  The #while...#end Directive)

-Peter


Post a reply to this message

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