How to find minimal distance (and coordinates where is it) between two conic sections?

70 Views Asked by At

I have equations of two conic sections in general form. Is it possible to find minimal distance between them (if they are not intercross)?

I need it to calculate is two spacecrafts on two orbits (2d case) can collide or not. If minimal distance bigger than sum of radiuses of bounding circles I don't need to care about collision.

2

There are 2 best solutions below

2
On

Given two conic sections $C_1(p) = 0$ and $C_2(p)=0$ the question can be formulated as a minimization problem

$$ \min_{p_1,p_2}\|p_1-p_2\|^2 + \lambda_1C_1(p_1)+\lambda_2 C_2(p_2) $$

where $\lambda_1,\lambda_2$ are Lagrange multipliers. Assuming $C_1(p) = (p-p_{01})^TM_1(p-p_{01})+c_1$ and $C_2(p) = (p-p_{02})^TM_2(p-p_{02})+c_2$, the stationary points are obtained by solving

$$ \cases{ p_1-p_2 + \lambda_1 M_1(p_1-p_{01})=0\\ -p_1+p_2 + \lambda_2 M_2(p_2-p_{02})=0\\ (p_1-p_{01})^TM_1(p_1-p_{01})+c_1=0\\ (p_2-p_{02})^TM_2(p_2-p_{02})+c_2=0 } $$

Here

$$ \cases{ \lambda_1 = \frac{1}{c_1}(p_1-p_{01})^T(p_1-p_2)\\ \lambda_2 = -\frac{1}{c_2}(p_2-p_{02})^T(p_1-p_2) } $$

so the full system of equations can be reduced to

$$ \cases{ f_1(p_1,p_2) = 0\\ f_2(p_1,p_2) = 0 } $$

which can be handled by an iterative process like Newton-Raphson's.

2
On

Let the two conic sections be $P_1, P_2$. The the parametric equations of either can take one of the following three forms:

$\begin{equation}\begin{split} \text{Ellipse: } P(t) &= C + V_{1} \cos(t) + V_{2} \sin(t) \\ \text{Hyperbola: } P(t) &= C + W_1 \sec(t) + W_2 \tan(t) \\ \text{Parbola: } P(t) &= C + U_1 t + U_2 t^2 \end{split}\end{equation}$

where $C$ is the center of the ellipse or the hyperbola, and the vertex of the parabola, and $V_1, V_2$ are the semi-axes vectors of the ellipse, $W_1, W_2$ are the semi-axes vectors of hyperbola, and $U_1, U_2 $ specify the parabola.

The displacement vector from a point $P_1(t)$ on the first conic to a point $P_2(s)$ on the second conic is

$d(t, s) = P_2(s) - P_1(t) $

At the minimum or maximum, this vector is orthogonal to $P_1$ as well as to $P_2$. Hence, we will have two conditions

$ f_1 (t, s) = d^T(t, s) \dfrac{dP_1(t)}{dt} = 0 $

$ f_2(t, s) = d^T (t, s) \dfrac{dP_2(s)}{ds} = 0 $

These are two non-linear equations of $t, s$ and can be solved numerically using the multi-variate Newton-Raphson method. For an ellipse or a hyperbola, the initial estimates of $t$ and $s$ can be chosen over a grid of points in $[0, 2\pi] $ , and for a parabola, then one can choose $t$ (or $s$) to take the form $t = \tan(\omega) $ where $\omega \in [-\dfrac{\pi}{2}, \dfrac{\pi}{2}]$. All the critical points can be found, then the corresponding distances determined and compared to find the minimum.

This covers conics specified in $2D$ or $3D$.