Given a reference frame $x,y,z$, and a sphere of radius $R$ with center in the origin of the frame, I take a spherical cap with height $h$ having the center on the $x$ axis. I am looking for a formula giving the intersection angle between a line starting from $x_0,y_0,z_0$ of direction cosines $\alpha,\beta,\gamma$ and the cap vs. $y$ and $z$ or in alternative, in spherical coordinates vs. $\theta$ and $\phi$. Can anybody help me? Thanks.
I find that it’s often easier overall to first overgenerate potential solutions by solving a simpler problem, then cull those that don’t meet additional criteria. This looks like one of those cases.
Start by computing the intersections of the line with the entire sphere, if any. You have $\mathbf p_0 = (x_0,y_0,z_0)$ and $\mathbf v=(\alpha,\beta,\gamma)$, so this is simply a matter of solving the quadratic equation $\|\mathbf p_0+t\mathbf v\|^2=R$ for $t$. Discard any solutions for which $x\notin[R-h,R]$. If you also need the intersection with the “bottom” of the cap, solve $x_0+t\alpha=R-h$ for $t$ and check that the distance of the resulting point from the origin is $\le R$.