void sphrec_c ( SpiceDouble r,
SpiceDouble colat,
SpiceDouble lon,
SpiceDouble rectan[3] )
Convert from spherical coordinates to rectangular coordinates.
None.
CONVERSION, COORDINATES
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.
r Distance of the point from the origin.
colat Angle between the point and the positive z-axis in
radians.
lon Angle of the projection of the point to the XY plane from
the positive X-axis in radians. The positive Y-axis is
at longitude PI/2 radians.
rectan The rectangular coordinates of a point.
None.
Error free.
None.
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.
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
quantities to radians
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.
W.L. Taber (JPL)
E.D. Wright (JPL)
-CSPICE Version 1.0.1, 26-JUL-2016 (BVS)
Minor headers edits.
-CSPICE Version 1.0.0, 08-FEB-1998 (EDW)
spherical to rectangular coordinates
Link to routine sphrec_c source file sphrec_c.c
|