|
|
"Tor Olav Kristensen" wrote
> This statement should give the same result:
>
> #declare Exp_imPhi =
> function { cos(m*atan2(y, z)) + sin(m*atan2(y, z)) }
>
> Since:
> cos(AnyAngle) = cos(-AnyAngle)
> sin(-m*AnyAngle) = -sin(m*AnyAngle)
> cos(0*AnyAngle) + sin(0*AnyAngle) = 1
Yes, of course, that's the shortest way.
> Even if the macro doesn't seem to be needed,
> you could check if this version of it gives
> any speed increase:
>
> #macro Exp_imPhiFunction(M)
>
> #local imPhiFn =
> function(Angle) { cos(Angle) + sin(Angle) }
>
> function { imPhiFn(M*atan2(y, z)) }
>
> #end // macro Exp_imPhiFunction
>
> But I doubt that the speed difference will be
> noticable.
I think that in this case there will be a slight profit,
because the atan2() is a serie expansion and that
takes considerable time.
> (And in some cases, I think such an expression
> will render slower. It remains for me to find
> out in which cases it evaluates slower.)
Only testing can give you the time needed to build
the subroutine that calls this 'sub-function'. That's
the loss you get if you nest deeper. So for time
consuming operations you can get a profit.
> One further little note:
> If you want to use the sign of a variable in
> an expression, then this:
> select(variable, -1, 1, 1)
> or:
> select(variable, -1, 0, 1)
> - would be a good way to write it.
>
> As you have noticed; variable/abs(variable)
> requires extra care to make sure that a
> division by 0 does not happen when the
> variable is equal to zero. And I believe that
> such an expression also forces povray to do a
> float division, instead of just a quick check
> of some of the bits in the variable's value.
You can notice that I don't use these functions very
often, because I hadn't thought about this while I
used this function several times.
> I hope that you post the radius formula when
> you find it Jaap.
I think that the old fashioned formula for the Bohr
Radius might be a good choice to start with.
I have to test it jet.
When I made a preliminarily test with high values
of 'n', I discovered that I will have to invent a variable
intensity either, because the media got to dim.
If I have tested these things, I will let you know what
the solution for this will be (if I can find it).
Thanks again for all this tremendous help.
Jaap Frank
Post a reply to this message
|
|