CSPICE_NPEDLN calculates the nearest point on a triaxial
ellipsoid to a specified line, and the distance from the
ellipsoid point to the line.
For important details concerning this module's function, please refer to
the CSPICE routine npedln_c.
Given:
a,
b,
c the scalar double precision lengths of the semiaxes 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 semiaxes that
respectively point in the x, y, and z directions.
linept a double precision 3vector.
linedr 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.
the call:
cspice_npedln, a, b, c, linept, linedr, pnear, dist
returns:
pnear a double precision 3vector on the ellipsoid that is closest
to the line, if the line doesn't intersect the ellipsoid.
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 the ellipsoid, 'pnear' will not necessarily be the
closest point of intersection.
dist the scalar double precision distance of the line from the
ellipsoid. This is the minimum distance between any point on
the line and any point on the ellipsoid.
If the line intersects the ellipsoid, 'dist' is zero.
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 triaxial ellipsoid
;; using this routine. If the instrument position and pointing
;; unit vector in bodyfixed coordinates are:
;;
linept = [ 1.0d6, 2.0d6, 3.0d6 ]
linedr = [ 4.472091234d1, 8.944182469d1, 4.472091234d3 ]
;;
;; The body semiaxes lengths:
;;
a = 7.0d5
b = 7.0d5
c = 6.0d5
;;
;; 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.
;;
cspice_npedln, a, b, c, linept, linedr, pnear, dist
print, pnear
print, dist
IDL outputs for pnear:
1633.3111 3266.6222 599991.83
IDL outputs for dist:
2389967.9
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 welldefined. 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.
ICY.REQ
ELLIPSES.REQ
Icy Version 1.0.1, 13JUN2011, EDW (JPL)
Improved comments in the Examples section. Particulars section
now parallels Mice version.
Icy Version 1.0.0, 16JUN2003, EDW (JPL)
distance between line and ellipsoid
distance between line of sight and body
nearest point on ellipsoid to line
