

"Kenneth" <kdw### [at] gmailcom> wrote:
> Right now, it is like this (very simplified):
> isosurface{
> function{A + B + C + D}
> ....
> }
Since you only have addition (or subtraction), your function is both associative
and commutative with respect to the relevant terms.
If you had multiplication or division, it would (also) be distributive with
respect to the affected terms.
Once you start to do things that are "termspecific", like daisychaining
functions together like A(B(C(D(n)))) or having the need to enclose things in
parentheses to get the proper sign or Order of Operations, then you need to be
organized and aware of the consequences of changing things around.
you may have 5  x + a, or 5  x a, which is different than 5  (x+a) and 5 
(xa).
5a/x will be different than (5a)/x
same with 5a*x and (5a)*x
So, you can use an online equation solver to evaluate the equation in symbolic
terms, or to plug in values. You can also evaluate parts of your functions in
POVRay and send the result to the #debug stream.
#declare A = function (N) {sqrt(N)}
#declare Result = A (27);
#debug concat (str(Result, 0, DecimalPlaces), " \n")
If you are unsure about changing things around, then you can start to separate
terms in your functions into subfunctions and then start to recombine them.
#declare A = function (X, Y, Z, N) {(3*X + pow (Y, 3))/Z*sqrt(N)}
#declare Asub1 = function (X, Y, Z, N) {(3*X + pow (Y, 3))/Z}
#declare Asub1a = function (X, Y, Z, N) {3*X+pow (Y, 3)}
#declare Asub2a = function (X, Y, Z, N) {3*X}
#declare Asub2b = function (X, Y, Z, N) {pow (Y, 3)}
#declare Asub1b = function (X, Y, Z, N) {Asub2a (X, Y, Z, N) + Asub2b (X, Y, Z,
N)}
#declare Asub1c = function (X, Y, Z, N) {Asub1b (X, Y, Z, N)/ Z}
#declare Asub2c = function (X, Y, Z, N) {sqrt(N)}
#declare Asub3 = function (Term1, Term2) {Asub1c (X, Y, Z, N) * Asub2c (X, Y, Z,
N)}
*before 1st coffee, untested code
So you can see inside the curly brackets how the functions get simpler, but due
to the nature of POVRay's function parser, the expressions to evaluate those
can get more complex. It is however, good practice to understand the finer bits
of the function syntax and why things go wrong, and how they can go wrong in a
hurry.
If you do you evaluations with a macro and declaring local identifiers to be the
result of chains of operations, then you can get the answers you need in the
#debug stream, and use that as a guide to getting it right in the invisible and
complicated operations that happen in functions and isosurfaces.
Your mission, Kenneth, should you choose/decide to accept it, is to concatenate
these functions and successfully render an errorfree isosurface. As always,
should you or any of your POVRay collaborators be caught or killed, the Dev
Team will disavow any knowledge of your actions. This message will selfdestruct
in ten POV units. Good luck, Kenneth.
Post a reply to this message

