npelpt_c |

## Procedurevoid npelpt_c ( ConstSpiceDouble point [3], ConstSpiceEllipse * ellips, SpiceDouble pnear [3], SpiceDouble * dist ) ## AbstractFind the nearest point on an ellipse to a specified point, both in three-dimensional space, and find the distance between the ellipse and the point. ## Required_ReadingELLIPSES ## KeywordsCONIC ELLIPSE GEOMETRY MATH ## Brief_I/OVariable I/O Description -------- --- -------------------------------------------------- point I Point whose distance to an ellipse is to be found. ellips I A CSPICE ellipse. pnear O Nearest point on ellipse to input point. dist O Distance of input point to ellipse. ## Detailed_Inputellips is a CSPICE ellipse that represents an ellipse in three-dimensional space. point is a point in 3-dimensional space. ## Detailed_Outputpnear is the nearest point on ellips to point. dist is the distance between point and pnear. This is the distance between point and the ellipse. ## ParametersNone. ## Exceptions1) Invalid ellipses will be diagnosed by routines called by this routine. 2) Ellipses having one or both semi-axis lengths equal to zero are turned away at the door; the error SPICE(DEGENERATECASE) is signalled. 3) 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. ## FilesNone. ## ParticularsGiven 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 CSPICE routine nearpt_c. 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 nearpt_c, the input point is on, inside, or outside the ellipsoid, so it makes sense to speak of its altitude. ## Examples1) For planetary rings that can be modelled as flat disks with elliptical outer boundaries, the distance of a point in space from a ring's outer boundary can be computed using this routine. Suppose center, smajor, and sminor are the center, semi-major axis, and semi-minor axis of the ring's boundary. Suppose also that scpos is the position of a spacecraft. scpos, center, smajor, and sminor must all be expressed in the same coordinate system. We can find the distance from the spacecraft to the ring using the code fragment #include "SpiceUsr.h" . . . /. Make a CSPICE ellipse representing the ring, then use ## RestrictionsNone. ## Literature_ReferencesNone. ## Author_and_InstitutionN.J. Bachman (JPL) ## Version-CSPICE Version 1.0.0, 02-SEP-1999 (NJB) ## Index_Entriesnearest point on ellipse to point |

Wed Apr 5 17:54:39 2017