[Numpy-discussion] Even Sphere Volume

Ian Mallett geometrian@gmail....
Mon Jul 6 22:27:45 CDT 2009

That didn't fix it.  I messed around some more, but I couldn't get the
spherical coordinates working.  I decided to rework my first method.  By
raising the radius to the one third power, like for the other method,
basically the same thing is accomplished.  It's working now, thanks.  :D

vecs = numpy.random.standard_normal((size,size,3))
magnitudes = numpy.sqrt((vecs*vecs).sum(axis=-1))
vecs = vecs / magnitudes[...,numpy.newaxis]
randlen = numpy.random.random((size,size))
randlen = randlen ** (1.0/3.0)
randpoints = vecs*randlen[...,numpy.newaxis]
rgb = ((randpoints+1.0)/2.0)*255.0

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090706/1ef08219/attachment.html 

More information about the NumPy-Discussion mailing list