npelpt_c |

Table of contents## Procedurenpelpt_c ( Nearest point on ellipse to point ) void 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 SPICE ellipse. pnear O Nearest point on ellipse to input point. dist O Distance of input point to ellipse. ## Detailed_Inputpoint is a point in 3-dimensional space. ellips is a SPICE ellipse that represents an ellipse in three-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) If the input ellipse `ellips' has one or both semi-axis lengths equal to zero, the error SPICE(DEGENERATECASE) is signaled. 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 nearpt_c, 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. ## 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 modeled 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 SPICE ellipse representing the ring, then use ## RestrictionsNone. ## Literature_ReferencesNone. ## Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) ## Version-CSPICE Version 1.0.1, 24-AUG-2021 (JDR) Edited the header to comply with NAIF standard. -CSPICE Version 1.0.0, 02-SEP-1999 (NJB) ## Index_Entriesnearest point on ellipse to point |

Fri Dec 31 18:41:10 2021