POV-Ray : Newsgroups : povray.general : for loops : for loops Server Time
5 Aug 2024 14:12:37 EDT (-0400)
  for loops  
From: Jose Garcia
Date: 10 Sep 2002 17:29:38
Message: <3d7e6442@news.povray.org>
~
does Povray support    for loops   , if so, then how?

I want to create a row of 10 spheres along the x-axis.

Instead of copying the sphere code 10 times, I tried to use a for loop, but
nothing doing.

  #include "colors.inc"


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

  for (int x = 0, x < 10; x++)
{
                      sphere {

    <x, 0, 0>, .5                        // I wanted to draw 10 spheres,
with x starting at 0, going to 10
    texture {
      pigment { color Red }
    }
  }
   }


  light_source { <0, 0, -5> color White}


Is it possible to use a for loop, or is the easiest way to use the brute
force method?

thanks....

out


Post a reply to this message

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