I have a geometry problem for an architectural application that I hope someone can help me with.

I have a rectangle $(a \times b)$ which contains a reverse curve from bottom left to top right formed of two circular arcs of the same radius $R$ and angle $\theta$ which are joined tangentially by a line of length $S$. For the various situations I wish to use this in, I will know $a$, $b$, and $S$ and I wish to solve for $R$ for which I think there is only one solution.
When $S = 0$, with the line disappearing and the two arcs joining tangentially in the centre of the rectangle, I am able to derive the simple formula
$$R = \frac{0.25 a^2 + 0.25 b^2}{b}$$
but when $S > 0$ I can derive the following formulas of the relationship between the variables but I am struggling to rearrange them in terms of $R$ or $\theta$
$$R=\frac{b-S\sin(\theta )}{2-2\cos(\theta)} = \frac{a-S\cos(\theta)}{2\sin(\theta)}$$
Thank you.
I'll coordinatize the $\square OACB$ with $$O = (0,0) \qquad A = (a,0) \qquad B = (0,b) \qquad C = (a,b)$$ The centers of the arcs will be at $$A^\prime = C - (0,r) \qquad B^\prime = O + (0,r)$$ Let $C^\prime$ be the image of $C$ rotated about $A^\prime$ by angle $2\theta$, and $O^\prime$ the image of $O$ rotated about $B^\prime$: $$C^\prime = \left(\;a - r \sin 2\theta, b - r (1-\cos 2\theta)\;\right)$$ $$O^\prime = \left(\;r \sin 2\theta, r (1 - \cos 2\theta)\;\right)$$
Then the S-curve conditions are that $|O^\prime C^\prime|=s$, and $\overline{O^\prime C^\prime}\perp \overline{C^\prime A^\prime}$. That is, $$\begin{align} (O^\prime-C^\prime)\cdot(O^\prime-C^\prime) &= s^2 \tag{1a} \\ (O^\prime-C^\prime)\cdot(C^\prime-A^\prime) &= 0 \tag{1b} \end{align}$$ These imply $$\begin{align} 4 r \left(\; a \sin 2\theta - (b - 2 r) \cos 2\theta \;\right) &= a^2 + b^2 - 4 b r + 8 r^2 - s^2 \tag{2a} \\ a \sin 2\theta - (b - 2 r) \cos 2\theta\phantom{\left.\;\,\right)} &= 2 r \tag{2b}\\ \end{align}$$
Eliminating $\theta$ is surprisingly easy, as is solving for $r$.
Back-substituting to get $\theta$ is a little trickier, but we ultimately get $$\cos 2\theta = \frac{(a - b + s) (a + b + s)}{ (a+s)^2 + b^2} \quad\text{or}\quad \frac{(a - b - s) (a + b - s)}{ (a-s)^2+b^2}$$ The latter of these turns out to be extraneous. The former yields this more-convenient form:
The simplicity of $(\star\star)$ suggests that there should be a way to see this solution; as it turns out, there's also a straightforward construction:
We introduce $S$ and $S^\prime$, at distance $s$ from $O$ and $C$, respectively, on extensions of $\overline{AO}$ and $\overline{BC}$. Note that $\tan \angle ASC = b/(a+s) = \tan\theta$, so that $\angle ASC = \theta$.
Let $K$ be the center of $\square OACB$ (constructed, say, as the intersection of the rectangle's two diagonals). If $\bigcirc K$ has diameter $s$, then $\overline{SC}$ and $\overline{S^\prime O}$ meet $\bigcirc K$ at $C^\prime$ and $O^\prime$, respectively.
Finally, $A^\prime$ is where the perpendicular to $\overline{C^\prime O^\prime}$ at $C^\prime$ meets $\overleftrightarrow{AC}$. Similarly for $B^\prime$.
(Incidentally, the extraneous solution corresponds to taking $\overline{OS}$ and $\overline{CS^\prime}$ "pointing the other way". That is, we can take $s$ to be negative in the above analysis. We see that the sign change has no effect on $(\star)$, so that the radius $r$ ---and thus also centers $A^\prime$ and $B^\prime$--- remains unchanged. Therefore, the extraneous $C^\prime$ and $O^\prime$ are the "other" points where $\bigcirc A^\prime$ and $\bigcirc B^\prime$ meet $\bigcirc K$.)