POV-Ray : Newsgroups : povray.general : multi-segment if/else Server Time
3 Aug 2024 08:14:04 EDT (-0400)
  multi-segment if/else (Message 1 to 3 of 3)  
From: Dennis Miller
Subject: multi-segment if/else
Date: 15 Apr 2004 17:34:53
Message: <407efffd$1@news.povray.org>
I have a scene with two planes; I want the first to appear when the clock is
below .7 and the second when it is above .7:

#if (clock <.7)

plane 1 {...}

#else

plane 2 {...}

#end

But what if I wanted plane 1 when the clock was between, say 0 and .5, then
plane 2 when it was between .5 and .7, then plane 1 to return again between
.7 to .9, then plane 2 between .9 and 1?
How can I do a multisegment if/else or something comparable?
Thanks,
Dennis

-- 

dhm### [at] comcastnet
http://www.dennismiller.neu.edu


Post a reply to this message

From: Alain
Subject: Re: multi-segment if/else
Date: 15 Apr 2004 17:46:46
Message: <407f02c6$1@news.povray.org>
Dennis Miller nous apporta ses lumieres ainsi en ce 2004/04/15 17:34... :

>I have a scene with two planes; I want the first to appear when the clock is
>below .7 and the second when it is above .7:
>
>#if (clock <.7)
>
>plane 1 {...}
>
>#else
>
>plane 2 {...}
>
>#end
>
>But what if I wanted plane 1 when the clock was between, say 0 and .5, then
>plane 2 when it was between .5 and .7, then plane 1 to return again between
>.7 to .9, then plane 2 between .9 and 1?
>How can I do a multisegment if/else or something comparable?
>Thanks,
>Dennis
>
>  
>
you can nest #if like this:
#if (condition1)
<code>
#else
 #if(condition2)
 <code>
 #else
 .
 .
 .
 #end
#end

You can use the #switch, #case, #range and #break directives
Look at item 6.2.6.3

Alain


Post a reply to this message

From: Tom Galvin
Subject: Re: multi-segment if/else
Date: 15 Apr 2004 18:48:08
Message: <Xns94CCBF44B6869tomatimporg@203.29.75.35>
"Dennis Miller" <dhm### [at] comcastnet> wrote in
news:407efffd$1@news.povray.org: 


> How can I do a multisegment if/else or something comparable?
> 

Use switch and range:

http://www.povray.org/documentation/view/150/

-- 
Tom
_________________________________
The Internet Movie Project
http://www.imp.org/


Post a reply to this message

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