sphrec_c

 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 sphrec_c ( SpiceDouble    r,
SpiceDouble    colat,
SpiceDouble    lon,
SpiceDouble    rectan )

```

#### Abstract

```
Convert from spherical coordinates to rectangular coordinates.
```

```
None.
```

#### Keywords

```
CONVERSION,  COORDINATES

```

#### Brief_I/O

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

#### Detailed_Input

```
r          Distance of the point from the origin.

colat      Angle between the point and the positive z-axis in

lon        Angle of the projection of the point to the XY plane from
the positive X-axis in radians. The positive Y-axis is
```

#### Detailed_Output

```
rectan     The rectangular coordinates of a point.
```

```
None.
```

```
Error free.
```

```
None.
```

#### Particulars

```
This routine returns the rectangular coordinates of a point
whose position is input in spherical 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.  The co-latitude of the positive Z-axis is
zero.  The longitude of the posive Y-axis is PI/2 radians.
```

#### Examples

```
Below are two tables.

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

The result of the code fragment

Use the CSPICE routine convrt_c to convert the angular

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

sphrec_c ( r, colat,  lon, X )

are listed in the second parallel table under X(1), X(2) and X(3).

r          colat      lon            X(1)       X(2)     X(3)
----------------------------         --------------------------
0.0000     0.0000     0.0000         0.0000     0.0000   0.0000
1.0000    90.0000     0.0000         1.0000     0.0000   0.0000
1.0000    90.0000    90.0000         0.0000     1.0000   0.0000
1.0000     0.0000     0.0000         0.0000     0.0000   1.0000
1.0000    90.0000   180.0000        -1.0000     0.0000   0.0000
1.0000    90.0000   -90.0000         0.0000    -1.0000   0.0000
1.0000   180.0000     0.0000         0.0000     0.0000  -1.0000
1.4142    90.0000    45.0000         1.0000     1.0000   0.0000
1.4142    45.0000     0.0000         1.0000     0.0000   1.0000
1.4142    45.0000    90.0000         0.0000     1.0000   1.0000
1.7320    54.7356    45.0000         1.0000     1.0000   1.0000

```

```
None.
```

```
None.
```

#### Author_and_Institution

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

#### Version

```
-CSPICE Version 1.0.1, 26-JUL-2016 (BVS)

```
`Wed Apr  5 17:54:43 2017`