POV-Ray : Newsgroups : povray.newusers : rounding : Re: rounding Server Time
28 Jul 2024 16:15:11 EDT (-0400)
  Re: rounding  
From: Alain
Date: 25 Jun 2008 09:37:51
Message: <48624a2f$1@news.povray.org>
stevenvh nous illumina en ce 2008-06-25 05:11 -->
> 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
> 
> 
> 
> 
> 
Try this:
RotAngle= 90 * int(4 * rand(Seed))

The int() function return the integer part of a float argument.

-- 
Alain
-------------------------------------------------
Drive A: not responding.. .Formating C: instead


Post a reply to this message

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