On Wed, 25 Jun 2008 05:11:06 EDT, "stevenvh" <nomail@nomail> wrote:
>I'm surprised (and a bit pissed off) not to find a means to round a number to
>the nearest integer.
>I want to use the rand() function to randomly generate a rotation angle which is
>a multiple of 90 degrees, which I would write in any programming language I know
>as
>
> RotAngle = 90 * round(4 * rand(RandSeed))
>
>How should I do this in POV-Ray?
>TIA
>Steven
>
There is
ceil(A) Ceiling of A. Returns the smallest integer greater than A.
Rounds up to the next higher integer.
And
floor(A) Floor of A. Returns the largest integer less than A. Rounds
down to the next lower integer.
And you can use A - int(A) to see if the fractional part is > 0.5
--
Regards
Stephen
Post a reply to this message
|