The equation of the ellipse is
$\dfrac{x^2}{a^2} + \dfrac{y^2}{b^2 }= 1 $
where the semi-major axis $a$ is known, and the semi-minor axis $b$ is unknown. This ellipse is to be tangent to the line
$y = - \tan(\theta) (x - a) + h $
Let the tangency point be $(x_1, y_1)$, then
$y_1 = - \tan(\theta) (x_1 - a) + h \hspace{13pt}(1)$
$ \dfrac{x_1^2}{a^2} + \dfrac{y_1^2}{b^2} = 1 \hspace{13pt} (2)$
and finally, comparing the slopes,
$ \tan(\theta) = -\dfrac{ b^2}{a^2} \cdot \dfrac{x_1}{y_1} \hspace{13pt}(3)$
These are the three equations relating the three unknowns $x_1, y_1, b$.
It can be shown, after eliminating $x_1, y_1$ that $b$ satisfies
$ b^4 + b^2 (a^2 \tan^2(\theta) - h^2 - 2 h a \tan(\theta) ) - (a^2 h^2 \tan^2(\theta) + 2 a^3 h \tan^3(\theta) ) = 0 $
which is quadratic in $b^2$.
The discriminant is
$ \Delta = ( a^2 \tan^2(\theta) - h^2 - 2 h a \tan(\theta) )^2 + 4 (a^2 h^2 \tan^2(\theta) + 2 a^3 h \tan^3(\theta) ) $
This equals,
$ \Delta = a^4 \tan^4(\theta) + h^4 + 4 h^2 a^2 \tan^2(\theta) - 2 a^2 h^2 \tan^2(\theta) - 4 a^3 h \tan^3(\theta) + 4 h^3 a \tan(\theta) + 4 a^2 h^2 \tan^2(\theta) + 8 a^3 h \tan^3(\theta) $
It simplifies to,
$ \Delta = a^4 \tan^4(\theta) + h^4 + 6 a^2 h^2 \tan^2(\theta) + 4 h^3 a \tan(\theta) + 4 a^3 h \tan^3(\theta) $
And this just
$ \Delta = ( a \tan(\theta) + h )^4$
Therefore, the value of $b^2 $ is
$ b^2 = \dfrac{1}{2} \bigg(-(a^2 \tan^2(\theta) - h^2 - 2 h a \tan(\theta) ) +\sqrt{\Delta}\bigg) $
And this equals,
$ b^2 = \dfrac{1}{2} \bigg( h^2 + 2 a h \tan(\theta) - a^2 \tan^2(\theta) + (a \tan(\theta) + h)^2 \bigg) $
Simplifying further,
$b^2 = \dfrac{1}{2} \bigg( 2 h^2 + 4 a h \tan(\theta) \bigg) $
And finally,
$\large \boxed{ b^2 = h^2 + 2 a h \tan(\theta) }$
Example:
Suppose $a = 10 , h = 4, \theta = 18^\circ $, substituting these into the above equation, and solving for $b^2 $ using the quadratic equation, gives us
$ b = 6.480245 $
Here's a plot of this ellipse and the line segment.
![Ellipse](https://cdn.statically.io/img/i.sstatic.net/5fEeQ.png)