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

Table of contents
Abstract
I/O
Parameters
Examples
Particulars
Exceptions
Files
Restrictions
Required_Reading
Literature_References
Author_and_Institution
Version
Index_Entries


Abstract


   CSPICE_CYLREC converts cylindrical coordinates to rectangular
   (Cartesian) coordinates.

I/O


   Given:

      r        a double precision scalar or N-vector describing the distance of
               the point of interest from z axis.

               help, r
                  DOUBLE = Scalar   or   DOUBLE = Array[N]

               Output units are the same as the units associated with `r'.

      clon     a double precision scalar or N-vector describing the cylindrical
               angle of the point of interest from XZ plane measured in
               radians.

               help, clon
                  DOUBLE = Scalar   or   DOUBLE = Array[N]

      z        a double precision scalar or N-vector describing the height of
               the point above XY plane.

               help, z
                  DOUBLE = Scalar   or   DOUBLE = Array[N]

   the call:

      cspice_cylrec, r, clon, z, rectan

   returns:

      rectan   a double precision 3-vector or 3xN array containing the
               rectangular coordinates of the position or set of positions.

               help, rectan
                  DOUBLE = Array[3]   or   DOUBLE = Array[3,N]

               The output units associated with `rectan' are those associated
               with the input `z'.

               `rectan' returns with the same measure of vectorization (N)
               as `r', `clon', and `z'.

Parameters


   None.

Examples


   Any numerical results shown for these examples may differ between
   platforms as the results depend on the SPICE kernels used as input
   and the machine specific arithmetic implementation.

   1) Compute the cylindrical coordinates of the position of the Moon
      as seen from the Earth, and convert them to rectangular
      coordinates.

      Use the meta-kernel shown below to load the required SPICE
      kernels.


         KPL/MK

         File name: cylrec_ex1.tm

         This meta-kernel is intended to support operation of SPICE
         example programs. The kernels shown here should not be
         assumed to contain adequate or correct versions of data
         required by SPICE-based user applications.

         In order for an application to use this meta-kernel, the
         kernels referenced here must be present in the user's
         current working directory.

         The names and contents of the kernels referenced
         by this meta-kernel are as follows:

            File name                     Contents
            ---------                     --------
            de421.bsp                     Planetary ephemeris
            naif0012.tls                  Leapseconds


         \begindata

            KERNELS_TO_LOAD = ( 'de421.bsp',
                                'naif0012.tls'  )

         \begintext

         End of meta-kernel


      Example code begins here.


      PRO cylrec_ex1

         ;;
         ;; Load SPK and LSK kernels, use a meta kernel for
         ;; convenience.
         ;;
         cspice_furnsh, 'cylrec_ex1.tm'

         ;;
         ;; Look up the geometric state of the Moon as seen from
         ;; the Earth at 2017 Mar 20, relative to the J2000
         ;; reference frame.
         ;;
         cspice_str2et, '2017 Mar 20', et

         cspice_spkpos, 'Moon', et, 'J2000', 'NONE', 'Earth', pos, ltime

         ;;
         ;; Convert the position vector `pos' to cylindrical
         ;; coordinates.
         ;;
         cspice_reccyl, pos, r, clon, z

         ;;
         ;; Convert the cylindrical to rectangular coordinates.
         ;;
         cspice_cylrec, r, clon, z, rectan

         print, ' '
         print, 'Original rectangular coordinates:'
         print, ' '
         print, format='(A,F20.8)', ' X          (km): ', pos[0]
         print, format='(A,F20.8)', ' Y          (km): ', pos[1]
         print, format='(A,F20.8)', ' Z          (km): ', pos[2]
         print, ' '
         print, 'Cylindrical coordinates:'
         print, ' '
         print, format='(A,F20.8)', ' Radius     (km): ', r
         print, format='(A,F20.8)', ' Longitude (deg): ', clon*cspice_dpr( )
         print, format='(A,F20.8)', ' Z          (km): ', z
         print, ' '
         print, 'Rectangular coordinates from cspice_cylrec:'
         print, ' '
         print, format='(A,F20.8)', ' X          (km): ', rectan[0]
         print, format='(A,F20.8)', ' Y          (km): ', rectan[1]
         print, format='(A,F20.8)', ' Z          (km): ', rectan[2]
         print, ' '

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


      Original rectangular coordinates:

       X          (km):      -55658.44323296
       Y          (km):     -379226.32931475
       Z          (km):     -126505.93063865

      Cylindrical coordinates:

       Radius     (km):      383289.01777726
       Longitude (deg):         261.65040211
       Z          (km):     -126505.93063865

      Rectangular coordinates from cspice_cylrec:

       X          (km):      -55658.44323296
       Y          (km):     -379226.32931475
       Z          (km):     -126505.93063865


   2) Create a table showing a variety of cylindrical coordinates
      and the corresponding rectangular coordinates.

      Corresponding rectangular and cylindrical coordinates are
      listed to three decimal places. Input angles are in degrees.


      Example code begins here.


      PRO cylrec_ex2

         ;;
         ;; Define six sets of cylindrical coordinates, `clon'
         ;; expressed in degrees.
         ;;
         r     = [ 1.d,  1.d,   1.d,   1.d,   0.d,  0.d ]
         clon  = [ 0.d, 90.d, 180.d, 180.d, 180.d, 33.d ]
         z     = [ 0.d,  0.d,   1.d,  -1.d,   1.d,  0.d ]

         ;;
         ;; Print a header for the data output.
         ;;
         print, '     r       clon      z   ', $
                '  rect[0]  rect[1]  rect[2]'
         print, '  -------  -------  -------', $
                '  -------  -------  ------- '

         ;;
         ;; Convert the longitudes to radians.
         ;;
         lonc_rads = clon * cspice_rpd()

         ;;
         ;; ..convert the cylindrical coordinates to rectangular
         ;; coordinates
         ;;
         cspice_cylrec, r, lonc_rads, z, rectan

         ;;
         ;; Load the data for easy output.
         ;;
         output      = dblarr( 6, 6 )
         output(0,*) = r
         output(1,*) = clon
         output(2,*) = z
         output(3,*) = rectan[0,*]
         output(4,*) = rectan[1,*]
         output(5,*) = rectan[2,*]

         ;;
         ;; Output the coordinate table.
         ;;
         print, FORMAT='(6D9.3)', output

      END


      When this program was executed on a Mac/Intel/IDL8.x/64-bit
      platform, the output was:


           r       clon      z     rect[0]  rect[1]  rect[2]
        -------  -------  -------  -------  -------  -------
          1.000    0.000    0.000    1.000    0.000    0.000
          1.000   90.000    0.000    0.000    1.000    0.000
          1.000  180.000    1.000   -1.000    0.000    1.000
          1.000  180.000   -1.000   -1.000    0.000   -1.000
          0.000  180.000    1.000   -0.000    0.000    1.000
          0.000   33.000    0.000    0.000    0.000    0.000


Particulars


   This routine transforms the coordinates of a point from
   cylindrical to rectangular coordinates.

Exceptions


   1)  If any of the input arguments, `r', `clon' or `z', is
       undefined, an error is signaled by the IDL error handling
       system.

   2)  If any of the input arguments, `r', `clon' or `z', is not of
       the expected type, or it does not have the expected dimensions
       and size, an error is signaled by the Icy interface.

   3)  If the input vectorizable arguments `r', `clon' and `z' do not
       have the same measure of vectorization (N), an error is
       signaled by the Icy interface.

   4)  If the output argument `rectan' is not a named variable, an
       error is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   None.

Author_and_Institution


   J. Diaz del Rio     (ODC Space)
   E.D. Wright         (JPL)

Version


   -Icy Version 1.2.0, 10-AUG-2021 (JDR)

       Edited the -Examples section to comply with NAIF standard.
       Added complete code examples.

       Changed the input argument name "lonc" to "clon" for
       consistency with other routines.

       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.1.1, 05-FEB-2008 (EDW)

       Edited -I/O section, replaced comment

          "returns with the same order"

       with

          "returns with the same measure of vectorization"

   -Icy Version 1.1.0, 12-SEP-2004 (EDW)

       Added capability to process vectors 'r', 'lonc', and 'z'
       as input, returning array 'rectan' on output.

   -Icy Version 1.0.0, 16-JUN-2003 (EDW)

Index_Entries


   cylindrical to rectangular



Fri Dec 31 18:43:02 2021