-1
$\begingroup$

If I have a sphere with radius 1, and a section of the sphere defined by having a polar angle bounded by some constant θ and an azimuthal angle bounded by some constant φ, how do I generate random points on this surface such that the points are uniformly distributed?

$\endgroup$

2 Answers 2

0
$\begingroup$

Consider the sphere patch defined as the part of the sphere whose azimuthal angle $\theta$ and polar angle $\phi$ satisfy $0 \leqslant \theta_1 \leqslant \theta \leqslant \theta_2 \leqslant 2\pi$ and $0 \leqslant \phi_1 \leqslant \phi \leqslant \phi_2 \leqslant \pi$ for given $\theta_1$, $\theta_2$, $\phi_1$, $\phi_2$.

Here is how to uniformly sample on this sphere patch. Take two independent random variables $U_1 \sim \mathcal{U}(0,1)$ and $U_2 \sim \mathcal{U}(0,1)$. Define $\Theta = \theta_1(1-U_1) + \theta_2 U_1$, define $A = \cos(\phi_1)(1-U_2) + \cos(\phi_2)U_2$, define $B = \sin\bigl(\arccos(A)\bigr)$. Then, denoting by $r$ the radius of the sphere, the random point $$r\bigl(\cos(\Theta)B, \sin(\Theta)B, A\bigr)$$ has the uniform distribution on the sphere patch.

I don't know why this is true. This is how this sampler is implemented in my R package uniformly, and I copied this method from somewhere when I wrote this package.

$\endgroup$
0
$\begingroup$

Pick $\varphi$ uniformly randomly from the admissible interval, and pick $z=\cos\theta$ uniformly randomly from the admissible interval. This works because the sphere has equal areas in slices of equal height. (This is only the case in $3$ dimensions.)

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .