|
|
"TheBigH" <nomail@nomail> wrote:
> I see, thank for the heads up. I'm beginning to see that many things that are
> straightforward and logical in other programming languages require awkward
> contortions in POV-ray. Of course I could just do something like
>
> #declare Gridd = function(X,Y) {
> (( X-floor(X)<thick )|(X-floor(X)>(1-thick))|( Y-floor(Y)<thick
> )|(Y-floor(Y)>(1-thick)))
> }
>
> because the function I want only takes the values zero and one, but if I ever
> want other values, or more than two different values, I need proper selection of
> cases. And I would definitely have preferred a nice orderly succession of #ifs
> to the horror of nested selects. Oh well.
The real question you should ask yourself is why you need a function at all and
if another macro won't suffice. The primary use of functions is for objects that
require runtime evaluation, i.e. isosurfaces, and a binary selection is not the
best solution. Another user for functions is in user-defined patterns, where
your problem mightbbe much better solved using a map, i.e. a color_map.
Thorsten
Post a reply to this message
|
|