This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gsl_rand_dir_3d


On Mon, Aug 04, 2003 at 04:00:17PM -0400, Stuart O Anderson wrote:
> Thanks for the suggestion, personally I went the easy route and just
> extended the 2D non-trig algorithm to 3D, although your method is more
> elegant.

Except if you actually want a unit vector in rectangular
coordinates.  Then you would have to do a few more trig functions.

  x = r sin(theta) cos(phi)
  y = r sin(theta) sin(phi)
  z = r cos(theta)

> >   dA = sin(theta) dtheta dphi
> dA = r sin(theta) dtheta r dphi (but then we're talking about unit
> spheres, so it doesn't really matter.)

Oh yeah, that's right.  I guess I quoted the differential element
for solid angles.

-- 
Jeff Spirko   spirko@lehigh.edu   spirko@yahoo.com   WD3V   |=>

The study of non-linear physics is like the study of non-elephant biology.

All theoretical chemistry is really physics;
and all theoretical chemists know it. -- Richard P. Feynman 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]