POV-Ray : Newsgroups : povray.advanced-users : Stochastics expertise needed : Re: Stochastics expertise needed Server Time
16 May 2024 22:08:46 EDT (-0400)
  Re: Stochastics expertise needed  
From: lelama
Date: 26 Aug 2016 19:20:00
Message: <web.57c0ce5f8629941b7a63dc9f0@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Folks, I could need a bit of help with a maths problem.
>
> I need an algorithm to generate random points on the surface of a
> sphere, conforming to the following criteria:
>
> - The distribution must be radially symmetric around the Y axis.
> - The sample density should be roughly uniform, except for a pronounced
> peak centered at +Y (but not -Y!)
> - For each random point generated, the algorithm also needs to compute
> the theoretical sample density at that location.
> - The algorithm must be reasonably fast.
>
> Ideally, the algorithm should also have the following properties:
>
> - The density should fall off smoothly from the peak.
> - The algorithm should have a parameter to govern the "tightness" of the
> peak.
> - The sample density away from the peak should approach (but not reach!)
> zero.

You parametrize your sphere by t,y using the formula  x= r cos t, y,z= r sin t
with  y in [-1,1] and r=sqrt(1-y^2).

Then you choose t uniformly, and for y, you choose your distribution as you want
(this is you free parameter). Then the density around a point x,y,z depends only
on y.

If you want an explicit density with associated random points on the sphere in
povray, you may choose a density d(y) pieciwise affine : constant equal to c1>0
on an interval [-1,p] and growing from c1 to c2 when y is  in [p,1].  Then you
choose randomly and uniformly  (y,v) in [-1,1]x[0,c2]. If v>d(y), throw your
point away. If v<=d(y), choose t randomly and put the point P(t,y) on the
sphere.

This shoud satisfy all your needs if I'm not wrong.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.