Find a shortest distance from a point to an instersection of two implicit surfaces I have a problem where I need to find a point on a curve that is defined by two implicit surfaces. This point must be at the shortest distance from a reference point that is located somewhere in space.
These two surfaces are a cone-like and a sphere-like. The actual equations are quite complex therefore I will not present them here. However, it is important to mention that unlike in the example I provide below, the intersection curve of these surfaces does not fall in to one plane.
implicit formulation for a sphere: $x^2+y^2+z^2=1$
implicit formulation for a cone: $\frac{x^2+y^2}{0.5}=(z+1)^2$

Explanation how to derive an implicit equation of an intersection of any two 3d surfaces would help a lot as well.
EDIT: line -> curve
EDIT: Adding actual case:
The two surfaces are:
Ellipsoid -> $f_2(x,y,z)=\sqrt{\frac{Ex^2}{D}+Fxy+\frac{Dy^2}{E}+Gz^2}-\sqrt{DE}$
Stretched cone -> $f_1(x,y,z)=\frac{(x+y)-(A+B)}{2}+\sqrt{\left(\frac{(x-y)-(A-B)}{2}\right)^2+Cz^2}$
Where $A, B, C, D, E, F, G$ are the shape parameters. Let's assume that these parameters are:
$A=1$, $B=1$, $C=1$, $D=8$, $E=6$, $F=-1$, $G=1$
However they are not limited to those values, it could pretty much be anything (with some restrictions).
It results in two surfaces looking like this:

Note that the z=0 is a plane of symmetry

$$
\left \{
  \begin{align*}
    x^2+y^2+z^2 &= 1 \\
    2(x^2+y^2) &= (z+1)^{2}
  \end{align*}
\right.$$
The cone here has a nice symmetry, we can eliminate $x$ and $y$ first:
\begin{align*}
  2(1-z^2) &= (z+1)^2 \\
  3z^2+2z-1 &=0 \\
  (z+1)(3z-1) &= 0 \\
  z &= -1 \quad \text{or} \quad \frac{1}{3}
\end{align*}
When $z=-1$, $x^2+y^2=0 \implies (x,y)=(0,0)$
When $z=\dfrac{1}{3}$, $$x^2+y^2=\frac{8}{9}$$
Let the reference point be $(X,Y,Z)$, then you need to minimize
$$d=
\sqrt{
  \left( X-\frac{2\sqrt{2}}{3} \cos t \right)^2+
  \left( Y-\frac{2\sqrt{2}}{3} \sin t \right)^2+
  \left( Z-\frac{1}{3} \right)^2}=
\sqrt{
  X^2+Y^2-
 \frac{4\sqrt{2}}{3} \left( X\cos t+Y\sin t \right)+\frac{8}{9}+
  \left( Z-\frac{1}{3} \right)^2}$$
If $X^2+Y^2\ne 0$, choose $t$ such that
$$X\cos t+Y\sin t=\sqrt{X^2+Y^2}$$

Hence minimal value is attained at
  $$
\left(
  \frac{2\sqrt{2}X}{3\sqrt{X^2+Y^2}},
  \frac{2\sqrt{2}Y}{3\sqrt{X^2+Y^2}},
  \frac{1}{3}
\right)$$

See more on cone-sphere intersection.
