DistantPtToEll:

--------------------------------------------------------------------------
   Finds the distance (and the corresponding point) from a distant
   point to the closest point on an ellipsoid.

   An ellipsoid is defined as (x-xc)'*inv(P)*(x-xc), where
   x  - point on the ellipsoid
   P  - ellipsoid definition
   xc - center of ellipsoid
   d  - distance from x0 to x
   x0 - outside point

   This form accepts the singular value decomposition of P.

   Since version 7.
--------------------------------------------------------------------------
   Form:
   [d,x] = DistantPtToEll(U,S,xc,x0,laguerre);
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   U         (3,3)      Unitary matrix from SVD of P
   S         (3,3)      Singular value matrix from SVD of P
   xc        (3,1)      Ellipsoid center
   x0        (3,1)      Outside point
   laguerre  (1,1)      Flag to use Laguerre for roots instead of eig

   -------
   Outputs
   -------
   d        (1)        Distance
   x        (3,1)      Point on the ellipsoid

--------------------------------------------------------------------------

Children:

FormationFlying: Collision/Laguerre