cspice_npedln

 Abstract I/O Examples Particulars Required Reading Version Index_Entries

#### Abstract

```
CSPICE_NPEDLN calculates the nearest point on a triaxial
ellipsoid to a specified line, and the distance from the
ellipsoid point to the line.

```

#### I/O

```
Given:

a
b
c        [1,1] = size(a); double = class(a)
[1,1] = size(b); double = class(b)
[1,1] = size(c); double = class(c)

are the lengths of the semi-axes of a triaxial ellipsoid.
The ellipsoid is centered at the origin and oriented so that
its axes lie on the x, y and z axes. 'a', 'b', and 'c' are
the lengths of the semi-axes that respectively point in the
x, y, and z directions.

linept
linedr   [3,n] = size(linept); double = class(linept)
[3,n] = size(linedr); double = class(linedr)

are, respectively, a point and a direction vector that define a
line.  The line is the set of vectors

linept   +   t * linedr

where t is any real number.

the call:

[ pnear, dist ] = cspice_npedln( a, b, c, linept, linedr )

returns:

pnear   the point on the ellipsoid closest to the line, if the line
doesn't intersect the ellipsoid.

[3,n] = size(pnear); double = class(pnear)

If the line intersects the ellipsoid, pnear will be a point
of intersection.  If linept is outside of the ellipsoid, 'pnear'
will be the closest point of intersection.  If linept is inside
ellipsoid, pnear will not necessarily be the  the closest point
of intersection.

dist    , the distance of the line from the ellipsoid. This is the
minimum distance between any point on the line and any point on
the ellipsoid.

[1,n] = size(dist); double = class(dist)

If the line intersects the ellipsoid, 'dist' is zero.

```

#### 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.

%
% We can find the distance between an instrument optic axis ray
% and the surface of a body modeled as a tri-axial ellipsoid
% using this routine.  If the instrument position and pointing
% unit vector in body-fixed coordinates are:
%
linept = [ 1.0e6,  2.0e6,  3.0e6 ]';
linedr = [ -4.472091234e-1, -8.944182469e-1, -4.472091234e-3 ]';

%
% The body semi-axes lengths:
%
a = 7.0e5;
b = 7.0e5;
c = 6.0e5;

%
% The call to cspice_npedln yields a value for 'pnear', the nearest
% point on the body to the optic axis ray and a value for 'dist',
% the distance to the ray.
%
[ pnear, dist ] = cspice_npedln( a, b, c, linept, linedr )

MATLAB outputs:

pnear =

-1.633311079234085e+03
-3.266622215782081e+03
5.999918335000672e+05

dist =

2.389967933829971e+06

```

#### Particulars

```
For any ellipsoid and line, if the line does not intersect the
ellipsoid, there is a unique point on the ellipsoid that is
closest to the line.  Therefore, the distance dist between
ellipsoid and line is well-defined.  The unique line segment of
length dist that connects the line and ellipsoid is normal to
both of these objects at its endpoints.

If the line intersects the ellipsoid, the distance between the
line and ellipsoid is zero.

```

```
For important details concerning this module's function, please refer to
the CSPICE routine npedln_c.

MICE.REQ
ELLIPSES.REQ

```

#### Version

```
-Mice Version 1.0.0, 12-MAR-2012, EDW (JPL), SCK (JPL)

```

#### Index_Entries

```
distance between line and ellipsoid
distance between line of sight and body
nearest point on ellipsoid to line

```
`Wed Apr  5 18:00:33 2017`