dskv02_c |

## Procedurevoid dskv02_c ( SpiceInt handle, ConstSpiceDLADescr * dladsc, SpiceInt start, SpiceInt room, SpiceInt * n, SpiceDouble vrtces[][3] ) ## AbstractFetch vertices 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. start I Start index. room I Amount of room in output array. n O Number of vertices returned. vrtces O Array containing vertices. ## 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. start is the ID of the first vertex to be fetched from the segment designated by `handle' and `dladsc'. The ID of a vertex is its ordinal position within the segment. Vertex IDs range from 1 to NV, where NV is the number of vertices in the segment. Note that Fortran-style 1-based indexing is used for vertex IDs because these IDs must be consistent with the IDs used in DSK files, across all languages supported by SPICE. room is the number of vertices that can fit in the output `vrtces' array: the output array must be large enough to hold at least 3*room double precision values. ## Detailed_Outputn is the number of vertices fetched to the output array `vrtces'. `n' is normally in the range 1 : min( NV, room ) If an error occurs on the call, `n' is undefined. vrtces is a contiguous set of vertices. The returned vertices are arranged in order of increasing vertex ID. The IDs of the returned vertices range from start to start + n - 1 Each vertex is a 3-vector. The correspondence of elements of `vrtces' with the elements of the set of vertices contained in the segment is: vrtces[0][0] segment_vertex_set[start][0] vrtces[0][1] segment_vertex_set[start][1] vrtces[0][2] segment_vertex_set[start][2] ... ... vrtces[n-1][0] segment_vertex_set[start+n-1][0] vrtces[n-1][1] segment_vertex_set[start+n-1][1] vrtces[n-1][2] segment_vertex_set[start+n-1][2] The vertices are expressed in the body-fixed reference frame of the segment designated by `handle' and `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. If an error occurs on the call, `vrtces' 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 `room' is non-positive, the error SPICE(VALUEOUTOFRANGE) is signaled. 5) If `start' is less than 1 or greater than or equal to the number of vertices in the segment, the error SPICE(INDEXOUTOFRANGE) is signaled. ## FilesSee input argument `handle'. ## ParticularsThis routine enables SPICE-based user applications to rapidly fetch the vertex data from a specified type 2 DSK segment. Using a large output array generally improves efficiency. ## ExamplesThe numerical results shown for this example may differ across platforms. The results depend on the SPICE kernels used as input, the compiler and supporting libraries, and the machine specific arithmetic implementation. 1) 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" 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++ ) { ## RestrictionsNone. ## Literature_ReferencesNone. ## Author_and_InstitutionN.J. Bachman (JPL) ## Version-CSPICE Version 1.0.0, 04-APR-2017 (NJB) Updated header to refer to "vertex IDs." 27-JAN-2016 (NJB) Removed references to old header files. Updated example program. Updated Detailed_Output header section. DSKLIB_C Version 1.0.1, 21-APR-2014 (NJB) The diagram in the Detailed_Output header section showing the contents of the output `vrtces' array has been corrected. DSKLIB_C Version 1.0.0 04-JUN-2010 (NJB) ## Index_Entriesreturn specified vertices from type 2 DSK segment |

Wed Apr 5 17:54:32 2017