See diagram from previous post.
Triangles BEO and CGO are congruent.
Let BE = x , the angle at E is a right angle so x = (R + h)cos(theta).
EA = 5 - x, and if AD is to be a tangent to the semi circle, then the line from A to the point of tangency will have length 5 - x also.
Similarly on the RHS, the line from D to the point of tangency will have length 4 - x.
So, if AD is to be a tangent to the semi circle, it will have a length 9 - 2x = 9 - 2(R + h)cos(theta).
Now move into co-ordinate geometry mode.
Take BC to be the horizontal axis, with O as the origin.
Point A will have an x co-ordinate -(R + h) + 5cos(theta) and a y co-ordinate 5sin(theta).
Point D will have an x co-ordinate (R + h) - 4cos(theta) and a y co-ordinate 4sin(theta).
So,
\(\displaystyle AD^{2}= \{9-2(R+h)\cos\theta\}^{2}=\{(R+h)-4\cos\theta-\{-(R+h)+5\cos\theta\}\}^{2}+(4\sin\theta-5\sin\theta)^{2},\\ 81-36(R+h)\cos\theta+4(R+h)^{2}\cos^{2}\theta=4(R+h)^{2}-36(R+h)\cos\theta+81\cos^{2}\theta+\sin^{2}\theta,\\ 81+4(R+h)^{2}\cos^{2}\theta-4(R+h)^{2}-81\cos^{2}\theta-\sin^{2}\theta = 0, \\ 4(R+h)^{2}(\cos^{2}\theta-1)+81\sin^{2}\theta -\sin^{2}\theta=0,\\ 4(R+h)^{2}(-\sin^{2}\theta)+80\sin^{2}\theta=0,\\ (R+h)^{2}=20,\\ R+h =\sqrt{20}=2\sqrt{5} . \)
\(\displaystyle \text{BC}=2(R+h)=4\sqrt{5}.\)
.