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.
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.