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_drdsph

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


Abstract


   CSPICE_DRDSPH computes the Jacobian matrix of the transformation from
   spherical to rectangular coordinates.

I/O


   Given:

      r        scalar double precision describing the distance of a point from
               the origin.

               help, r
                  DOUBLE = Scalar

      colat    scalar double precision describing the angle between the point
               and the positive Z-axis, in radians.

               help, colat
                  DOUBLE = Scalar

      slon     scalar double precision describing the angle of the point
               measured from the XZ plane in radians.

               help, slon
                  DOUBLE = Scalar

               The angle increases in the counterclockwise sense about the +Z
               axis.

   the call:

      cspice_drdsph, r, colat, slon, jacobi

   returns:

      jacobi   double precision 3x3 matrix describing the matrix of partial
               derivatives of the conversion between spherical and rectangular
               coordinates, evaluated at the input coordinates.

               help, jacobi
                  DOUBLE = Array[3,3]

               This matrix has the form

                  .-                                  -.
                  |  dx/dr     dx/dcolat     dx/dslon  |
                  |                                    |
                  |  dy/dr     dy/dcolat     dy/dslon  |
                  |                                    |
                  |  dz/dr     dz/dcolat     dz/dslon  |
                  `-                                  -'

               evaluated at the input values of `r', `slon', and `colat'.
               Here `x', `y', and `z' are given by the familiar formulae

                  x = r*cos(slon)*sin(colat)
                  y = r*sin(slon)*sin(colat)
                  z = r*cos(colat)

Parameters


   None.

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.

   1) Find the spherical state of the Earth as seen from
      Mars in the IAU_MARS reference frame at January 1, 2005 TDB.
      Map this state back to rectangular coordinates as a check.

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


         KPL/MK

         File name: drdsph_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
            pck00010.tpc                  Planet orientation and
                                          radii
            naif0009.tls                  Leapseconds


         \begindata

            KERNELS_TO_LOAD = ( 'de421.bsp',
                                'pck00010.tpc',
                                'naif0009.tls'  )

         \begintext

         End of meta-kernel


      Example code begins here.


      PRO drdsph_ex1

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

         ;;
         ;; Look up the apparent state of earth as seen from Mars
         ;; at January 1, 2005 TDB, relative to the IAU_MARS reference
         ;; frame.
         ;;
         cspice_str2et, 'January 1, 2005 TDB', et

         cspice_spkezr, 'Earth', et, 'IAU_MARS', 'LT+S', 'Mars', state, ltime

         ;;
         ;; Convert position to spherical coordinates.
         ;;
         cspice_recsph, state[0:2], r, colat, slon

         ;;
         ;; Convert velocity to spherical coordinates.
         ;;
         cspice_dsphdr, state[0], state[1], state[2], jacobi

         cspice_mxv, jacobi, state[3:5], sphvel

         ;;
         ;; As a check, convert the spherical state back to
         ;; rectangular coordinates.
         ;;
         cspice_sphrec, r, colat, slon, rectan

         cspice_drdsph, r, colat, slon, jacobi

         cspice_mxv, jacobi, sphvel, drectn

         print, ' '
         print, 'Rectangular coordinates:'
         print, ' '
         print, format='(A,E18.8)', ' X (km)                  = ', state[0]
         print, format='(A,E18.8)', ' Y (km)                  = ', state[1]
         print, format='(A,E18.8)', ' Z (km)                  = ', state[2]
         print, ' '
         print, 'Rectangular velocity:'
         print, ' '
         print, format='(A,E18.8)', ' dX/dt (km/s)            = ', state[3]
         print, format='(A,E18.8)', ' dY/dt (km/s)            = ', state[4]
         print, format='(A,E18.8)', ' dZ/dt (km/s)            = ', state[5]
         print, ' '
         print, 'Spherical coordinates:'
         print, ' '
         print, format='(A,E18.8)', ' Radius     (km)         = ', r
         print, format='(A,E18.8)', ' Colatitude (deg)        = ',           $
                                                           colat/cspice_rpd()
         print, format='(A,E18.8)', ' Longitude  (deg)        = ',           $
                                                            slon/cspice_rpd()
         print, ' '
         print, 'Spherical velocity:'
         print, ' '
         print, format='(A,E18.8)', ' d Radius/dt     (km/s)  = ', sphvel[0]
         print, format='(A,E18.8)', ' d Colatitude/dt (deg/s) = ',           $
                                                       sphvel[1]/cspice_rpd()
         print, format='(A,E18.8)', ' d Longitude/dt  (deg/s) = ',           $
                                                       sphvel[2]/cspice_rpd()
         print, ' '
         print, 'Rectangular coordinates from inverse mapping:'
         print, ' '
         print, format='(A,E18.8)', ' X (km)                  = ', rectan[0]
         print, format='(A,E18.8)', ' Y (km)                  = ', rectan[1]
         print, format='(A,E18.8)', ' Z (km)                  = ', rectan[2]
         print, ' '
         print, 'Rectangular velocity from inverse mapping:'
         print, ' '
         print, format='(A,E18.8)', ' dX/dt (km/s)            = ', drectn[0]
         print, format='(A,E18.8)', ' dY/dt (km/s)            = ', drectn[1]
         print, format='(A,E18.8)', ' dZ/dt (km/s)            = ', drectn[2]
         print, ' '

      END


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


      Rectangular coordinates:

       X (km)                  =    -7.60961826E+07
       Y (km)                  =     3.24363805E+08
       Z (km)                  =     4.74704840E+07

      Rectangular velocity:

       dX/dt (km/s)            =     2.29520749E+04
       dY/dt (km/s)            =     5.37601112E+03
       dZ/dt (km/s)            =    -2.08811490E+01

      Spherical coordinates:

       Radius     (km)         =     3.36535219E+08
       Colatitude (deg)        =     8.18910134E+01
       Longitude  (deg)        =     1.03202903E+02

      Spherical velocity:

       d Radius/dt     (km/s)  =    -1.12116011E+01
       d Colatitude/dt (deg/s) =     3.31899303E-06
       d Longitude/dt  (deg/s) =    -4.05392876E-03

      Rectangular coordinates from inverse mapping:

       X (km)                  =    -7.60961826E+07
       Y (km)                  =     3.24363805E+08
       Z (km)                  =     4.74704840E+07

      Rectangular velocity from inverse mapping:

       dX/dt (km/s)            =     2.29520749E+04
       dY/dt (km/s)            =     5.37601112E+03
       dZ/dt (km/s)            =    -2.08811490E+01


Particulars


   It is often convenient to describe the motion of an object in
   the spherical coordinate system. However, when performing
   vector computations its hard to beat rectangular coordinates.

   To transform states given with respect to spherical coordinates
   to states with respect to rectangular coordinates, one uses
   the Jacobian of the transformation between the two systems.

   Given a state in spherical coordinates

      ( r, colat, slon, dr, dcolat, dslon )

   the velocity in rectangular coordinates is given by the matrix
   equation:
                  t          |                                   t
      (dx, dy, dz)   = jacobi|              * (dr, dcolat, dslon)
                             |(r,colat,slon)

   This routine computes the matrix

            |
      jacobi|
            |(r,colat,slon)

Exceptions


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

   2)  If any of the input arguments, `r', `colat' or `slon', 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 output argument `jacobi' 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.1.0, 01-NOV-2021 (JDR)

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

       Changed the input argument name "lon" to "slon" for consistency
       with other routines.

       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, 11-NOV-2013 (EDW)

Index_Entries


   Jacobian of rectangular w.r.t. spherical coordinates



Fri Dec 31 18:43:03 2021