|
![](/i/fill.gif) |
In article <3ae8369d$1@news.povray.org>, "Dennis Milller"
<dhm### [at] mediaone net> wrote:
> I came across this code and have on question. If the xcounter and zcounter
> are identical, why can't they be interchanged in the translate statement?
> The image changes dramtically if I substite "zcounter" for "xcounter" or
> vice versa, yet the "declare statements seem to do exactly the same thing.
Because they are *not* identical. Indenting the code properly makes it
clearer:
#declare xcounter = 0;
#while (xcounter < 50)
#declare zcounter = 0;
#while (zcounter < 50)
...
#declare zcounter = zcounter + 1;
#end
#declare xcounter = xcounter + 1;
#end
The zcounter loop is completely independant of the xcounter loop, and
loops from 0 to 49 *every time the xcounter loop goes through one loop*.
The outer loop runs through 50 times, and for each loop the inner loop
gets reset and runs through again.
This has the effect of zcounter going from 0 to 49 while xcounter = 0,
then again while xcounter = 1, and so on. They start out and end at the
same values, but change at different times and rates.
--
Christopher James Huff
Personal: chr### [at] mac com, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tag povray org, http://tag.povray.org/
<><
Post a reply to this message
|
![](/i/fill.gif) |