|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I'd like to know if the following things are possible within POV-Ray's
scene language, either directly or via some indirect workaround.
1) When doing a while loop, is it possible to conditionally abort the
loop and continue processing the rest of the scene file, if a certain
condition tests true? I believe this ability exists in some
programming languages, but I don't know how to do it with POV.
2) Is it possible to combine tests within an #if statement? Imagine
something roughly like this:
#if (A>2) AND (B>3)
DoStuffHere
#end
I'd like to know how to accomplish the equivalent of these ideas. I'm
not expecting POV to support them directly. Any help is appreciated.
thanks,
Glen
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
something like the following:
#if ((A > 2) & (B > 3))
DoStuffHere
#end
another example:
#local I = 0;
#while (I < 10)
RepeatThisTenTimes
#declare I = I + 1;
#end
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Glen Berry nous apporta ses lumieres ainsi en ce 22/06/2004 21:45... :
>I'd like to know if the following things are possible within POV-Ray's
>scene language, either directly or via some indirect workaround.
>
>1) When doing a while loop, is it possible to conditionally abort the
>loop and continue processing the rest of the scene file, if a certain
>condition tests true? I believe this ability exists in some
>programming languages, but I don't know how to do it with POV.
>
>
Yes like this:
#local I=0;
#while(I<10)
<<some code>>
#if(stopingcondition)#local SaveIndex=I; // only if you need to
preserve the index at whitch the stop condition became true.
#local I=10;#end // Set the loop index past the end value!
#local I = I + 1;
#end
Alain
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Alain wrote:
> Glen Berry nous apporta ses lumieres ainsi en ce 22/06/2004 21:45... :
>
>> I'd like to know if the following things are possible within POV-Ray's
>> scene language, either directly or via some indirect workaround.
>>
>> 1) When doing a while loop, is it possible to conditionally abort the
>> loop and continue processing the rest of the scene file, if a certain
>> condition tests true? I believe this ability exists in some
>> programming languages, but I don't know how to do it with POV.
>>
>>
> Yes like this:
> #local I=0;
> #while(I<10)
> <<some code>>
> #if(stopingcondition)#local SaveIndex=I; // only if you need to
> preserve the index at whitch the stop condition became true.
> #local I=10;#end // Set the loop index past the end value!
> #local I = I + 1;
> #end
>
> Alain
What amazes me about this is one simple question has resulted in three
different answers... ;)
If the POV-Team is following this: Might I suggest a #break and a
#continue statement? :)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <40d972ca$1@news.povray.org> , Mike Raiford
<mra### [at] hotmailcom> wrote:
> If the POV-Team is following this: Might I suggest a #break and a
> #continue statement? :)
It is extremely bad programming practice to have an multiple execution paths
to leave a loop.
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thorsten Froehlich wrote:
> In article <40d972ca$1@news.povray.org> , Mike Raiford
> <mra### [at] hotmailcom> wrote:
>
>
>>If the POV-Team is following this: Might I suggest a #break and a
>>#continue statement? :)
>
>
> It is extremely bad programming practice to have an multiple execution paths
> to leave a loop.
>
> Thorsten
>
Hm. You have a point there. Ideally the condition of the loop should
determine when to leave the loop. But .... But.. err. hmm, I have no
excuse for wanting such a feature :)
Come to think of it, The only time I have ever used break in C is in the
switch statement... (Next, I'm sure I'll hear how switch statements are
poor programming practice in most situations... except when writing
Windows Message handlers ...)
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
In article <40d9c157@news.povray.org> , Mike Raiford <mra### [at] hotmailcom>
wrote:
> Come to think of it, The only time I have ever used break in C is in the
> switch statement... (Next, I'm sure I'll hear how switch statements are
> poor programming practice in most situations... except when writing
> Windows Message handlers ...)
No, switch statements are an extremely important control structure good for
much more than you think.
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trfde
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
On Wed, 23 Jun 2004 19:25:19 +0200, "Thorsten Froehlich"
<tho### [at] trfde> wrote:
>It is extremely bad programming practice to have an multiple execution paths
>to leave a loop.
>
> Thorsten
Yes, I thought I had read that somewhere. Once I was shown the proper
syntax for simultaneously testing two conditions using the '&'
symbol, I didn't need the multiple exit paths.
I hope this isn't also considered poor programming. ;)
Thanks everyone, for all the suggestions. It was the '&' symbol
suggestion that solved my problem.
later,
Glen
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |