POV-Ray : Newsgroups : povray.newusers : While Loop Help : Re: While Loop Help Server Time
2 Nov 2024 17:22:02 EDT (-0400)
  Re: While Loop Help  
From: gonzo
Date: 19 Oct 2003 02:55:32
Message: <3f923564@news.povray.org>
Brent G <pov### [at] bc-hqcom> wrote in message
news:3f91fee5$1@news.povray.org...
> Except I can't figure out how to get the stupid while loops to create a
> checkerboard shape :-/ This is what I've gotten so far (the MyGrass
> Objects are both 5x5 shapes):
>


How about this, minimal changes to what you already have...

#declare My_Grass = array[2] { MyGrass1, MyGrass2 }

#declare OddEven = 0;

#declare X = 0;
 #while (X <= 5)


          #declare Z = 0;
          #while(Z <= 6)

                  #declare OddEven = ( ! OddEven );

                  object { My_Grass[OddEven] translate
<-12.5-(X*5),0,1.9+(Z*5)> }
                  object { My_Grass[OddEven] translate
<12.5+(X*5),0,1.9+(Z*5)> }

                  #declare Z = Z + 1;
          #end

          #declare X = X + 1;
 #end

RG


Post a reply to this message

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