Generating a random displacement on the unit sphere

Posted by becko on Stack Overflow See other posts from Stack Overflow or by becko
Published on 2012-09-10T21:36:02Z Indexed on 2012/09/10 21:37 UTC
Read the original article Hit count: 191

Filed under:
|
|

Given a unit vector n, I need to generate, as fast as possible, another random unit vector m. The deviation of m from n should be on the order of a positive parameter sigma, and the distribution of m on the unit sphere should be symmetrical around n.

I have no specific requirements on the representation of unit vectors, so you can use spherical angles, Cartesian coordinates, or whatever turns out to be convenient. Also, there are no precise requirements on the probability distributions used, as long as it decays when m deviates more than sigma from n.

I am working with gsl and C. I have come up with a somewhat convoluted method using Cartesian coordinates. I will post it later if it is useful, but I would like to see people's ideas.

© Stack Overflow or respective owner

Related posts about c

    Related posts about random