|
![](/i/fill.gif) |
Thanks for the rapid replies everyone!
"Bob Hughes" <omniverse@charter%net> wrote in message
news:43c20d85$1@news.povray.org...
> "Amazon_Warrior" <heu### [at] yahoo com> wrote in message
> news:43c1ab14@news.povray.org...
> >
> > Just wondering if you can help. I'm a relative newbie to POV, and I've
> > been trying to follow the help file included to solve this, but to no
> > avail.
> > Basically, I want to create a nested while loop containing two different
> > instructions- scale and translate- and apply it to a blob object. The
> > help
> > file suggests that I put the starting loop instructions just after the
> > threshold statement of the blob object, like so:
> >
> > blob {
> > threshold 0.5
> > #declare Length = 0;
> > #while ( Length >= -30 )
> > #declare Scale = 2;
> > #while ( Scale >= 0.25 )
> > sphere { <0,0,0>, 20, 1 scale <1,1,0.9> }
> > translate <Length,0,0>
> > scale Scale
> > #declare Length = Length - 0.25;
> > #declare Scale = Scale - 0.1;
> > #end
> > #end
> > }
> >
> > However, when I run this, I get an error message: No matching } in
blob,
> > sphere found instead. (I'm using version 3.6, if that makes any
> > difference.) I've tried putting the loops in assorted other places as
> > well,
> > but... nada.
>
> You're applying transformations (the translate and scale), multiple times,
> only to the blob object itself but not to the sphere(s). Maybe I'm
> misunderstanding this myself here, don't know for sure, it just looks like
> this error is about that particular aspect even though the blob should
still
> be transformable like other objects.
>
> > I've also noticed that the help file indicates that the format of nested
> > while loops should be:
> >
> > #declare Variable1 = 0;
> > #while ( Variable1 <= X )
> > #declare Variable2 = 0;
> > #while ( Variable2 >= Y )
> > {{{Stuff here}}}
> > #declare Variable1 = Variable1 + A;
> > #end
> > #declare Variable2 = Variable2 - B;
> > #end
> >
> > I've not found this works. Instead, I put both #end statements after
the
> > last variable (as in the previous example), and it seems to work, which
is
> > confusing. I'd be really grateful if someone could tell me what I'm
doing
> > wrong.
>
> For the loops to retain their own identities they require the #end to be
> placed where only the corresponding #while contains the parts you want to
> change during the looping. If you have the #end's together you aren't
> applying anything unique to the first (or outer wrapping) loop, since both
> variables change during the second (inner wrapped) loop but nothing is
done
> once it leaves it.
>
Ok, I think I see what you mean... I'm not a programmer as such, just an
interested on-looker, so I can grasp some of this, but please be patient
with me if I seem especially dense!
> Back to your blob looping... you seem to be creating a series of shells.
The
> placing of the spheres would repeat (0*x to -30*x), with smaller sizes (2
to
> 0.25 radii). This won't matter much unless you animated it during the
> process, so I'm guessing you have some idea of what is being done there
> (like maybe only a while loop test?).
>
> The actual while loops should be okay if it is written:
>
> blob {
> threshold 0.5
> // setup for outer (first) loop
> #declare Length = 0;
> #while ( Length >= -30 )
> // set up for inner (second) loop [also gets reset during outer loop]
> #declare Scale = 2;
> // run the following loop
> #while ( Scale >= 0.25 )
> sphere {
> <0,0,0>, 20, 1 scale <1,1,0.9>
> translate <Length,0,0>
> scale Scale
> } // enclose sphere statement here
> // inner loop variable change
> #declare Scale = Scale - 0.1;
> #end
> // outer loop variable change
> #declare Length = Length - 0.25;
> #end
> }
>
> If that's still not making sense enough please go ahead and ask more about
> it. I think you're going to want to shift the position around more than
> this, anyway, to keep the parts separate and visible. For example, by
adding
> movement in another direction during the scaling part.
>
H'mmm. Thanks for the advice, I think I followed it, however, I'm not so
sure about my version of POV! I copy&pasted your example into POV and ran
it. The translation part certainly seems to work fine, but there is no
noticable scaling effect, which is a problem I've experienced before with
this. I could achieve one effect only at the expense of the other that I
desired. (I changed the parameters to make everything more obvious, and it
was clear that no scaling was occuring.) If the loops are switched around,
I get scaling, but no translation. Grrrrrrr!
> > Also, can someone fully explain trace for me? I can't seem to get it to
> > work properly, and I would like to be able to 'trace' an object
> > repeatedly,
> > so that several instances of the same object are applied. Don't know if
> > I'm
> > making much sense here?
>
> I like to point out the sample scene files when someone asks about such
> things as 'trace'!
>
> [main POV-Ray files location]\scenes\language
>
> There are three or four examples using trace there.
>
> I can only manage a loose description of what takes place and how it is
> doing it, mimicking the Help wording, so I'd rather not try. ;) Someone
> else might have insights into using it in #while loops so I'll leave that
up
> to another person, if anyone else replies.
>
> Bob
>
I've checked them out before, actually. There's some fascinating stuff in
the scenes directory! :) Think I'll have to have another look. I can
usually figure things out if I think about them carefully. However, I
suspect I'm onto a loser unless I can get these wretched while loops to
behave first. Thank you very much for your time and thoughts, tho!
Heulwen
>
Post a reply to this message
|
![](/i/fill.gif) |