[Papervision3D] random point in a sphere
Romuald Quantin
romuald at thoughtomatic.co.uk
Fri May 9 08:24:46 PDT 2008
Hi,
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
Line3D
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?
Thanks
Romu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://osflash.org/pipermail/papervision3d_osflash.org/attachments/20080509/4256df7c/attachment.html
More information about the Papervision3D
mailing list