Surface area of part of a sphere viewed through a window I'm trying to work out the proportion of the surface area of a sphere that would be visible through a circular aperture from a viewer at the centre of that sphere.
If the aperture is centred on the axis of the sphere (i.e. the line normal to the centre of the aperture goes through the centre of the sphere), it's quite a simple problem:

In this situation, the surface area of the visible bit of the sphere is the same as the surface area of a sphere cap and can be looked up or solved by integrating:
$$
a = 2 \pi r^2 \int_0^\theta \sin\theta d\theta \\
= 2 \pi r^2 ( 1 - \cos\theta )
$$
The proportion of the sphere that is visible can then be found as:
$$
ratio = \frac{a}{4 \pi r^2}
$$
hence:
$$
ratio = \frac{1}{2} (1 - \cos \theta ) \\
= \frac{1}{2} \left( 1 - \frac{h}{\sqrt{h^2 + (w/2)^2}} \right)
$$
Note that the solution here is only in terms of the known values ($h$ & $w$).
However, the problem gets a lot more complicated if we offset the aperture slightly:

We can solve it geometrically quite easily if we assume it's another simple spherical cap, with the line shown in green as the circular plane that creates the cap.  However, this assumption isn't really valid as in this case the it isn't a plane (I think): it's a surface that is curved in at least one direction.
I've been trying to formulate an integral that will allow me to solve this problem and get the ratio in terms of $h$, $\delta$ and $w$ but I ended up with something that I couldn't figure out how to solve algebraically and which gave me nonsense-looking results when I tried to solve it numerically, so I suspect it's completely wrong.
My attempt at formulating it created a new variable $\delta_p$ that represented the offset $\delta$ as you traverse around the axis shown with the purple line marked $h$.  Viewing the aperture from above (with the yellow dot as the centre of the sphere and the blue circle representing the aperture):

gives a definition for $\delta_p$ and I can then use the cosine rule to derive $\delta_p$ in terms of $\phi$, $w$ and $\delta$ and then create a double integral over $\phi$ and $\theta$ to try to get the surface area.  That ended up with this monstrosity:
$$
a = 2 \pi \int_0^{2 \pi} \int_0^{2 \pi} \sqrt{h^2 + \left(\delta \cos\phi + \frac{w}{2} - \sqrt{\delta^2 \left( \cos^2\phi - 1 \right) + \frac{w^2}{4}}\right)^2} \mathrm{d}\phi \; \mathrm{d}\theta
$$
which, as I said I failed to solve algebraically and seemed to give me nonsense when solved numerically with a given $h$, $\delta$ and $w$ (although I might have got the numerical solution wrong).
Can anyone help me figure out how to formulate and hence solve this problem?
Edit: to try to add a bit of clarity, I modelled the system in a 3D CAD package, with something like a cone (I'm not sure whether it actually classes as a cone) intersecting with a sphere:

If I then perform a boolean intersection of those two things, I can draw a circular plane that intersects with two quadrant points of the spherical surface.  If it were a simple spherical cap, it would also intersect with the other two quadrant points, but as you can see if you look carefully at this image, it doesn't:

That implies that it isn't a simple spherical cap but a more complex shape, hence my feeling that it needs an integral to solve it properly.
The effect becomes more pronounced as $\delta$ increases:

 A: We wish to find the solid angle $\Omega$ subtended by a circular disk of radius $R$ at an arbitrary point in space.  The area of a sphere of radius $\rho$ "visible" through this disk will then be $A = \Omega \rho^2$.
Without loss of generality we can take the $z$-direction to point along the normal to the disk, and we can take the vector from the origin to the center of the disk to lie in the $xz$-plane, at $(x_0, 0, z_0)$.  One expression for the solid angle subtended by an oriented surface $S$ is
$$
\Omega = \iint_S \frac{\vec{r} \cdot \hat{n}}{r^3} \, da.
$$
For the disk, we have $\hat{n} = \hat{z}$ and so $\vec{r} \cdot \hat{n} = z = z_0$ at all points on the disk.  The distance from the origin to an arbitrary point on the disk, meanwhile, is
$$
r = (x^2 + y^2 + z_0^2)^{1/2}.
$$
Changing coordinates to $\{r, \phi, z\}$ such that
$$
 x = x_0 + r \cos \phi \qquad y = r \sin \phi
$$
(these are effectively cylindrical coordinates whose $z$-axis passes through the center of the disk) we have
$$
r = ( r^2 + 2 r x_0 \cos \phi + x_0^2 + z_0^2)^{1/2}
$$
and so putting it all together, we need to perform the integral
$$
\Omega = \int_0^{2 \pi} \int_0^R \frac{ z_0}{( r^2 + 2 r x_0 \cos \phi + x_0^2 + z_0^2)^{3/2}} r \, dr \, d \phi. 
$$
Unfortunately, I do not have a good notion of how to do this integral symbolically.  Mathematica is able to do either of the integrals with respect to $r$ or $\phi$, but cannot then proceed to integrate over the other variable and get a closed-form result.  (At least, I have not been able to cajole it to do so yet.)  Doing the integral with respect to $\phi$ first yields an expression involving elliptic integrals of the second kind, so I suspect that if a closed-form expression exists it will not be very "nice".
The above integral can, however, be easily performed numerically;  the results for $R = 1$ and various values of $z_0$ for $0 \leq x_0 \leq 2$ are shown below.  I've plotted $\Omega/4\pi$ on the vertical axis, which corresponds to the fraction of the sphere's area that would be visible through the "window".  In particular, note that for $z = 0.01$ (the darker blue curve below), we can see a little less than half of the sphere when some point of the window is directly "above" us ($x_0 < 1$), while we can see very little of the sphere when it is not ($x_0 > 1$.)  This is what we would expect, so it's a good sanity check on our result.

A: 
I'm trying to work out the proportion of the surface area of a sphere that would be visible through a circular aperture from a viewer at the centre of that sphere.
That circular aperture always corresponds to a plane intersecting the sphere, with the plane normal corresponding to the vector from the center of the sphere to the center of the aperture.

Note that if $r$ is the radius of the sphere, then $w = 2 \sqrt{ r^2 - h^2 }$, and $(w/2)^2 = r^2 - h^2$.  This means that
$$\text{ratio} = \frac{1}{2}\left(1 - \frac{h}{\sqrt{h^2 + (w/2)^2}}\right) = \frac{r - h}{2 r}$$
All you need to do, is find the distance $h$ from the center of the sphere to the plane.
Alternatively, if you have the diameter $w$ of the aperture, you can use
$$\text{ratio} = \frac{1}{2} - \frac{\sqrt{4 r^2 - w^2}}{4 r}$$
Or, as you yourself noted, if you know the angular radius of the aperture $\theta$ (corresponding to the apex angle of the right circular cone visible through the aperture), then
$$\text{ratio} = \frac{1 - \cos \theta}{2}$$
In summary, you need to know $r$ and one of $h$, $w$, or $\theta$, and you can easily calculate the ratio.
