Opened 18 years ago

Closed 18 years ago

#347 deleted Bugs (None)

boost::uniform_on_sphere in not uniform on sphere

Reported by: usu_acm Owned by: jmaurer
Milestone: Component: random
Version: None Severity:
Keywords: Cc:

Description

It's clear that your previous (1.29) and current verisons 
(1.32) has no really uniform point distribution on sphere. 

This fact can be proved by observation that 
distributions of all coordinates are independent on each 
other.

For example for 3D-sphere really uniform distribution is 
given by Euler angles (x, arcsin(2t - 1)), where x is 
uniformly distributed random value on [0..2*pi].

Change History (2)

comment:1 by nobody, 18 years ago

Logged In: NO 

it is correct that each coordinate is selected independently, 
but with a normal distribution.

(warning: the following is a little fast and loose)

for a normal distribution, the probability of landing at x will be 
a^(-b*x^2)

if you use the same distrubution for y and z, the probability of 
landing at (x,y,z) will thus be:
a^(-b*x^2) * a^(-b*y^2) * a^(-b*z^2) = 
a^(-b*(x^2+y^2+z^2))

you can recognize the latter as:
a^(-b*l^2), where l = length(x,y,z)

in other words, the probability of landing at (x,y,z) is only a 
function of the *length* of (x,y,z), i.e. it is unrelated to the 
*direction* of (x,y,z)

btw, mathworld has a great page on this subject: 
http://mathworld.wolfram.com/SpherePointPicking.html

/michael toksvig

comment:2 by usu_acm, 18 years ago

Status: assignedclosed
Logged In: YES 
user_id=1124226

To: nobody.
Perfect! thnx a lot!
Note: See TracTickets for help on using tickets.