[Math] Can you not rotate spherical coordinates

linear algebraspherical coordinates

I have some points that sit on the hemisphere in spherical coordinates: $\theta \in [0,\pi/2]$, $\phi \in [0, 2\pi]$ (ie so a hemisphere around the vector (1,0,0) (spherical coordinates).

I should note the convention I'm using: $\theta$ is "elevation" measured from +y-axis.

I want to rotate each vector in spherical coordinates in that hemisphere without having to convert to Cartesian coordinates first.

The subproblem is I am trying create a couple thousand random vectors in a hemisphere centered around some normal.

The "cheap" way to do this is to generate uniformly distributed points on the unit sphere, and discard those that don't have a dot product with the normal > 0.

But I want to avoid creating vectors that I'll have to discard anyway, so I'd rather generate them correctly the first time around. So generate spherical vectors with $\theta \in [0,\pi/2]$, $\phi \in [0, 2\pi]$, then rotate by $\theta, \phi$ of the normal vector these random points are supposed to surround.

To get evenly distributed points on a hemisphere around the spherical vector (1,0,0):

$$
\text{Spherical Vector} (r=1, \theta=\cos^{-1}( \sqrt{ \zeta_1 } ), \phi=2 \pi \zeta_2 )
$$

Where $\zeta_1, \zeta_2$ are a random variables with values between 0 and 1.

What this does is distribute the elevation component with GREATER emphasis on the equator (LOTS of samples with $\theta=\pi/2$, less values at poles)

Best Answer

Why not just reverse the ones with dot product <0 instead of discarding them? You will still have a uniform distribution in the hemisphere.