<s>[INST] What is the solid angle of the intersection loop between a cone and an off-axis sphere? 
An upright (green) cone with opening angle $2a < \pi/10$ has its vertex at point O with cartesian xyz coordinates $(0,0,0)$. The cone axis (dotted line) lies in the plane $y=0$ and is parallel to the z-axis.
A (blue) sphere of radius $r$ is centred at point $P(P_x,0,P_z)$ which may lie inside or outside the cone.  
The line segment connecting points $O,P$ has length $p < r$. Thus point $O$ always lies inside the sphere.
The cone surface and the sphere surface intersect in a non-planar curved line loop which includes points $L1,L2$.
From here I have found equations for the loop (where $c$ is the "cone opening parameter" defined by $c^2=(x^2+y^2)/z^2$) :-
$$
(x-P_x)^2+(y-P_y)^2+\frac{x^2+y^2}{c^2}-\frac{2.P_z}{c}\sqrt{x^2+y^2}+P_z^2=r^2
\qquad [1] $$
$$
x^2\left(1+\frac{1}{c^2}\right)-2P_x.x+y^2\left(1+\frac{1}{c^2} \right) 
-2P_y.y + (P_x^2+P_y^2+P_z^2-r^2)-\frac{2P_z}{c}\sqrt{x^2+y^2}=0.
\qquad [2] $$
In this case the value of $P_y$ is zero which simplifies the above equations a little bit.
QUESTION
What (in steradians) is the solid angle $w$ subtended by the "loop" at point $P$ in terms of $a,r,P_x,P_z$?
 [/INST] Let's move everything so that the center of the sphere is in the origin. Then the sphere is simply
$$x^2+y^2+z^2=r^2$$
and the cone becomes
$$\left(x+P_x\right)^2+y^2=c^2\left(z+P_z\right)^2$$
and since you don't want a double cone, you also want
$$z+P_z>0\quad.$$
The $y=0$ plane intersects the cone in two lines, namely
$$x=\pm c(z+P_z)-P_x$$
and these intersect the sphere at
$$x_{1,2}={\frac{\pm c\left({P_z} + \sqrt{{\left(c^{2} + 1\right)} r^{2} - c^2{P_z}^{2} \pm 2 c {P_x} {P_z} - {P_x}^{2}}\right) - {P_x}}{c^{2} + 1}}\quad.$$
For a given $x$ coordinate in that plane, the points on the loop are both at
$$ z(x) = -\frac{{P_z} c^{2} - \sqrt{{\left({P_x}^{2} - {P_z}^{2}\right)} c^{2} + {\left(c^{2} + 1\right)} r^{2} + {P_x}^{2} + 2 \, {\left({P_x} c^{2} + {P_x}\right)} x}}{c^{2} + 1} $$
so the portion of the sphere in that $x$ plane and between the points on the loop will form a circular arc with a length of
$$l(x) = 2\sqrt{r^2-x^2}\arcsin\frac{z(x)}{\sqrt{r^2-x^2}}\quad.$$
To integrate these arcs into an area, you have to multiply them by the arc length element in the $y=0$ plane. This is defined by
$$\mathrm ds^2=\mathrm dx^2+\mathrm dz^2 = \mathrm dx^2\left(1+\left(\frac{\mathrm dz}{\mathrm dx}\right)^2\right)$$
which means we need the derivative
$$\frac{\mathrm dz}{\mathrm dx}=\frac{{P_x}}{\sqrt{{\left({P_x}^{2} - {P_z}^{2}\right)} c^{2} + {\left(c^{2} + 1\right)} r^{2} + {P_x}^{2} + 2 \, {\left({P_x} c^{2} + {P_x}\right)} x}}$$
to obtain
$$\mathrm ds = {\sqrt{\frac{{P_x}^{2}}{{\left({P_x}^{2} - {P_z}^{2}\right)} c^{2} + {\left(c^{2} + 1\right)} r^{2} + {P_x}^{2} + 2 \, {\left({P_x} c^{2} + {P_x}\right)} x} + 1}}\;\mathrm dx\quad.$$
So the portion of the sphere enclosed by the loop has area
$$\int_{x_1}^{x_2}l(x)\;{\sqrt{\frac{{P_x}^{2}}{{\left({P_x}^{2} - {P_z}^{2}\right)} c^{2} + {\left(c^{2} + 1\right)} r^{2} + {P_x}^{2} + 2 \, {\left({P_x} c^{2} + {P_x}\right)} x} + 1}}\;\mathrm dx\quad.$$
At least numerically this should be reasonably simple to integrate. I haven't tried yet to find a closed form for this. It might be simpler if you have explicit numbers instead of all these variables.
In the end, you can divide that area by $r^2$ to obtain the corresponding solid angle.
</s>