POV-Ray : Newsgroups : povray.general : Q: Rand : Re: Rand Server Time
12 Aug 2024 21:26:38 EDT (-0400)
  Re: Rand  
From: Ken
Date: 1 Jan 1999 09:42:41
Message: <368CDE77.9818D7D4@pacbell.net>
Julius Klatte wrote:

> >Is it possible to add a random +/- function to a loop ?
>
> I think so, yes.
>
> >For example I have a loop that is making several copies of
> an object
> >and I wish to apply a random rotation of say -20*y to +20*y
> as the
> >objects are being translated by the loop. Is this possible
> ?
>
> a random number is between 0 and 1, so if you want to use a
> random rotation up to twenty, you can obviously use
> 20*rand(R) to do the trick
> Now if you also wish to use negative numbers up (down?)
> to -20, you have to subtract 20,
>
> 20*rand(R)-20
>
> This 'creates' numbers between -20 and 0.
> If you want numbers between -20 and 20, it would look like
> this:
>
> 40*rand(R)-20
>
> So your rotation would be like :
>
> #declare seed(R)=1999 (happy new year)
> rotate <0,40*rand(R)-20,0>
>
> Hope this helps
>
> Julius
> http://surf.to/jkhome

Perfect ! Thank you !

--
Ken Tyler

tyl### [at] pacbellnet


Post a reply to this message

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