cspice_inrypl

 Abstract I/O Examples Particulars Required Reading Version Index_Entries
```
```

#### Abstract

```
CSPICE_INRYPL finds the intersection of a ray and a plane.

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

```

#### I/O

```
Given:

vertex   a double precision 3-vector defining the vertex position
of a ray.

dir      a double precision 3-vector defining the direction of a
ray from 'vertex'.

plane    a scalar SPICE plane structure. The structure has the fields:

normal:   [3-array double]
constant: [scalar double]

the call:

cspice_inrypl, vertex, dir, plane, nxpts, xpt

returns:

nxpts   a scalar integer flag indicating the number of intersection
points between the ray and 'plane':

0     No intersection.

1     One point of intersection.  Note that
this case may occur when the ray's
vertex is in the plane.

-1     An infinite number of points of
intersection; the ray lies in the plane.

xpt      a double precision 3-vector defining the point of
intersection of the input ray and plane, when one point
of intersection exists.

If the ray lies in the plane, xpt is set equal to
vertex.

If no intersection exists, xpt returns as the zero
vector.

```

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

;;
;; Determine the intersection between the Saturn ring plane and
;; a look direction as seen from a position in the Saturn
;; body-fixed frame. For this extremely simplistic example,
;; we take the equatorial plane as the ring plane.
;;

;;
;; Load the standard kernel set.
;;
cspice_furnsh, 'standard.tm'

;;
;; Retrieve the triaxial radii of Saturn (699)
;;
cspice_bodvrd, 'SATURN', 'RADII', 3, radii

;;
;; Define a position in the IAU_SATURN frame at three equatorial
;; radius out along the x axis, a half radius above the
;; equatorial plane. For this example, we'll assume 'vertex'
;; represents the light-time corrected position of a vehicle
;; to the Saturn ring plane.
;;
vertex = [ 3.d0 * radii, 0.d0, radii *.5d0 ];

;;
;; Define a look vector in the y-z plane from 'vertex'.
;;
;;   'vertex'
;;      *______ y
;;     /|\
;;    / | \  30 degrees
;;   /  |  \
;;  x  -z  'dir'
;;
dir = [ 0.d,                       \$
cos( 30.d *cspice_rpd() ), \$
-sin( 30.d *cspice_rpd() )  \$
]

;;
;; Define the equatorial plane as a SPICE plane. The Z
;; axis is normal to the plane, the origin lies in the
;; plane.
;;
normal = [ 0.d, 0.d, 1.d]
point  = [ 0.d, 0.d, 0.d]
cspice_nvp2pl , normal, point, plane

;;
;; Determine the intersection point of 'dir' and 'plane', if
;; such an intersection exists.
;;
cspice_inrypl, vertex, dir, plane, nxpts, xpt

;;
;; Do we have an intersection?
;;
if ( nxpts eq 1 ) then begin
print, "Vector intersects plane at: ", xpt
endif

;;
;; No intersection
;;
if ( nxpts eq 0 ) then begin
print, "No intersection between vector and plane."
endif

;;
;; No intersection
;;
if ( nxpts eq -1 ) then begin
print, "Vector lies in plane, degenerate case."
endif

IDL outputs:

Vector intersects plane at:  180804.00  47080.605  0.0000000

```

#### Particulars

```
The intersection of a ray and plane in three-dimensional space
can be a the empty set, a single point, or the ray itself.

```

```
ICY.REQ
PLANES.REQ

```

#### Version

```
-Icy Version 1.0.0, 16-JUN-2003, EDW (JPL)

```

#### Index_Entries

```
intersection of ray and plane

```
`Wed Apr  5 17:58:02 2017`