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:







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.