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.
linpt a double precision 3-vector.
lindir a double precision 3-vector.
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 3-vector defining a position
cspice_nplnpt, linpt, lindir, point, pnear, dist
pnear a double precision 3-vector 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
cspice_nplnpt, linept, linedr, point, pnear, dist
IDL outputs for pnear:
1.0000000 9.0000000 10.000000
IDL outputs for dist:
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 Version 1.0.1, 13-JUN-2011, EDW (JPL)
Edits to I/O and Particulars sections so as to parallel Mice version.
-Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)
distance between point and line
nearest point on line to point