|
|
Tom Melly wrote:
> Okay, I'm trying to randomly distribute objects, using trace, on a sphere.
>
> So, I do something like:
>
> RotZ = 180*rand(R1)
> RotY = 360*rand(R1)
> Trans = transform(translate y*10 rotate z*RotZ rotate y*RotY)
> TVec = vtransform(<0,0,0>, Trans)
> Inter = trace(Ob, TVec, -TVec)
>
>
> The trouble is that I end up with a bunching of objects at the poles for
> all the obvious reasons, so the question is, how do I best avoid this? I
> assume it's something like:
> ZRotFac = 1 + pow(abs((ZRot/90)-1),2);
> ZRot = ZRot * ZRotFac
>
> But,
>
I'd say you need for RotZ a random distribution with probability
proportional to sin(RotZ) (i.e. values close to 90 are more likely than
values close to 0 or 180). So the problem is to get such a distribution
from the uniform one that rand(x) gives (or should give). I'm not sure if
asin(rand(x)) would do the trick (you'd have to make it fit into 0-180, I
guess not.
You could try picking two random numbers, x and y, if y < sin(x) then RotZ =
180*x
Post a reply to this message
|
|