POV-Ray : Newsgroups : povray.general : trouble using rand inside of sine function : Re: trouble using rand inside of sine function Server Time
30 Jul 2024 14:17:49 EDT (-0400)
  Re: trouble using rand inside of sine function  
From: Mike Williams
Date: 4 Dec 2008 20:02:03
Message: <bfBpQZDqyHOJFwch@econym.demon.co.uk>
Wasn't it Mike who wrote:
>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.

If you think about it, there's a pretty good reason why you can't use 
RAND inside a function. Imagine what happens when the code tries to 
solve such a function. The solver attempts to approach a solution by 
finding a series of points on each side that get nearer and nearer to 
the solution. If the function contains RAND, then the function is 
discontinuous everywhere, and that approach doesn't home in on a 
solution.

What you can do is write a macro instead of a function. You'll need to 
write your own loop to perform the sum() operation.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

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