[Numpy-discussion] Even Sphere Volume
Ian Mallett
geometrian@gmail....
Sun Jul 5 23:01:26 CDT 2009
Thanks for the example, Stéfan!
I'm trying to work this into a position texture, and the arrays need
interleaving. I tried a couple times. Here's what I have:
az = numpy.random.uniform(0, numpy.pi * 2, size*size)
el = numpy.random.uniform(0, numpy.pi, size*size)
r = numpy.random.uniform(size*size)
# Transform random variable
r = r ** (1/3.) * 1
el = numpy.arccos(1 - 2*el)
x = r * numpy.cos(az) * numpy.sin(el);
y = r * numpy.sin(az) * numpy.sin(el);
z = r * numpy.cos(el)
randvecs = numpy.array([x,y,z]).reshape((size,size,3))
rgb = ((randvecs+1.0)/2.0)*255.0
surface = pygame.surfarray.make_surface(rgb)
I think the arrays are being concatenated. Hence, visually, it doesn't look
right...
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090705/410c6439/attachment.html
More information about the NumPy-Discussion
mailing list