Index Page recsph_c

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

Procedure Abstract Required_Reading Keywords Brief_I/O Detailed_Input | Detailed_Output Parameters Exceptions Files Particulars Examples | Restrictions Literature_References Author_and_Institution Version Index_Entries

#### Procedure

       void recsph_c ( ConstSpiceDouble     rectan[3],
                       SpiceDouble        * r,
                       SpiceDouble        * colat,
                       SpiceDouble        * lon      )

#### Abstract

       Convert from rectangular coordinates to spherical coordinates.

#### Required_Reading

       None.

#### Keywords

       CONVERSION,  COORDINATES

#### Brief_I/O

       VARIABLE  I/O  DESCRIPTION
       --------  ---  --------------------------------------------------
       rectan     I   Rectangular coordinates of a point.
       r          O   Distance of the point from the origin.
       colat      O   Angle of the point from the Z-axis in radians
       lon        O   Longitude of the point in radians.

#### Detailed_Input

       rectan     The rectangular coordinates of a point.

#### Detailed_Output

       r          Distance of the point from the origin.

       colat      Angle between the point and the positive z-axis in
                  radians. The range of `colat' is [0, pi].

       lon        Longitude of the point in radians. This is the angle
                  between the positive X-axis and the orthogonal
                  projection of the point onto the XY plane. `lon'
                  increases in the counterclockwise sense about the
                  positive Z-axis. The range of `lon' is [-pi, pi].

#### Parameters

       None.

#### Exceptions

       Error free.

#### Files

       None.

#### Particulars

       This routine returns the spherical coordinates of a point
       whose position is input in rectangular coordinates.

       spherical coordinates are defined by a distance from a central
       reference point, an angle from a reference meridian, and an angle
       from the z-axis.

#### Examples

       Below are two tables.

       Listed in the first table (under X(1), X(2) and X(3) ) are a
       number of points whose rectangular coordinates are
       taken from the set {-1, 0, 1}.

       The result of the code fragment

            recsph_c ( X, r, colat, lon  )

            Use the CSPICE routine convrt_c to convert the angular
            quantities to degrees

            convrt_c ( colat, "RADIANS", "DEGREES", colat )
            convrt_c (  lon,  "RADIANS", "DEGREES", lon   )

       are listed to 4 decimal places in the second parallel table under
       r (radius), colat (co-latitude), and  lon  (longitude).

         X(1)       X(2)     X(3)        r         colat       lon
         --------------------------      ----------------------------
         0.0000     0.0000   0.0000      0.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    90.0000    90.0000
         0.0000     0.0000   1.0000      1.0000     0.0000     0.0000
        -1.0000     0.0000   0.0000      1.0000    90.0000   180.0000
         0.0000    -1.0000   0.0000      1.0000    90.0000   -90.0000
         0.0000     0.0000  -1.0000      1.0000   180.0000     0.0000
         1.0000     1.0000   0.0000      1.4142    90.0000    45.0000
         1.0000     0.0000   1.0000      1.4142    45.0000     0.0000
         0.0000     1.0000   1.0000      1.4142    45.0000    90.0000
         1.0000     1.0000   1.0000      1.7320    54.7356    45.0000

#### Restrictions

       None.

#### Literature_References

       None.

#### Author_and_Institution

       W.L. Taber      (JPL)
       E.D. Wright     (JPL)

#### Version

       -CSPICE Version 1.1.2, 26-JUL-2016 (BVS)

          Minor headers edits.

       -CSPICE Version 1.1.1, 07-JAN-2002 (NJB) (EDW)

          Fixed description of lon in Brief_I/O and Detailed_I/O
          header sections.

       -CSPICE Version 1.1.0, 22-OCT-1998 (NJB)

          Made input coordinate array const.

       -CSPICE Version 1.0.0, 08-FEB-1998 (EDW)

#### Index_Entries

       rectangular to spherical coordinates

#### Link to routine recsph_c source file recsph_c.c

    Wed Apr  5 17:54:41 2017