POV-Ray : Newsgroups : povray.binaries.scene-files : Quantum Waves in Media : Re: Quantum Waves in Media - 1 attachment Server Time
19 May 2024 02:11:29 EDT (-0400)
  Re: Quantum Waves in Media - 1 attachment  
From: Tor Olav Kristensen
Date: 15 Jan 2003 18:58:47
Message: <Xns9305A7CFC16Dtorolavk@204.213.191.226>
"Jaap Frank" <jjf### [at] xs4allnl> wrote in news:3e24b87d@news.povray.org:
> 
> "Tor Olav Kristensen" <tor### [at] hotmailcom> wrote in message
> news:Xns### [at] 204213191226...
...
>> But apart from that; Yes I would like
>> to have a look at the original functions.
>> Just because I'm curious !
> 
> You find it in H_Wave_Text.pov, together with
> an explanation about the imaginary part and
> my translation principle of the derivative.

Thanks. I'll have a look at it to see if I
can "understand" it.


> You will see that one factor in exp_imPhi has to be
> put back:  'm / abs(m)'
> If you omit that, then the function is equal for positive
> and negative values of 'm'.
> 'm / abs(m)' gives just the difference you need.
> If you render 2p1 and 2p-1 without that factor,
> you get identical pictures and with the factor they
> have different directions in space.

Ok, I see. I must have misinterpreted your
function expression. This means that that
macro isn't really needed then.

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

(Note that you should be careful with the use
of lowercase single character variable names
in your code. Because they are reserved for
future use in POV-Ray. I.e. they may get
special meanings in later POV-Ray versions.)

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.

(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.)


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.


> Now I have to find a formula for the container
> radius, for, thanks to you, I can now choose
> any combination I like!
> 
> Regards,
> 
> Jaap Frank

I hope that you post the radius formula when
you find it Jaap.


Tor Olav


Post a reply to this message

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