Index of Functions: A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 
Index Page
cspice_npelpt

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_NPELPT finds the nearest point on an ellipse to a specified point,
   both in three-dimensional space, and finds the distance between the
   ellipse and the point.

I/O


   Given:

      point    a point in 3-dimensional space.

               help, point
                  DOUBLE = Array[3]

      ellips   a SPICE ellipse that represents an ellipse in three-dimensional
               space.

               help, ellips
                  STRUCT = CSPICE_ELLIPSE

               The structure has the fields:

                  center:    [3-array double]
                  semiMajor: [3-array double]
                  semiMinor: [3-array double]

   the call:

      cspice_npelpt, point, ellips, pnear, dist

   returns:

      pnear    the nearest point on `ellips' to `point'.

               help, pnear
                  DOUBLE = Array[3]

      dist     the distance between `point' and `pnear'.

               help, dist
                  DOUBLE = Scalar

               This is the distance between `point' and the ellipse.

Parameters


   None.

Examples


   Any numerical results shown for this example may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Create a SPICE ellipse given its center and its semi-major and
      semi-minor axes, and calculate the location on that ellipse
      which is closest to a defined point, and the distance between
      those points.

      Example code begins here.


      PRO npelpt_ex1

         ;;
         ;; Define a center, semimajor and semiminor axis for
         ;; an ellipse.
         ;;
         ;; Also define an arbitrary point in space.
         ;;
         center = [ 1.d, 2.d, -3.d ]
         smajor = [ 3.d, 0.d,  0.d ]
         sminor = [ 0.d, 2.d,  0.d ]
         point  = [-4.d, 2.d,  1.d ]

         ;;
         ;; Create an ellipse structure using the center, smajor,
         ;; and sminor axes.
         ;;
         cspice_cgv2el, center, smajor, sminor, ellips

         print, 'Input SPICE ellipse:'
         print, FORMAT='(A,3F10.6)', '  Semi-minor axis:', $
                                        ellips.semiMinor
         print, FORMAT='(A,3F10.6)', '  Semi-major axis:', $
                                        ellips.semiMajor
         print, FORMAT='(A,3F10.6)', '  Center         :', $
                                        ellips.center

         ;;
         ;; Calculate the location on the ellipse closest to
         ;; the defined point.
         ;;
         cspice_npelpt, point, ellips, pnear, dist
         print, FORMAT='(A,3F10.6)', 'Nearest point    :', pnear
         print, FORMAT='(A,F10.6)',  'Distance         :', dist

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Input SPICE ellipse:
        Semi-minor axis:  0.000000  2.000000  0.000000
        Semi-major axis:  3.000000  0.000000  0.000000
        Center         :  1.000000  2.000000 -3.000000
      Nearest point    : -2.000000  2.000000 -3.000000
      Distance         :  4.472136


Particulars


   Given an ellipse and a point in 3-dimensional space, if the
   orthogonal projection of the point onto the plane of the ellipse
   is on or outside of the ellipse, then there is a unique point on
   the ellipse closest to the original point. This routine finds
   that nearest point on the ellipse. If the projection falls inside
   the ellipse, there may be multiple points on the ellipse that are
   at the minimum distance from the original point. In this case,
   one such closest point will be returned.

   This routine returns a distance, rather than an altitude, in
   contrast to the Icy routine cspice_nearpt. Because our ellipse is
   situated in 3-space and not 2-space, the input point is not
   "inside" or "outside" the ellipse, so the notion of altitude does
   not apply to the problem solved by this routine. In the case of
   cspice_nearpt, the input point is on, inside, or outside the ellipsoid,
   so it makes sense to speak of its altitude.

Exceptions


   1)  If the input ellipse `ellips' has one or both semi-axis lengths
       equal to zero, the error SPICE(DEGENERATECASE) is signaled by
       a routine in the call tree of this routine.

   2)  If the geometric ellipse represented by `ellips' does not
       have a unique point nearest to the input point, any point
       at which the minimum distance is attained may be returned
       in `pnear'.

   3)  If a ratio of non-zero ellipse radii violates the constraints
       imposed by cspice_nearpt, an error is signaled by a routine in the
       call tree of this routine.

   4)  The routine does not check for overflow when scaling or
       translating the input point.

   5)  If any of the input arguments, `point' or `ellips', is
       undefined, an error is signaled by the IDL error handling
       system.

   6)  If any of the input arguments, `point' or `ellips', is not of
       the expected type, or it does not have the expected dimensions
       and size, an error is signaled by the Icy interface.

   7)  If any of the output arguments, `pnear' or `dist', is not a
       named variable, an error is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ELLIPSES.REQ
   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.0.2, 27-AUG-2021 (JDR)

       Edited the header to comply with NAIF standard. Added example's
       problem statement and reformatted example's output.

       Added -Parameters, -Exceptions, -Files, -Restrictions,
       -Literature_References and -Author_and_Institution sections.

       Removed reference to the routine's corresponding CSPICE header from
       -Abstract section.

       Added arguments' type and size information in the -I/O section.

   -Icy Version 1.0.1, 13-JUN-2011 (EDW)

       Edits to comply with NAIF standard for Icy headers. -Particulars
       section now parallels Mice version.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   nearest point on ellipse to point



Fri Dec 31 18:43:06 2021