Boost logo

Boost :

From: Henrik Sundberg (storangen_at_[hidden])
Date: 2007-06-05 15:54:26


I doubt that the trig-version gives a good distribution:

inlineVectortrig(uniform_01<generator_type>&random) {
   constfloatphi=2*M_PI*random();
   constfloatcos_theta=2*random()-1;
   constfloatsin_theta=sqrt(1-cos_theta*cos_theta);
   returnVector(cos_theta,sin_theta*cos(phi),sin_theta *sin(phi));
}

The result ought to be more dense at the poles.

/$

2007/6/5, more effective thinking in the exceptional C++ programming
language <effective.thinking_at_[hidden]>:
> Dear,
>
> I'm a newcomer on the boost list. I subscribed to share the results of my
> experiments on picking random points on sphere. This procedure is often a
> bottleneck for very fast Monte-Carlo simulations of physical process where
> you must pick vectors in random directions. I compiled a document that
> explain the experiments and the results. The conclusion contains some
> propositions to modify boost::random_on_sphere and I would like to know if a
> new implementation following the presented ideas would be welcome.
>
> Colas Schretter
>
> _______________________________________________
> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
>
>


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk