CSPICE_NPELPT calculates the location on an ellipse closest
to a specified point, both in threedimensional space,
and the distance between the ellipse and the point.
For important details concerning this module's function, please refer to
the CSPICE routine npelpt_c.
Given:
point a double precision 3vector defining a location in space.
ellips a SPICE ellipse structure that represents an ellipse
in threedimensional space. The structure has the fields:
center: [3array double]
semiMajor: [3array double]
semiMinor: [3array double]
the call:
cspice_npelpt, point, ellips, pnear, dist
returns:
pnear the double precision 3vector location on the ellipse nearest
to 'point'.
dist scalar double precision distance between the calculated point
'pnear' and 'point'.
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.
;;
;; 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, ellipse
;;
;; Calculate the location on the ellipse closest to
;; the defined point.
;;
cspice_npelpt, point, ellipse, pnear, dist
print, pnear
print, dist
IDL outputs for pnear: 2.0000000 2.0000000 3.0000000
IDL outputs for dist : 2.8284271
Given an ellipse and a point in 3dimensional 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 3space and not 2space, 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.
ICY.REQ
ELLIPSES.REQ
Icy Version 1.0.1, 13JUN2011, EDW (JPL)
Edits to comply with NAIF standard for Icy headers. Particulars section
now parallels Mice version.
Icy Version 1.0.0, 16JUN2003, EDW (JPL)
nearest point on ellipse to point
