dskn02_c |

## Procedurevoid dskn02_c ( SpiceInt handle, ConstSpiceDLADescr * dladsc, SpiceInt plid, SpiceDouble normal[3] ) ## AbstractCompute the unit normal vector for a specified plate from a type 2 DSK segment. ## Required_ReadingDAS DSK ## KeywordsDAS DSK FILES ## Brief_I/OVariable I/O Description -------- --- -------------------------------------------------- handle I DSK file handle. dladsc I DLA descriptor. plid I Plate ID. normal O Plate's unit normal vector. ## Detailed_Inputhandle is the handle of a DSK file containing a type 2 segment from which data are to be fetched. dladsc is the DLA descriptor associated with the segment from which data are to be fetched. plid is the plate ID. Plate IDs range from 1 to NP (the number of plates in the segment identified by `dladsc'). ## Detailed_Outputnormal is the normal vector associated with the plate designated by `plid'. The direction of `normal' is determined by the order of the plate's vertices; the vertices are presumed to be ordered in the right-handed (counterclockwise) sense about the normal direction. If the plate's vertices are v1, v2, v3, then `normal' points in the direction (v2 - v1) x ( v3 - v2 ) where "x" represents the cross product operator. The vector `normal' is expressed in the body-fixed reference frame of the segment designated by `dladsc'. The center of this frame is the origin of the cartesian coordinate system in which the vertices are expressed. Note that the frame center need not coincide with the central body of the segment. Units are km. The vector has magnitude 1. If an error occurs on the call, `normal' is undefined. ## ParametersSee the header file SpiceDLA.h ## Exceptions1) If the input handle is invalid, the error will be diagnosed by routines in the call tree of this routine. 2) If a file read error occurs, the error will be diagnosed by routines in the call tree of this routine. 3) If the input DLA descriptor is invalid, the effect of this routine is undefined. The error *may* be diagnosed by routines in the call tree of this routine, but there are no guarantees. 4) If `plid' is less than 1 or greater than the number of plates in the segment, the error SPICE(INDEXOUTOFRANGE) is signaled. 5) This routine does not check for linear independence of the plate's edges. The plate model is assumed to be geometrically valid. ## FilesSee input argument `handle'. ## ParticularsNone. ## Examples1) Look up all the vertices associated with each plate of the model contained in a specified type 2 segment. For each plate, display the plate's vertices and normal vector. For this example, we'll show the context of this look-up: opening the DSK file for read access, traversing a trivial, one-segment list to obtain the segment of interest. Example code begins here. #include <stdio.h> #include "SpiceUsr.h" #include "SpiceDLA.h" #include "dsk_proto.h" int main() { /. Constants ./ #define PBUFSIZ 10000 #define FILSIZ 256 /. Local variables ./ SpiceBoolean found; SpiceChar dsk [ FILSIZ ]; SpiceDLADescr dladsc; SpiceDouble normal [3]; SpiceDouble verts [3][3]; SpiceInt handle; SpiceInt i; SpiceInt j; SpiceInt n; SpiceInt np; SpiceInt nread; SpiceInt nv; SpiceInt nvtx; SpiceInt plates[PBUFSIZ][3]; SpiceInt plix; SpiceInt remain; SpiceInt start; /. Prompt for name of DSK and open file for reading. ./ prompt_c ( "Enter DSK name > ", FILSIZ, dsk ); dasopr_c ( dsk, &handle ); dlabfs_c ( handle, &dladsc, &found ); if ( !found ) { setmsg_c ( "No segment found in file #." ); errch_c ( "#", dsk ); sigerr_c ( "SPICE(NOSEGMENT)" ); } /. Get segment vertex and plate counts. ./ dskz02_c ( handle, &dladsc, &nv, &np ); printf ( "\n" "Number of vertices: %d\n" "Number of plates: %d\n", (int)nv, (int)np ); /. Display the vertices of each plate. ./ remain = np; start = 1; while ( remain > 0 ) { /. `nread' is the number of plates we"ll read on this loop pass. ./ nread = mini_c ( 2, PBUFSIZ, remain ); dskp02_c ( handle, &dladsc, start, nread, &n, plates ); for ( i = 0; i < nread; i++ ) { plix = start + i; /. Read the vertices of the current plate. ./ for ( j = 0; j < 3; j++ ) { dskv02_c ( handle, &dladsc, plates[i][j], 1, &nvtx, ( SpiceDouble(*)[3] )(verts[j]) ); } /. Display the vertices of the current plate: ./ printf ( "\n" " Plate number: %d\n" " Vertex 1: ( %16.8e %16.8e %16.8e )\n" " Vertex 2: ( %16.8e %16.8e %16.8e )\n" " Vertex 3: ( %16.8e %16.8e %16.8e )\n", (int)plix, verts[0][0], verts[0][1], verts[0][2], verts[1][0], verts[1][1], verts[1][2], verts[2][0], verts[2][1], verts[2][2] ); /. Display the normal vector of the current plate: ./ ## RestrictionsSee Exceptions. ## Literature_ReferencesNone. ## Author_and_InstitutionN.J. Bachman (JPL) ## Version-CSPICE Version 1.0.1, 27-JAN-2016 (NJB) Edit to example program to use "%d" with explicit casts to int for printing SpiceInts with printf. Updated header Detailed_Output and Index_Entries sections. -CSPICE Version 1.0.0, 03-JUN-2010 (NJB) ## Index_Entriescompute normal vector for a type 2 dsk plate compute normal vector from dsk type 2 plate id |

Wed Apr 5 17:54:32 2017