CSPICE_NPLNPT calculates the location on a defined line
nearest to a specified point, then determines the distance
between the two points.
For important details concerning this module's function, please refer to
the CSPICE routine nplnpt_c.
Given:
linpt a double precision 3vector.
lindir a double precision 3vector.
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 double precision 3vector defining a position
in space.
the call:
cspice_nplnpt, linpt, lindir, point, pnear, dist
returns:
pnear a double precision 3vector identifying the nearest
point on the input line to the input 'point'.
dist the scalar double precision distance between the
input line and input 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 point on a line, a direction for the line, and
;; an arbitrary point in space.
;;
linept = [ 1.d, 2.d, 3.d ]
linedr = [ 0.d, 1.d, 1.d ]
point = [ 6.d, 9.d, 10.d ]
;;
;; Calculate the location on the line nearest the point
;; and the distance between the location and the defined
;; point.
;;
cspice_nplnpt, linept, linedr, point, pnear, dist
print, pnear
print, dist
IDL outputs for pnear:
1.0000000 9.0000000 10.000000
IDL outputs for dist:
7.0000000
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.
ICY.REQ
Icy Version 1.0.1, 13JUN2011, EDW (JPL)
Edits to I/O and Particulars sections so as to parallel Mice version.
Icy Version 1.0.0, 16JUN2003, EDW (JPL)
distance between point and line
nearest point on line to point
