Index Page
cspice_georec
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_GEOREC converts geodetic coordinates to rectangular
   coordinates.

I/O


   Given:

       lon   the value(s) describing the geodetic longitude measured
             in radians.

             [1,n] = size(lon); double = class(lon)

       lat   the value(s) describing the geodetic latitude measured
             in radians.

             [1,n] = size(lat); double = class(lat)

       alt   the value(s) describing the altitude above the reference
             spheroid.

             [1,n] = size(alt); double = class(alt)

       re    the equatorial radius of the body of interest.

             [1,1] = size(re); double = class(re)

       f     the flattening coefficient of the body, a dimensionless
             value defined as:

                    equatorial_radius - polar_radius
                    --------------------------------
                           equatorial_radius

             [1,n] = size(f); double = class(f)

   the call:

      rectan = cspice_georec( lon, lat, alt, re, f)

   returns:

      rectan   the array(s) containing the rectangular coordinates of the
               position or set of positions.

               [3,n] = size(rectan); double = class(rectan)

               'rectan' returns with the same units associated with
               'alt' and 're'

               'rectan' returns with the same vectorization measure,
               n, as 'lon', 'lat', and 'alt'

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.

      %
      % Load the standard kernel set.
      %
      cspice_furnsh( 'standard.tm' )

      %
      % Retrieve the triaxial radii of the earth
      %
      radii = cspice_bodvrd( 'EARTH', 'RADII', 3 );

      %
      % Calculate the flatness coefficient.
      %
      flat = (radii(1) - radii(3))/radii(1);

      %
      % Set a latitude,
      % longitude, altitude coordinate at 118 west,
      % 32 North, 0 altitude (convert the angular measures
      % to radians).
      %
      lon  = 118. * cspice_rpd;
      lat  = 32.  * cspice_rpd;
      alt  = 0.;

      x = cspice_georec( lon, lat, alt, radii(1), flat );

      disp( 'Scalar:' )
      txt = sprintf( '%14.6f   %14.6f   %14.6f', x );
      disp( txt )

      disp( ' ' )

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

      %
      % Define a vector of scalar longitudes, latitudes, and altitudes.
      % This is a vector of scalars (1xN), NOT the same as an N-vector (Nx1).
      %
      lon = [  0., ...
               0., ...
              90., ...
               0., ...
             180., ...
             -90., ...
               0., ...
              45., ...
               0., ...
              90., ...
              45. ];

      lat = [ 90.      , ...
              88.677225, ...
              88.677225, ...
              90.      , ...
              88.677225, ...
              88.677225, ...
              -90.     , ...
              88.129144, ...
              88.707084, ...
              88.707084, ...
              88.171393 ];

      alt = [ -6356.5838  , ...
              -6356.572258, ...
              -6356.572258, ...
              -6355.5838,   ...
              -6356.572258, ...
              -6356.572258, ...
              -6355.5838,   ...
              -6356.560715, ...
              -6355.572518, ...
              -6355.572518, ...
              -6355.561236  ];

      %
      % Convert angular measures to radians.
      %
      lon = lon*cspice_rpd;
      lat = lat*cspice_rpd;

      %
      % Calculate then output the rectangular coordinates.
      %
      x = cspice_georec( lon, lat, alt, CLARKR, CLARKF);

      disp( 'Vector:' )

      %
      % Create an array of values for output.
      %
      output = [  x(1,:);  x(2,:);  x(3,:) ];
      txt    = sprintf( '%14.6f   %14.6f   %14.6f\n', output);
      disp( txt )

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

   MATLAB outputs:

      Scalar:
        -2541.748162      4780.333036      3360.428190

      Vector:
            0.000000         0.000000         0.000000
            1.000000         0.000000        -0.000000
            0.000000         1.000000        -0.000000
            0.000000         0.000000         1.000000
           -1.000000         0.000000        -0.000000
            0.000000        -1.000000        -0.000000
            0.000000         0.000000        -1.000000
            1.000000         1.000000         0.000000
            1.000000         0.000000         1.000000
            0.000000         1.000000         1.000000
            1.000000         1.000000         1.000000

Particulars


   None.

Required Reading


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

   MICE.REQ

Version


   -Mice Version 1.0.1, 06-NOV-2014, EDW (JPL)

       Edited I/O section to conform to NAIF standard for Mice documentation.

   -Mice Version 1.0.0, 22-NOV-2005, EDW (JPL)

Index_Entries


   geodetic to rectangular coordinates


Wed Apr  5 18:00:31 2017