Table of contents
CSPICE_DSKN02 computes the unit normal vector for a specified plate 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]
plid the plate ID.
help, plid
LONG = Scalar
Plate IDs range from 1 to NP (the number of plates in the
segment identified by `dladsc').
the call:
cspice_dskn02, handle, dladsc, plid, normal
returns:
normal the normal vector associated with the plate designated by
`plid'.
help, normal
DOUBLE = Array[3]
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.
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 dskn02_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
None.
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 `plid' 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.
5) This routine does not check for linear independence of the
plate's edges. The plate model is assumed to be geometrically
valid.
6) If any of the input arguments, `handle', `dladsc' or `plid',
is undefined, an error is signaled by the IDL error handling
system.
7) If any of the input arguments, `handle', `dladsc' or `plid',
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 `normal' is not a named variable, an
error is signaled by the Icy interface.
See input argument `handle'.
See -Exceptions section.
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, 13-DEC-2016 (ML) (EDW)
compute normal vector for a type 2 DSK plate
compute normal vector from DSK type 2 plate id
|