POV-Ray : Newsgroups : povray.general : trouble using rand inside of sine function : trouble using rand inside of sine function Server Time
30 Jul 2024 14:30:32 EDT (-0400)
  trouble using rand inside of sine function  
From: Mike
Date: 4 Dec 2008 13:55:01
Message: <web.4938266b4d71081ac9b9f9f00@news.povray.org>
Hi.
I am trying to create a random phase within a sine function, but keep getting an
error that a 'function identifier' is expected and I do not understand why.

I am doing:
#declare R1=seed(1153);
#declare xspectrum =function{ sin  ( x+  rand(R1)   )    }

but it does not work. I do realize that for this case I could use:
#declare randomnum=rand(R1);
first and use that in my sine function, because this works, but I really need to
have the random number computed within the sine function. This is just a
simplified case, what I will really do is:

#declare xspectrum = function { sum(Kx,1,10,   .025/2*( sin(Kx*6.2832*x +
2*3.14159*rand(R1)   ) ) )  }

and here I definitely need the random number evaluated in the function.

Any ideas,
Mike


Post a reply to this message

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