|
|
hi
i am having multiple functions defined in povray, that all return a float value,
now i would like to have povray select a specific function from them depending
on a given coordinate (at runtime!). i think is saw someone using a statement
like
select((x>10&x<40), f1(x,y,z), f2(x,y,z))
*inside* a function but i am having no luck with that. there is no warning or
error, but povray seems to ignore the conditional statement.
is someone able to explain this to me?
thx,
Simon
Post a reply to this message
|
|
|
|
"ghostch" <nomail@nomail> wrote:
> hi
> i am having multiple functions defined in povray, that all return a float value,
> now i would like to have povray select a specific function from them depending
> on a given coordinate (at runtime!). i think is saw someone using a statement
> like
> select((x>10&x<40), f1(x,y,z), f2(x,y,z))
> *inside* a function but i am having no luck with that. there is no warning or
> error, but povray seems to ignore the conditional statement.
> is someone able to explain this to me?
> thx,
> Simon
If you check the docs on select, you will see that it compares the first
argument with zero. If it is less than zero, it will return the second
argument. If it is greater than or equal to, it will return the second
argument. In this case, ( x > 10 & x < 40 ) is always greater than or equal to
zero, since it is either true (1) or false (0). When do you want to return
f1(x,y,z), condition-wise, as opposed to returning f2(x,y,z)? If you want f1
unless that statement is true, you can just subtract 1 from the first argument.
-Reactor
Post a reply to this message
|
|