Main Page   Modules   Class Hierarchy   Compound List   File List   Compound Members   File Members   Related Pages   Examples  

GltRandomSphere< R > Class Template Reference
[GLT Math]

Random points on the unit sphere. More...

#include <random.h>

List of all members.

Public Methods

 GltRandomSphere (R &random, const double radius=1.0)
 Constructor.

 GltRandomSphere (const double radius=1.0)
 Constructor using default RNG.

 GltRandomSphere (const GltRandomSphere< R > &gen)
 Copy constructor.

 ~GltRandomSphere ()
 Destructor.

Vector rand () const
 Random point on sphere surface.

R & base ()
 Base random number generator.

const R & base () const
 Base random number generator.


Detailed Description

template<class R = GltRandomLFSRMix>
class GltRandomSphere< R >

Random points on the unit sphere.

Author:
Nigel Stewart, RMIT (nigels.com@gmail.com)
http://www.math.niu.edu/~rusin/known-math/96/sph.rand

The trig method. This method works only in 3-space, but it is very fast. It depends on the slightly counterintuitive fact that each of the three coordinates of a uniformly distributed point on S^2 is uniformly distributed on [-1,1] (but the three are not independent, obviously). Therefore, it suffices to choose one axis (Z, say) and generate a uniformly distributed value on that axis. This constrains the chosen point to lie on a circle parallel to the X-Y plane, and the obvious trig method may be used to obtain the remaining coordinates.

Definition at line 294 of file random.h.


The documentation for this class was generated from the following file:
Generated on Tue Nov 5 11:11:45 2002 for GLT by doxygen1.2.18