POV-Ray : Newsgroups : povray.advanced-users : isosurface: Does the order of multiple functions matter? : Re: isosurface: Does the order of multiple functions matter? Server Time
2 Oct 2023 20:48:48 EDT (-0400)
  Re: isosurface: Does the order of multiple functions matter?  
From: Cousin Ricky
Date: 28 Jan 2023 12:40:02
Message: <63d55df2$1@news.povray.org>
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?

It is dangerous programming practice to rely on order of evaluation,
unless the language definition explicitly specifies it.  POV-Ray has no
such specification.

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

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