Table of contents
CSPICE_DSKZ02 returns plate model size parameters---plate count and
vertex count---for 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]
the call:
cspice_dskz02, handle, dladsc, nv, np
returns:
nv the number of vertices belonging to the specified plate model.
help, nv
LONG = Scalar
np the number of plates belonging to the specified plate model.
help, np
LONG = Scalar
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 dskz02_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 conveniently
fetch the plate and vertex counts of a type 2 DSK segment.
See the routine cspice_dskb02 (DSK, fetch type 2 bookkeeping data)
for an interface that returns all type 2 DSK segment
bookkeeping data in a single call.
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 any of the input arguments, `handle' or `dladsc', is
undefined, an error is signaled by the IDL error handling
system.
5) If any of the input arguments, `handle' or `dladsc', is not of
the expected type, or it does not have the expected dimensions
and size, an error is signaled by the Icy interface.
6) If any of the output arguments, `nv' or `np', 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.
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, 14-DEC-2016 (ML) (EDW)
fetch model size parameters from a type 2 DSK segment
|