ⓘ This web page is about the old AlgoSim 2 software. Perhaps you are looking for the new Algosim 3 application?
AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Gallery item: random points on sphere

random points on sphere

There are several ways of picking a random point on a (unit) sphere. By "random" we mean that if we select a large number of "random" points and plot them on the sphere, then there will be a uniform number of points per unit surface area.

It is not possible to use the most common parametrisation, i.e. ❨r⋅sin(θ)⋅cos(φ), r⋅sin(θ)⋅sin(φ), r⋅cos(θ)❩, and randomly choose the coordinates θ ∈ [0, π] and φ ∈ [0, 2⋅π[ because this will yield too many points near the poles (as can be understood by computing the area element). It is also not possible to select points randomly in the cube [-1, 1]^3 and then normalize all points (as vectors) to the unit sphere, for this will yield too many points near the cube's corners. But if one selects points randomly in this cube, and discards all points outside the unit sphere (i.e., points further from the origin than one unit of length), and then normalizes the remaining points, then we will get a uniform distribution of points on the sphere.

A slightly more elegant way to solve the problem is to utilize the parametrisation ❨cos(φ)⋅sqrt(1−u^2), sin(φ)⋅sqrt(1−u^2), u❩ where φ ∈ [0, 2⋅π] and u ∈ [-1, 1] are chosen randomly.

Large version

Even larger version