From casida@CHIMCN.UMontreal.CA Sun Dec 6 06:01:10 1992 From: casida@CHIMCN.UMontreal.CA (Casida Mark) Message-Id: <9212061601.AA07791@chims1.CHIMCN.UMontreal.CA> Subject: uniform random distribution on sphere To: chemistry@ccl.net Date: Sun, 6 Dec 92 11:01:10 EST Since the following question seems to have stimulated a significant amount of interest on the list, I thought I'd just mention an old trick I happen to know for solving the classic problem of generating uniformly distributed random points on the surface of a sphere. I recall getting this from the (math?) literature many years ago, but have lost the reference. > Hi fellow chemists, > This may fit better in comp.graphics, but someone in this group > may have experienced it already. So here it goes. > I want to generate points on the surface of a sphere as randomly > as possible. These points may be used for drawing van der Waals > surface of an atom. I tried with symmetrically distributed points > (generated by varying phi and theta, etc), but due to symmetry, > the points looked like marching ants at certain angles. > Since many of symmetrically distributed points are likely to be > overlapped when they are placed in 2-D screen, increasing the > density of VDW points would require unnecessarily large number > of sphere points. Random distribution of points would help > minimizing the number of points required and will give a better > appearance. > Any ideas? > -DCL > lim@rani.chem.yale.edu The best solution I know (and one which works well when adopted to N-dimensions!) is to generate (x,y,z) points with a Gaussian random distribution in each coordinate. This gives you a spherically symmetric 3-dimensional distribution which you can then project radially onto the surface of a sphere of radius R: r^2 = x^2 + y^2 + z^2 (x,y,z) -> (R/r)*(x,y,z) Gaussian random number generators are widely available. Mark E. Casida casida@chimcn.umontreal.ca