[Papervision3D] random point in a sphere
romuald at thoughtomatic.co.uk
Fri May 9 08:24:46 PDT 2008
Sorry for the basic questions but when I google it I only get distributing
point on a sphere, and it is not exactly what I want.
I'm testing line random drawing with the addNewLine property of the class
I'm trying to get a random point IN a sphere, here my code in a circle:
Radius = 200;
var theta:Number = Math.random() * (Math.PI * 2);
x = Math.cos(theta) * (Math.sqrt(Math.random()) * Radius);
y = Math.sin(theta) * (Math.sqrt(Math.random()) * Radius);
If I want to apply it in a sphere, how do I calculate the z value?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Papervision3D