Table of contents
CSPICE_DSKP02 fetches triangular plates from a type 2 DSK segment.
Given:
handle the handle of a DSK file containing a type 2 segment from which
data are to be fetched.
help, handle
LONG = Scalar
dladsc the DLA descriptor associated with the segment from which data
are to be fetched.
help, dladsc
LONG = Array[SPICE_DLA_DSCSIZ]
start the ID of the first plate to be fetched from the segment
designated by `handle' and `dladsc'.
help, start
LONG = Scalar
The ID of a plate is its ordinal position within the segment.
Plate IDs range from 1 to `np', where `np' is the number of
plates in the segment.
Note that Fortran-style 1-based indexing is used for
plate IDs because these IDs must be consistent with
the IDs used in DSK files, across all languages
supported by SPICE.
room the maximum number of plates to return.
help, room
LONG = Scalar
the call:
cspice_dskp02, handle, dladsc, start, room, plates
returns:
plates an array representing a contiguous set of `n' plates, where `n'
is between 1 and `room' inclusive.
help, plates
LONG = Array[3,N]
The returned plates are arranged in order of increasing plate
ID. The IDs of the returned plates range from
start
to
start + n - 1
Each "plate" consists of three vertex indices.
The range of vertex indices is from 1 to `nv', where `nv' is
the number of vertices in the segment.
The correspondence of elements of `plates' with the
elements of the set of plates contained in the segment
is:
plates[0,0] plate_set[0, start]
plates[1,0] plate_set[1, start]
plates[2,0] plate_set[2, start]
... ...
plates[0,n-1] plate_set[0, start+n-1]
plates[1,n-1] plate_set[1, start+n-1]
plates[2,n-1] plate_set[2, start+n-1]
If an error occurs on the call, `plates' is
undefined.
See the parameter definitions file
IcyDLA.pro
for declarations of DLA descriptor sizes and documentation of the
contents of DLA descriptors.
See the parameter definitions file
IcyDSK.pro
for declarations of DSK descriptor sizes and documentation of the
contents of DSK descriptors.
See the parameter definitions file
IcyDSK.pro
for declarations of DSK data type 2 (plate model) parameters.
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.
1) Look up all the vertices associated with each plate
of the model contained in a specified type 2 segment. For each
of the first 5 plates, 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.
PRO dskp02_ex1
;;
;; Constants
;;
PBUFSIZ = 10000L
;;
;; Local variables
;;
dsk = ''
;;
;; Initial values
;;
verts = dblarr(3,3)
;;
;; Prompt for the name of the file to search.
;;
read, dsk, PROMPT='Enter name of DSK file > '
;;
;; Open the DSK file for read access.
;; We use the DAS-level interface for
;; this function.
;;
cspice_dasopr, dsk, handle
;;
;; Begin a forward search through the
;; kernel, treating the file as a DLA.
;; In this example, it's a very short
;; search.
;;
cspice_dlabfs, handle, dladsc, found
if ( ~found ) then begin
;;
;; We arrive here only if the kernel
;; contains no segments. This is
;; unexpected, but we're prepared for it.
;;
warning, 'No segments found in DSK file ' + dsk
endif
;;
;; If we made it this far, `dladsc' is the
;; DLA descriptor of the first segment.
;;
;; Get segment vertex and plate counts.
;;
cspice_dskz02, handle, dladsc, nv, np
print
print, 'Number of vertices: ', nv
print, 'Number of plates: ', np
;;
;; Display the vertices of each of the first 5 plates.
;;
remain = min([ np, 5])
start = 1
while (remain gt 0 ) do begin
;;
;; `nread' is the number of plates we"ll read on this
;; loop pass. Set `nread' to the minimum of PBUFSIZ
;; and `remain'.
;;
nread = min( [PBUFSIZ, remain])
cspice_dskp02, handle, dladsc, start, nread, plates
for i = 1, nread do begin
plix = start + i - 1
;;
;; Read the vertices of the current plate.
;;
for j = 1, 3 do begin
cspice_dskv02, handle, dladsc, plates[j-1,i-1], 1, v
verts[*,j-1] = v
endfor
;;
;; Display the vertices of the ith plate:
;;
print
print, 'Plate number: ', plix
for j = 1, 3 do begin
print, ' Vertex :', j, verts[*,j-1]
endfor
;;
;; Display the normal vector of the current plate:
;;
cspice_dskn02, handle, dladsc, plix, normal
print, ' Normal: ', normal
end
start = start + nread
remain = remain - nread
endwhile
;;
;; Close file.
;;
cspice_dascls, handle
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, using the DSK file named phobos512.bds, the output
was:
Enter name of DSK file > phobos512.bds
Number of vertices: 1579014
Number of plates: 3145728
Plate number: 1
Vertex : 1 -6.7744400 6.2681500 6.0114900
Vertex : 2 -6.7623800 6.2572800 6.0255600
Vertex : 3 -6.7571000 6.2775400 6.0209600
Normal: -0.58197377 0.32128561 0.74704892
Plate number: 2
Vertex : 1 -6.7744400 6.2681500 6.0114900
Vertex : 2 -6.7797300 6.2479000 6.0161000
Vertex : 3 -6.7623800 6.2572800 6.0255600
Normal: -0.58145695 0.32198831 0.74714881
Plate number: 3
Vertex : 1 -6.7797300 6.2479000 6.0161000
Vertex : 2 -6.7676800 6.2370100 6.0301900
Vertex : 3 -6.7623800 6.2572800 6.0255600
Normal: -0.58159707 0.32264196 0.74675767
Plate number: 4
Vertex : 1 -6.7797300 6.2479000 6.0161000
Vertex : 2 -6.7849900 6.2276200 6.0207000
Vertex : 3 -6.7676800 6.2370100 6.0301900
Normal: -0.58312901 0.32056070 0.74645924
Plate number: 5
Vertex : 1 -6.7849900 6.2276200 6.0207000
Vertex : 2 -6.7729900 6.2167400 6.0348200
Vertex : 3 -6.7676800 6.2370100 6.0301900
Normal: -0.58366405 0.32306020 0.74496200
This routine enables SPICE-based user applications to rapidly
fetch the plate data from a specified type 2 DSK segment. Using
a large output array generally improves efficiency.
1) If the input handle is invalid, an error is signaled by a
routine in the call tree of this routine.
2) If a file read error occurs, the error is signaled by a
routine 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 by a routine in the call tree of this routine.
5) If `start' is less than 1 or greater than the number of plates
in the segment, the error SPICE(INDEXOUTOFRANGE) is signaled
by a routine in the call tree of this routine.
6) If any of the input arguments, `handle', `dladsc', `start' or
`room', is undefined, an error is signaled by the IDL error
handling system.
7) If any of the input arguments, `handle', `dladsc', `start' or
`room', is not of the expected type, or it does not have the
expected dimensions and size, an error is signaled by the Icy
interface.
8) If the output argument `plates' is not a named variable, an
error is signaled by the Icy interface.
See input argument `handle'.
None.
DAS.REQ
DSK.REQ
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
M. Liukis (JPL)
E.D. Wright (JPL)
-Icy Version 1.0.1, 31-MAY-2021 (JDR)
Fixed typos in code example.
Edited the header to comply with NAIF standard. Updated
code example to prompt for the input DSK file and reduce the
number of plates whose vertices are shown on output.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.0, 04-APR-2017 (ML) (EDW)
fetch plate data from a type 2 DSK segment
|