Similarly to the definition of the distance of closest approach (DCA) for two arbitrary ellipses1 we define the DCA for an arbitrary ellipse and a line segment.

This distance is used in some models to calculate the repulsive force between a pedestrian and a wall2.

mindel

The quantity we are looking for is \(l\) with:

\(P\) is the nearest point on \([AB]\) to the ellipse. See also notes of P. Bourke3.

Knowing \(\alpha\) we can easily calculate \(r\). To solve the above mentioned equation
one has to find the quantity \(d\), which would be the necessary amount to translate \([AB]\) along the direction of \(OP\) such that it becomes tangential to the ellipse.

We have

The parametric definition of the line segment \([AB]\) is:

\(x_{R^\prime}\) is on the ellipse, which implies

or

with

In case the point \(R\) is known the solution of Eq. (2) is

However, in general \(R\) is not known. Developing Eq. (1) with respect to \(u\) yields

with

with the substitutions \(x_{BA}=x_B-x_A\) and \(y_{BA} = y_B - y_A\).

Since the line \((AB)\) is tangential to the ellipse we get

which leads to

Supposing that \(P, A\) and \(B\) are not collinear, we solve (3) and get

and

For \(d\) we calculate \(u\) as

If the inequality \(0 \le u \le 1 \) does not hold or \(P, A\) and \(B\) are collinear, then this would mean the point \(R\) is an end point of \([AB]\), i.e. \(A\) or \(B\). In that case we solve (2) twice with \(R:=A\) and \(R:=B\) and get \(d= \min(|d_A|, |d_B|)\).

References: