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_recgeo

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


Abstract


   CSPICE_RECGEO converts rectangular coordinates to geodetic
   coordinates.

I/O


   Given:

      rectan   the rectangular coordinates of a point, or an N-vector
               of coordinates.

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

               `rectan' must be in the same units as `re'.

      re       the equatorial radius of a reference spheroid.

               help, re
                  DOUBLE = Scalar

               This spheroid is a volume of revolution: its horizontal cross
               sections are circular. The shape of the spheroid is defined by
               an equatorial radius `re' and a polar radius `rp'. `re' must be
               in the same units as `rectan'.

      f        the flattening coefficient = (re-rp) / re, where `rp' is the
               polar radius of the spheroid.

               help, f
                  DOUBLE = Scalar

   the call:

      cspice_recgeo, rectan, re, f, lon, lat, alt

   returns:

      lon      the geodetic longitude of the input point, or an N-vector
               of longitudes.

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

               This is the angle between the prime meridian and the meridian
               containing `rectan'. The direction of increasing longitude is
               from the +X axis towards the +Y axis.

               `lon' is output in radians. The range of `lon' is [-pi, pi].

      lat      the geodetic latitude of the input point, or an N-vector
               of latitudes.

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

               For a point P on the reference spheroid, this is the angle
               between the XY plane and the outward normal vector at P. For a
               point P not on the reference spheroid, the geodetic latitude is
               that of the closest point to P on the spheroid.

               `lat' is output in radians. The range of `lat' is
               [-pi/2, pi/2].

      alt      the altitude of point above the reference spheroid, or an
               N-vector of altitudes.

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

               The units associated with `alt' are those associated with
               the inputs `rectan' and `re'.

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) Find the geodetic coordinates of the point having Earth
      rectangular coordinates:

         X (km) =  -2541.748162
         Y (km) =   4780.333036
         Z (km) =   3360.428190

      Use the PCK kernel below to load the required triaxial
      ellipsoidal shape model and orientation data for the Earth.

         pck00010.tpc


      Example code begins here.


      PRO recgeo_ex1

         ;;
         ;; Load a PCK file containing a triaxial
         ;; ellipsoidal shape model and orientation
         ;; data for the Earth.
         ;;
         cspice_furnsh, 'pck00010.tpc'

         ;;
         ;; Retrieve the triaxial radii of the earth
         ;;
         cspice_bodvrd, 'EARTH', 'RADII', 3, radii

         ;;
         ;; Calculate the flatness coefficient. Set a bodyfixed
         ;; position.
         ;;
         flat = (radii[0] - radii[2])/radii[0]
         x    = [ -2541.748162d, 4780.333036d, 3360.428190d]

         cspice_recgeo, x, radii[0], flat, lon, lat, alt

         ;;
         ;; Output, convert the angular values to degrees.
         ;;
         print, 'Rectangular coordinates in km (x, y, z)'
         print, FORMAT='(A,3F14.6)', ' ', x
         print, 'Geodetic coordinates in deg and km (lon, lat, alt)'
         print, FORMAT='(A,3F14.6)', ' ', lon *cspice_dpr(),                 $
                                          lat *cspice_dpr(),                 $
                                          alt


         ;;
         ;; It's always good form to unload kernels after use,
         ;; particularly in IDL due to data persistence.
         ;;
         cspice_kclear

      END


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


      Rectangular coordinates in km (x, y, z)
         -2541.748162   4780.333036   3360.428190
      Geodetic coordinates in deg and km (lon, lat, alt)
           118.000000     31.999957      0.001916


   2) Create a table showing a variety of rectangular coordinates
      and the corresponding Earth geodetic coordinates. The
      values are computed using the equatorial radius of the Clark
      66 spheroid and the Clark 66 flattening factor:

         radius: 6378.2064
         flattening factor: 1./294.9787

      Note: the values shown above may not be current or suitable
            for your application.


      Corresponding rectangular and geodetic coordinates are
      listed to three decimal places. Output angles are in degrees.


      Example code begins here.


      PRO recgeo_ex2

         ;;
         ;; Using the equatorial radius of the Clark66 spheroid
         ;; (CLARKR = 6378.2064 km) and the Clark 66 flattening
         ;; factor (CLARKF = 1.0 / 294.9787 ) convert from
         ;; body fixed rectangular coordinates.
         ;;
         CLARKR = 6378.2064d
         CLARKF = 1.d/294.9787d

         x = [ [    0.d,         0.d,         0.d     ], $
               [ 6378.2064d,     0.d,         0.d     ], $
               [    0.d,      6378.2064d,     0.d     ], $
               [    0.d,         0.d,      6378.2064d ], $
               [-6378.2064d,     0.d,         0.d     ], $
               [    0.d,     -6378.2064d,     0.d     ], $
               [    0.d,         0.d,     -6378.2064d ], $
               [ 6378.2064d,  6378.2064d,     0.d     ], $
               [ 6378.2064d,     0.d,      6378.2064d ], $
               [    0.d,      6378.2064d,  6378.2064d ], $
               [ 6378.2064d,  6378.2064d,  6378.2064d ] ]

         cspice_recgeo, x, CLARKR, CLARKF, lon, lat, alt

         ;;
         ;; Output, convert the angular values to degrees.
         ;;
         lon = lon * cspice_dpr()
         lat = lat * cspice_dpr()

         ;;
         ;; Output banner.
         ;;
         print, '  rectan[0]  rectan[1]  rectan[2] ' +                       $
                '   lon      lat       alt'
         print, '  ---------  ---------  --------- ' +                       $
                ' -------  -------  ---------'

         for i = 0, 10 do begin

            print, FORMAT='(3F11.3,$)', x(*,i)
            print, FORMAT='(2F9.3,F11.3)', lon(i), lat(i), alt(i)

         endfor

      END


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


        rectan[0]  rectan[1]  rectan[2]    lon      lat       alt
        ---------  ---------  ---------  -------  -------  ---------
            0.000      0.000      0.000    0.000   90.000  -6356.584
         6378.206      0.000      0.000    0.000    0.000      0.000
            0.000   6378.206      0.000   90.000    0.000      0.000
            0.000      0.000   6378.206    0.000   90.000     21.623
        -6378.206      0.000      0.000  180.000    0.000      0.000
            0.000  -6378.206      0.000  -90.000    0.000      0.000
            0.000      0.000  -6378.206    0.000  -90.000     21.623
         6378.206   6378.206      0.000   45.000    0.000   2641.940
         6378.206      0.000   6378.206    0.000   45.137   2652.768
            0.000   6378.206   6378.206   90.000   45.137   2652.768
         6378.206   6378.206   6378.206   45.000   35.370   4676.389


Particulars


   Given the body-fixed rectangular coordinates of a point, and the
   constants describing the reference spheroid,  this routine
   returns the geodetic coordinates of the point. The body-fixed
   rectangular frame is that having the x-axis pass through the
   0 degree latitude 0 degree longitude point. The y-axis passes
   through the 0 degree latitude 90 degree longitude. The z-axis
   passes through the 90 degree latitude point. For some bodies
   this coordinate system may not be a right-handed coordinate
   system.

Exceptions


   1)  If the equatorial radius is non-positive, the error
       SPICE(VALUEOUTOFRANGE) is signaled by a routine in the call
       tree of this routine.

   2)  If the flattening coefficient is greater than or equal to one,
       the error SPICE(VALUEOUTOFRANGE) is signaled by a routine in
       the call tree of this routine.

   3)  For points inside the reference ellipsoid, the nearest
       point on the ellipsoid to `rectan' may not be unique, so
       latitude may not be well-defined.

   4)  If any of the input arguments, `rectan', `re' or `f', is
       undefined, an error is signaled by the IDL error handling
       system.

   5)  If any of the input arguments, `rectan', `re' or `f', 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, `lon', `lat' or `alt', is not
       a named variable, an error is signaled by the Icy interface.

Files


   None.

Restrictions


   None.

Required_Reading


   ICY.REQ

Literature_References


   [1]  R. Bate, D. Mueller, and J. White, "Fundamentals of
        Astrodynamics," Dover Publications Inc., 1971.

Author_and_Institution


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

Version


   -Icy Version 1.1.3, 01-NOV-2021 (JDR)

       Edited the header to comply with NAIF standard. Split the existing
       code example into two separate examples.

       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.2, 29-SEP-2007 (EDW)

       Replaced the comment fragment in the -I/O section

          "return with the same order"

       with

          "return with the same measure of vectorization"

   -Icy Version 1.1.1, 26-MAY-2005 (EDW)

       Corrected expression of x vector in example, from

          x = [ -2541.748162d, 4780.333036d, 3360.428190]

       to

          x = [ -2541.748162d, 4780.333036d, 3360.428190d]

       Failure to declare the third component double caused an
       incorrect evaluation - the correct evaluation
       changes the 'alt' value from 0.000018 to 0.00000024.

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

       Added capability to process vector 'rectan' as
       input returning vectors 'lon', 'lat', and
       'alt' on output.

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

Index_Entries


   rectangular to geodetic



Fri Dec 31 18:43:06 2021