cspice_nplnpt

 Abstract I/O Examples Particulars Required Reading Version Index_Entries

#### Abstract

CSPICE_NPLNPT calculates the location on a defined line
nearest to a specified point, then determines the distance
between the two points.

#### I/O

Given:

linpt    [3,1] = size(linpt); double = class(linpt)

lindir   [3,1] = size(lindir); double = class(lindir)

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.

point    a point in 3-dimensional space.

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

the call:

[ pnear, dist ] = cspice_nplnpt( linpt, lindir, point )

returns:

pnear   the nearest point on the input line to the input 'point'.

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

dist    distance between the input line and input point.

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

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

%
% Define a point on a line, a direction for the line, and
% an arbitrary point in space.
%
linept = [  1, 2,  3 ]';
linedr = [  0, 1,  1 ]';
point  = [ -6, 9, 10 ]';

%
% Calculate the location on the line nearest the point
% and the distance between the location and the defined
% point.
%
[ pnear, dist ] = cspice_nplnpt( linept, linedr, point )

MATLAB outputs:

pnear =

1
9
10

dist =

7

#### Particulars

For every line L and point P, there is a unique closest point
on L to P.  Call this closest point C.  It is always true that
P - C  is perpendicular to L, and the length of P - C is called
the "distance" between P and L.

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

MICE.REQ

#### Version

-Mice Version 1.0.0, 14-NOV-2013, EDW (JPL), SCK (JPL)

#### Index_Entries

distance between point and line
nearest point on line to point

Wed Apr  5 18:00:33 2017