|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Is it possible to add a random +/- function to a loop ?
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 ?
--
Ken Tyler
tyl### [at] pacbellnet
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
>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
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
I created a macro to do exactly that; you can get it from Twyst's
Macroscope; it's called rand_ext.
Margus
Ken wrote in message <368CC4A7.155EDF35@pacbell.net>...
>Is it possible to add a random +/- function to a loop ?
>
>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 ?
>
>--
>Ken Tyler
>
>tyl### [at] pacbellnet
>
>
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Margus Ramst wrote:
> I created a macro to do exactly that; you can get it from Twyst's
> Macroscope; it's called rand_ext.
>
> Margus
Thank you. I'll check it out.
--
Ken Tyler
tyl### [at] pacbellnet
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |