Index Page
cspice_dskn02
A  B  C  D  E  F  G  H  I  J  K  L  M  N  O  P  Q  R  S  T  U  V  W  X 

Abstract
I/O
Examples
Particulars
Required Reading
Version
Index_Entries

Abstract


   CSPICE_DSKN02 returns the unit normal vector for a specified plate
   from a type 2 DSK segment.

   For important details concerning this module's function, please refer to
   the CSPICE routine dskn02_c.

I/O


   Given:

      handle    the handle of a DSK file containing a type 2 segment
                from which data are to be fetched.

      dladsc    the DLA descriptor associated with the segment from
                which data are to be fetched.

      plid      a plate ID. 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'. 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.

                The vector has magnitude 1.

                If an error occurs on the call, `normal' is undefined.

Examples


   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.

   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.

      PRO DSKZ02_T, dsk

         ;;
         ;; Declare DSK Mice parameters for use in API calls.
         ;;
         @IcyUser

         ;;
         ;; Constants
         ;;
         PBUFSIZ = 10000L

         ;;
         ;; Initial values
         ;;
         verts = dblarr(3,3)

         ;;
         ;; 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 plate.
         ;;
         remain = np
         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: ', i

               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

   IDL outputs:

      IDL> dskz02_t, 'solid.bds'

      Number of vertices:           12
      Number of plates:             20

      Plate number:        1
         Vertex :       1       0.0000000       0.0000000       1.1755700
         Vertex :       2       1.0514600       0.0000000      0.52573100
         Vertex :       3      0.32492000       1.0000000      0.52573100
         Normal:       0.49112416      0.35682135      0.79465438

      Plate number:        2
         Vertex :       1       0.0000000       0.0000000       1.1755700
         Vertex :       2      0.32492000       1.0000000      0.52573100
         Vertex :       3     -0.85065100      0.61803400      0.52573100
         Normal:      -0.18759233      0.57735008      0.79465465

         ...

      Plate number:       19
         Vertex :       1     -0.32492000      -1.0000000     -0.52573100
         Vertex :       2       0.0000000       0.0000000      -1.1755700
         Vertex :       3      0.85065100     -0.61803400     -0.52573100
         Normal:       0.18759233     -0.57735008     -0.79465465

      Plate number:       20
         Vertex :       1      0.85065100     -0.61803400     -0.52573100
         Vertex :       2       0.0000000       0.0000000      -1.1755700
         Vertex :       3      0.85065100      0.61803400     -0.52573100
         Normal:       0.60706168       0.0000000     -0.79465472

Particulars


   None.

Required Reading


   ICY.REQ
   DAS.REQ
   DSK.REQ

Version


   -Icy Version 1.0.0, 13-DEC-2016, ML (JPL), EDW (JPL)

Index_Entries


   compute normal vector for a type 2 dsk plate
   compute normal vector from dsk type 2 plate id



Wed Apr  5 17:58:00 2017