I am not sure if I have the title right, but here is my problem:(adsbygoogle = window.adsbygoogle || []).push({});

I have a ray which 'should be' shot vertically from a pointp, but depending on the situation it can: 1) either be shot in any direction in the hemisphere abovep2) shot with an angle of no more than σ off the vertical 3) shot with an angle of no more than σ off the vertical by with a Gaussian distribution

(See http://imgur.com/BMqWjoQ)

http://imgur.com/BMqWjoQ

First:

I wish to generate a point uniformly distributed on a hemisphere. I did some derivations and I came up with:

θ = acos(R_{1})

∅= 2∏R_{2}

x = sinθcos∅=cos(2∏R_{2})sqrt(1-R_{1}^{2})

y = sinθsin∅=sin(2∏R_{2})sqrt(1-R_{1}^{2})

z=cosθ=R_{1}

I confirmed this wit a text book, So Im pretty sure its right---

Second:

I want to generate a point uniformly but only within a small solid angle subtended by angle σ

Similar derivation as before but the values for theta and phi are

θ=acos(1-(1-cos(σ)*R_{1}))

∅= 2∏R_{2}

Im pretty sure this is also right

Third:

(now this is where I need help)

Instead of using a uniform distribution I would like to use a Gaussian distribution. I know Box Muller is one way of generating random number with a normal distribution (given a set of canonical numbers) but how do I use that now to generate ray directions that are normally distributed?

Thanks for your help

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Sampling with multidimensional transformations

**Physics Forums | Science Articles, Homework Help, Discussion**