I am trying to determine line of sight along the surface of the earth between 2 points. Earth's curvature is a consideration. 2 points on the earth $A$ and $B$ are distance $s$ apart. At intervals along $\overset{\huge\frown}{AB}$, I need to determine the height of the bulge of the earth. This diagram helps visualize the problem:
The article How much does the earth curve gives a great explanation of how to find the bulge of a circle, given the radius, and the length of a chord. This was a promising lead, but ultimately not quite what I need. This gives $y$ as a function of $x$, stricly in the cartesian plane.
In my scenario, I need a function for, we'll call it, $y_r$, the component of the radius between the chord and the arc defined by $\overset{\huge\frown}{AB}$. This refers to the length of the line between the 2 blue dots in the following drawing:
This needs to be a function of $d$, the length of the arc as it expands from $A$ to $B$, whose domain would be the scalar value between 0 and the length $\overset{\huge\frown}{AB}$. I would expect the range would begin at $d = 0$, swell to the value of $y$ at $d = \overset{\huge\frown}{AB} / 2$, and then shrink back to 0 at $d = \overset{\huge\frown}{AB}$.
How can I write such a function $f$ for $y_r = f(d)$?


This is really very simple. Define
$\theta_{AB} = \dfrac{\overset{\frown}{AB}}{R}$
And define
$ \theta = \dfrac{d}{R} $
Then
$ y_r = R - H \sec( \dfrac{\theta_{AB}}{2} - \theta ) $
Where $ H = R \cos( \dfrac{\theta_{AB}}{2} ) $
Put together
$ y_r = R \left( 1 - \dfrac{ \cos \left( \dfrac{\theta_{AB}}{2} \right) }{ \cos \left( \dfrac{\theta_{AB}}{2} - \theta \right) } \right) $