void recsph_c ( ConstSpiceDouble rectan[3],
SpiceDouble * r,
SpiceDouble * colat,
SpiceDouble * lon )
Convert from rectangular coordinates to spherical coordinates.
None.
CONVERSION, COORDINATES
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.
rectan The rectangular coordinates of a point.
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].
None.
Error free.
None.
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.
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
None.
None.
W.L. Taber (JPL)
E.D. Wright (JPL)
-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)
rectangular to spherical coordinates
Link to routine recsph_c source file recsph_c.c
|