|
 |
On 2023-01-28 06:25 (-4), Kenneth wrote:
>
> isosurface{
> function{A + B + C + D}
> ....
> }
>
> Only four, thankfully! :-)
>
> Does the order of the functions matter when POV-ray evaluates them? Or are they
> evaluated 'all at once' regardless of the order?
<soapbox>
It is dangerous programming practice to rely on order of evaluation,
unless the language definition explicitly specifies it. POV-Ray has no
such specification.
</soapbox>
In your context, it does not appear that the order makes any difference,
because functions in POV-Ray cannot have side effects. Of course,
liberal use of parentheses will guarantee *precedence* of evaluation,
but this has limited effect on the *order* of evaluation.
> (BTW: #if and #switch/#case do work well in the body of the isosurface, within
> the main function, to at least eliminate certain parts. Probably not good code
> practice, but it causes no problems AFAIK.)
Directives (#if, #switch, etc.) in functions are parsed only once, when
the function is defined. Directives in functions that are coded in-line
in an isosurface will be observed each time the object is parsed, but
directives in any pre-defined functions used in the isosurface will not
be re-parsed.
Post a reply to this message
|
 |