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
29 May 2024 11:57:14 EDT (-0400)
  Re: isosurface: Does the order of multiple functions matter?  
From: Alain Martel
Date: 28 Jan 2023 12:27:51
Message: <63d55b17$1@news.povray.org>
Le 2023-01-28 à 05:25, Kenneth a écrit :
> 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?
> 
> (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.)
> 

The order should have no effect in this case. As long as you have all 
additions or all multiplications, shuffling the terms won't change the 
end result.
BUT, remember that A-B is different from B-A and A/B is also different 
from B/A.


Post a reply to this message

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