Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!cs.utexas.edu!sdd.hp.com!ucsd!ucbvax!ucsfcgl!socrates.ucsf.edu!kneller From: kneller@socrates.ucsf.edu (Don Kneller) Newsgroups: comp.graphics Subject: Re: random points on surface of sphere Keywords: uniform spherical distribution, random walk Message-ID: <13956@cgl.ucsf.EDU> Date: 9 May 90 00:22:29 GMT References: <1523@ryn.esg.dec.com+ <40768@apple.Apple.COM> <1220@med.Stanford.EDU> <1990May7.132424.23204@laguna.ccsf.caltech.edu> Sender: daemon@cgl.ucsf.edu Reply-To: kneller@socrates.ucsf.edu (Don Kneller) Distribution: na Organization: UCSF Computer Graphics Lab Lines: 48 rick@hanauma.stanford.edu (Richard Ottolini) writes: >+1. Pick a random angle, 0 <= theta < 360. This is in >+the x-y plane. >+ >+2. Pick a random z-value from -1 to 1 ( "<=" or "<" ? >+I'm not sure). I believe this is correct. I had previously posted that you should pick phi such that: phi = arccos(random number between -1 and 1) and since z is R * cos(phi), this becomes: z = random number between -R and R, which is what Richard proposed. To see this is indeed correct, look at the area of a strip of height "dz" at angle phi on a sphere of radius R. area = circumference * width of strip on sphere = 2 pi R sin(phi) * R d(phi) as: z = R cos(phi), dz = - R sin(phi) d(phi) so area = 2 pi R dz (don't worry about the sign, dz and d(phi) are in opposite directions) That is, the area on the sphere of a strip of height "dz" is *independent* of z. If the linear density of points along z is rho, then N = rho * dz will fall between z and z + dz. The density of points on the sphere will be: rho2 = N / area = rho * dz / (2 pi R dz) = rho / (2 pi R) , independent of z. The bottom line?: 1) pick theta randomly between -pi and pi 2) pick z randomly between -R and R ----- Don Kneller UUCP: ...ucbvax!ucsfcgl!kneller INTERNET: kneller@cgl.ucsf.edu BITNET: kneller@ucsfcgl.BITNET