POV-Ray : Newsgroups : povray.binaries.images : Help needed for random numbers : Re: Help needed for random numbers Server Time
14 Aug 2024 07:17:44 EDT (-0400)
  Re: Help needed for random numbers  
From: Matt Beighton
Date: 14 Nov 2002 14:47:41
Message: <3dd3fddd@news.povray.org>
out of interest what does the value in seed(value) actually do?is it a list
of numbers or a maximum value?

"Slime" <slm### [at] slimelandcom> wrote in message
news:3dd3ed06$1@news.povray.org...
> rand() is random enough for most pusposes.
>
> If you're not getting an equal distribution from it, then you're probably
> using it wrong.
>
> *looks at source code*
>
> translate <rand(trans)+15,rand(trans)+10,-rand(trans)+15>
> rotate  <rand(rot)*360,rand(rot)-21,rand(rot)*360>
>
> Try rotating before translating.
>
> What you're doing now, is translating it into a random position in the box
> from <15,10,14> to <16,11,15>. Then you're rotating it (*around the
origin*)
> to a new position. This causes them to fill the area created by a sphere
of
> radius sqrt(16^2+11^2+15^2) differenced with a sphere of radius
> sqrt(15^2+10^2+14^2), and causes their orientation to be relative to their
> position to the origin.
>
> So first rotate, then translate, like this:
>
> rotate <rand(rot),rand(rot),rand(rot)>*360 // orient randomly
> translate <rand(trans)+15,rand(trans)+10,-rand(trans)+15> // translate
into
> a random position in the box
> rotate  -21*y // because you seem to want to rotate -21*y from your
original
> code
>
>  - Slime
> [ http://www.slimeland.com/ ]
>
>


Post a reply to this message

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