|
 |
Op 28-1-2023 om 11:25 schreef Kenneth:
> I have an isosuface made from multiple functions that is working quite nicely--
> but I want to rearrange the order of the functions to see the different(?)
> results. The code is complex, so I'll leave out the ugly function details and
> syntax. The following is just pseudo code.
>
> Right now, it is like this (very simplified):
> 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?
>
> If the ordering does matter, what would be the most efficient way to set up
> 'switches' at the beginning of the scene to easily change the order of A,B,C and
> D? Possibilities that occur to me would be some kind of combination of
> #switch/#case, or #if blocks, or select(?), or maybe an array; but I want the
> top-of-code selection process to be relatively easy-- something like
> #declare FUNCTION_ORDER= <C,A,D,B>;
> .... and without having to make multiple copies of the functions for all of the
> different permutations.
>
> Any ideas?
>
Funny you ask that, I am currently also wondering about the same. ;-)
I get the impression that it does not really matter, however, when in
doubt, I tend to use parentheses to isolate/group some parts.
My example here (from a project - not isosurfaces - I am slowly working on):
function(x,z) { 2*( f_bozo(5*(x-0.5), 0, 5*(z-0.5)) *
f_granite(15*(x-0.5), 0, 15*(z-0.5)) ) * f_spherical(2.1*(x-0.5), 0,
2.1*(z-0.5))}
uses multiplicators, which is somewhat easier to visualise for me, but I
think I did not really got surprises when I experimented with + or -.
Fun to experiment with indeed.
> (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.)
>
As long as it does what is intended...
--
Thomas
Post a reply to this message
|
 |