[Math] Points on surface of spherical cap

geometryspherical coordinates

I need to be able to choose random points on a spherical cap surface for which the radius and centre of the actual sphere are known.

I'd like to do so by simply restricting the range of possible spherical coordinates (rho,theta, phi as shown on http://mathinsight.org/spherical_coordinates) of points on the cap.

How can I calculate the ranges over which theta and phi can vary for points on the cap, if the cap is specified by the centre of its base and the angle from its normal vector to its base (as depicted on https://en.wikipedia.org/wiki/Spherical_cap)?

Best Answer

I was considering this question 4 years later, and include the answer for others. We want to generate random $(\tilde \phi, \tilde \theta)$ on a spherical cap with angle $\theta$. If $r_1, r_2\in[0,1]$ are uniform random variables, then

$$ \tilde\phi_r = 2 \pi r_1 $$ $$ \tilde\theta_r = \arccos \left[ \left(1-\cos\theta\right)r_2 + \cos\theta\right] $$

enter image description here