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_srfrec

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


Abstract


   CSPICE_SRFREC converts planetocentric latitude and longitude of a surface
   point on a specified body to rectangular coordinates.

I/O


   Given:

      body     the NAIF integer code of an extended body on which a surface
               point of interest is located.

               help, body
                  LONG = Scalar

               The body is modeled as a triaxial ellipsoid.

      lon      the 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 the point. The direction of increasing longitude is
               from the +X axis towards the +Y axis.

               Longitude is measured in radians. On input, the
               range of longitude is unrestricted.

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

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

               This is the angle from the XY plane of the ray from the origin
               through the point.

               Latitude is measured in radians. On input, the range
               of latitude is unrestricted.

   the call:

      cspice_srfrec, body, lon, lat, rectan

   returns:

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

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

               Units are the same as those used to define the radii of `body'.
               Normally, these units are km.

               `rectan' returns with the same measure of vectorization (N)
               as `lon' and `lat'.

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 rectangular coordinates of the point

         100 degrees planetocentric longitude
         -35 degrees planetocentric latitude

      on the Earth; then convert these coordinates back to
      latitudinal coordinates. We should be able to recover
      our original longitude and latitude values.

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

         pck00008.tpc


      Example code begins here.


      PRO srfrec_ex1

         ;;
         ;; NAIF ID for our body of interest.
         ;;
         EARTH =  399

         ;;
         ;; Load the kernel pool with a PCK file that contains
         ;; values for the radii of the Earth.
         ;;
         cspice_furnsh, 'pck00008.tpc'

         ;;
         ;; Find `x', the rectangular coordinates of the surface point
         ;; defined by `lat' and `lon'.  The NAIF integer code for
         ;; the Earth is 399. (Reference NAIF_IDS.REQ for the complete
         ;; set of codes.)
         ;;
         lon =  100.d0
         lat =  -35.d0

         print, "Original latitudinal coordinates: "
         print, "  Longitude (deg) = ", lon
         print, "  Latitude  (deg) = ", lat

         print

         ;;
         ;; Convert angles to radians for input to srfrec_c.
         ;;
         cspice_srfrec, EARTH, lon*cspice_rpd(), lat*cspice_rpd(), x

         print, "Rectangular coordinates: "
         print, "  X (km)          = ", x[0]
         print, "  Y (km)          = ", x[1]
         print, "  Z (km)          = ", x[2]

         print

         ;;
         ;;
         ;; Now try to recover the original latitudinal coordinates
         ;; from the rectangular coordinates found by cspice_srfrec.
         ;;
         cspice_reclat, x, radius, lon1, lat1

         ;;
         ;; Convert angles back to degree for display.
         ;;
         print, "Latitudinal coordinates recovered from "
         print, "rectangular coordinates: "
         print, "  Longitude (deg) = ", lon1*cspice_dpr()
         print, "  Latitude  (deg) = ", lat1*cspice_dpr()
         print, "  Radius    (km)  = ", radius

         ;;
         ;; 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:


      Original latitudinal coordinates:
        Longitude (deg) =        100.00000
        Latitude  (deg) =       -35.000000

      Rectangular coordinates:
        X (km)          =       -906.24943
        Y (km)          =        5139.5959
        Z (km)          =       -3654.3008

      Latitudinal coordinates recovered from
      rectangular coordinates:
        Longitude (deg) =        100.00000
        Latitude  (deg) =       -35.000000
        Radius    (km)  =        6371.0791


Particulars


   This routine returns the rectangular coordinates of a surface
   point on an extended body with known radii, where the location
   of the surface point is specified in planetocentric latitudinal
   coordinates.

   Latitudinal coordinates are defined by a distance from a central
   reference point, an angle from a reference meridian, and an angle
   above the equator of a sphere centered at the central reference
   point. In this case, the distance from the central reference
   point is not required as an input because the fact that the
   point is on the body's surface allows one to deduce this quantity.

   Below are two tables that demonstrate by example the relationship
   between rectangular and latitudinal coordinates.

   Listed in the first table (under R, `lon' and `lat') are
   latitudinal coordinate triples that approximately represent
   points whose rectangular coordinates are taken from the set
   {-1, 0, 1}. (Angular quantities are given in degrees.)


        R          lon       lat    rectan[0]   rectan[1]  rectan[2]
       --------------------------   --------------------------------
       0.0000    0.0000    0.0000      0.0000      0.0000     0.0000
       1.0000    0.0000    0.0000      1.0000      0.0000     0.0000
       1.0000   90.0000    0.0000      0.0000      1.0000     0.0000
       1.0000    0.0000   90.0000      0.0000      0.0000     1.0000
       1.0000  180.0000    0.0000     -1.0000      0.0000     0.0000
       1.0000  -90.0000    0.0000      0.0000     -1.0000     0.0000
       1.0000    0.0000  -90.0000      0.0000      0.0000    -1.0000
       1.4142   45.0000    0.0000      1.0000      1.0000     0.0000
       1.4142    0.0000   45.0000      1.0000      0.0000     1.0000
       1.4142   90.0000   45.0000      0.0000      1.0000     1.0000
       1.7320   45.0000   35.2643      1.0000      1.0000     1.0000


   This routine is related to the Icy routine cspice_latrec, which
   accepts a radius, longitude, and latitude as inputs and produces
   equivalent rectangular coordinates as outputs.

Exceptions


   1)  If radii for `body' are not found in the kernel pool, an error
       is signaled by a routine in the call tree of this routine.

   2)  If the size of the `body' body radii kernel variable is not
       three, an error is signaled by a routine in the call tree of
       this routine.

   3)  If any of the three `body' body radii is less-than or equal to
       zero, an error is signaled by a routine in the call tree of
       this routine.

   4)  If any of the input arguments, `body', `lon' or `lat', is
       undefined, an error is signaled by the IDL error handling
       system.

   5)  If any of the input arguments, `body', `lon' or `lat', 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 the input vectorizable arguments `lon' and `lat' do not
       have the same measure of vectorization (N), an error is
       signaled by the Icy interface.

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

Files


   None.

Restrictions


   1)  A PCK text kernel containing the body radius definitions
       required by this routine must be loaded into the kernel
       pool prior to any calls to this routine.

Required_Reading


   ICY.REQ
   KERNEL.REQ
   NAIF_IDS.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)

       Changed argument names "longitude" and "latitude" to "lon" and "lat"
       for consistency with other routines.

       Edited the header to comply with NAIF standard. Modified
       code example output and added call to cspice_kclear.

       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.0.2, 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.0.1, 09-DEC-2005 (EDW)

       Added tag for -Examples section.

   -Icy Version 1.0.0, 31-OCT-2005 (EDW)

Index_Entries


   convert body-fixed latitudinal coordinates to rectangular
   convert surface latitudinal coordinates to rectangular
   surface point latitudinal coordinates to rectangular



Fri Dec 31 18:43:08 2021