[Numpy-discussion] Even Sphere Volume

Gökhan SEVER gokhansever@gmail....
Sun Jul 5 19:08:37 CDT 2009


2009/7/5 Stéfan van der Walt <stefan@sun.ac.za>

> 2009/7/5 Ian Mallett <geometrian@gmail.com>:
> > @Stéfan: I thought of the first method.  Let's hear the second approach.
>
> Please see the attached example.
>
> I start off by drawing random azimuth and elevation angles, as well as a
> radii:
>
> N = 1000
> max_radius = 5
>
> az = np.random.uniform(low=0, high=np.pi * 2, size=N)
> el = np.random.uniform(low=0, high=np.pi, size=N)
> r = np.random.uniform(size=N)
>
> You can imagine your volume consisting of a large number of concentric
> spherical surfaces (almost like those Russian nested dolls).  We'd
> like to have all of those surfaces equally densely packed, but their
> surfaces increase in area by the third power with radius.  To counter
> this effect we do
>
> r = r ** (1/3.)
>
> Now, imagine the elevation contours (like latitude on the earth) for
> one of those spherical surfaces.  If we choose them equally spaced,
> we'll have a much higher concentration of points near the north and
> south poles.  Instead, we choose them according to
>
> el = np.arccos(1 - 2*el)
>
> so that we have more contours close to the equator (where the contours
> are longer and  need more points).
>
> >From a statistical point of view, the derivation is done using
> transformation of random variables:
>
> http://en.wikipedia.org/wiki/Probability_integral_transform
> http://en.wikipedia.org/wiki/Inverse_transform_sampling
>
> Regards
> Stéfan
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
Stéfan,

Do you have any idea, why spheres have rough edges on Mayavi?

Secondly, how to add an efficient random movement visualization into your
scene? Without considering collision, gravity, etc the details just letting
all particles freely move into this given spherical border.

-- 
Gökhan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090705/ea43febb/attachment.html 


More information about the NumPy-Discussion mailing list