inrypl_c |

Table of contents## Procedureinrypl_c ( Intersection of ray and plane ) void inrypl_c ( ConstSpiceDouble vertex [3], ConstSpiceDouble dir [3], ConstSpicePlane * plane, SpiceInt * nxpts, SpiceDouble xpt [3] ) ## AbstractFind the intersection of a ray and a plane. ## Required_ReadingPLANES ## KeywordsGEOMETRY ## Brief_I/OVARIABLE I/O DESCRIPTION -------- --- -------------------------------------------------- vertex, dir I Vertex and direction vector of ray. plane I A SPICE plane. nxpts O Number of intersection points of ray and plane. xpt O Intersection point, if nxpts = 1. ## Detailed_Inputvertex, dir are a point and direction vector that define a ray in three-dimensional space. plane is a SPICE plane. ## Detailed_Outputnxpts is the number of points of intersection of the input ray and plane. Values and meanings of nxpts are: 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 is the point of intersection of the input ray and plane, when there is exactly one point of intersection. If the ray lies in the plane, xpt is set equal to vertex. If there is no intersection, xpt is the zero vector. ## ParametersNone. ## Exceptions1) If the ray's direction vector is the zero vector, the error SPICE(ZEROVECTOR) is signaled. `nxpts' and `xpt' are not modified. 2) If the ray's vertex is further than dpmax_c / 3 from the origin, the error SPICE(VECTORTOOBIG) is signaled. `nxpts' and `xpt' are not modified. 3) If the input plane is further than dpmax_c / 3 from the origin, the error SPICE(VECTORTOOBIG) is signaled. `nxpts' and `xpt' are not modified. 4) The input plane should be created by one of the CSPICE routines nvc2pl_c nvp2pl_c psv2pl_c Invalid input planes will cause unpredictable results. 5) In the interest of good numerical behavior, in the case where the ray's vertex is not in the plane, this routine considers that an intersection of the ray and plane occurs only if the distance between the ray's vertex and the intersection point is less than dpmax_c / 3. If `vertex' is not in the plane and this condition is not met, then `nxpts' is set to 0 and `xpt' is set to the zero vector. ## FilesNone. ## ParticularsThe intersection of a ray and plane in three-dimensional space can be a the empty set, a single point, or the ray itself. ## Examples1) Find the camera projection of the center of an extended body. For simplicity, we assume: -- The camera has no distortion; the image of a point is determined by the intersection of the focal plane and the line determined by the point and the camera's focal point. -- The camera's pointing matrix (C-matrix) is available in a C-kernel. /. Load Leapseconds and SCLK kernels to support time conversion. ./ furnsh_c ( "leap.ker" ); furnsh_c ( "sclk.ker" ); /. Load an SPK file containing ephemeris data for observer (a spacecraft, whose NAIF integer code is sc) and target at the UTC epoch of observation. ./ furnsh_c ( "spk.bsp" ); /. Load a C-kernel containing camera pointing for the UTC epoch of observation. ./ furnsh_c ( "ck.bc" ) ; /. Find the ephemeris time (barycentric dynamical time) and encoded spacecraft clock times corresponding to the UTC epoch of observation. ./ utc2et_c ( utc, &et ); sce2c_c ( sc, et, &sclkdp ); /. Encode the pointing lookup tolerance. ./ sctiks_c ( sc, tolch, &toldp ); /. Find the observer-target vector at the observation epoch. In this example, we'll use a light-time and stellar aberration corrected state vector. ./ spkez_c ( target, et, "J2000", "LT+S", sc, state, < ); /. Look up camera pointing. ./ ckgp_c ( camera, sclkdp, toldp, "J2000", cmat, &clkout, &found ); if ( !found ) { /. No pointing was available. ./ [Handle this case...] return; } /. Negate the spacecraft-to-target body vector and convert it to camera coordinates. ./ vminus_c ( state, dir ); mxv_c ( cmat, dir, dir ); /. If FL is the camera's focal length, the effective focal point is FL * ( 0, 0, 1 ) ./ vscl_c ( FL, zvec, focus ); /. The camera's focal plane contains the origin in camera coordinates, and the z-vector is orthogonal to the plane. Make a SPICE plane representing the focal plane. ./ nvc2pl_c ( zvec, 0., &fplane ); /. The image of the target body's center in the focal plane is defined by the intersection with the focal plane of the ray whose vertex is the focal point and whose direction is dir. ./ ## RestrictionsNone. ## Literature_ReferencesNone. ## Author_and_InstitutionN.J. Bachman (JPL) J. Diaz del Rio (ODC Space) B.V. Semenov (JPL) ## Version-CSPICE Version 1.0.3, 24-AUG-2021 (JDR) Edited the header to comply with NAIF standard. -CSPICE Version 1.0.2, 01-FEB-2017 (BVS) Typo fix: pnv2pl_c -> nvp2pl_c. -CSPICE Version 1.0.1, 12-DEC-2002 (NJB) Header fix: ring plane intercept algorithm was corrected. Now light time is computed accurately, and stellar aberration is accounted for. Example was turned into a complete subroutine. -CSPICE Version 1.0.0, 26-JUN-1999 (NJB) ## Index_Entriesintersection of ray and plane |

Fri Dec 31 18:41:08 2021