POV-Ray : Newsgroups : povray.newusers : Is there a for operator? : Re: Is there a for operator? Server Time
28 Jul 2024 14:23:46 EDT (-0400)
  Re: Is there a for operator?  
From: Mathuin
Date: 2 Oct 2008 18:35:01
Message: <web.48e54c5cee785afd8a103ef0@news.povray.org>
Blue Herring <pov### [at] bherringcotsenet> wrote:
> Mathuin wrote:
> > I have a scene file which has stuff like this:
> >
> > #macro bigthing(_this, _that, _other)
> > ..... do this big thing
> > #end // bigthing
> >
> > #macro blah(_index)
> > bigthing(ThisArr[_index], ThatArr[_index], OtherArr[_index])
> > #end // blah
> >
> > blah(1)
> > blah(2)
> > blah(3)
> > ..... and so forth
> >
> > Is there any way I can condense the multiple blah() calls into something like:
> >
> > #for _index in 1..10
> > blah(_index)
> > #end // for
> >
> > That would rule.  Thanks!
>
> There's no "for" but you can use "while" for the same purpose.  For example:
>
> #declare Count = dimension_size(ThisArr, 1);
> #declare Ct = 0;
> #while(Ct < Count)
>    blah(Ct)
>    #declare Ct = Ct + 1;
> #end

I should have remembered that from C!  Thanks!

>
> --
> // The Mildly Infamous Blue Herring
> #version 3.61;#include"functions.inc"global_settings{assumed_gamma
> 2.2}isosurface{function{-f_strophoid(x/2-.45,y,z*3,1,1.2,1,1.5)-.05}
> contained_by{box{<-2.1,-1,-1/3>,<1.4,1,1/3>}}max_gradient 12inverse
> hollow pigment{rgbf 1}interior{media{samples 8 emission<3,80,150>/255
> density{crackle metric 1color_map{[0rgb 6][.03rgb 0][1rgb 0]}scale<1,
> 2,1>warp{turbulence<.5,.75,.5>}scale 1/3}}}translate z*3}


Post a reply to this message

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