Given the ellipsoid
$ (p - C)^T Q (p - C) = 1 \tag{1}$
where $ C $ is the center of the sphere, $p $ is a point on the ellipsoid surface, and $Q$ is a $3\times3$ symmetric and positive definite matrix. Given also a point $A$ outside the ellipsoid. I would like to determine the equation of the cone of view of the ellipsoid from point $A$. That is, I want to determine the equation of the cone whose vertex is at $A$ and tangent to the ellipsoid. This is the question.
My effort:
We want the gradient vector at point $p$ which is on the ellipsoid surface to be normal to the vector $(p - A) $, i.e.
$ (p - A)^T (p - C) = 0 \tag{2}$
Combined with $(1)$, this gives the points $p$ of tangency on the ellipsoid.
This doesn't seem to work.
So instead, suppose you have a ray from $A$ in a direction $V$, then this ray is given by
$ r = A + t V $
I want this ray to be tangent to the sphere. Substitute this into the equation of the ellipsoid, and derive the condition that will make the intersection one and only one.
$ (A + t V - C)^T Q (A + t V - C) = 1$
Expanding,
$ t^2 (V^T Q V) + 2 t V^T Q (A - C) + (A - C)^T Q (A - C) - 1 = 0 $
For this quadratic equation to have a single real root we must have the discriminant equal to zero. Hence, the condition on $V$ is that
$ ( V^T Q (A - C) )^2 - ( (A - C)^T Q (A - C) - 1) (V^T Q V) = 0 $
and using simple manipulation, this can be written as a quadratic form,
$ V^T Q_c V = 0 $
where
$ Q_c = Q (A - C) (A - C)^T Q - ( (A - C)^T Q (A - C) - 1 ) Q $
But $ V = \dfrac{1}{t} ( r - A ) $
Therefore, the equation of the cone is
$ (r - A)^T Q_c (r - A) = 0 $
This seems correct.
I've implemented an example on this SAGE page, where
$ Q = \begin{bmatrix} 0.25 && 0 && 0 \\ 0 && 0.5 && 0 \\ 0 && 0 && 0.125 \end{bmatrix} $ and $C = \begin{bmatrix} 0 \\ 0 \\ 5 \end{bmatrix}$
And,
$ A = \begin{bmatrix} 3 \\ 4 \\ 0 \end{bmatrix} $
The tangency curve (which is an ellipse) is also shown in red.
Your comments, or alternative solutions are highly appreciated.