Table of contents
CSPICE_LATCYL converts from latitudinal coordinates to
cylindrical coordinates.
Given:
radius the distance of a point from the origin.
help, radius
DOUBLE = Scalar
lon the angle of the point from the XZ plane in radians.
help, lon
DOUBLE = Scalar
lat the angle of the point from the XY plane in radians.
help, lat
DOUBLE = Scalar
the call:
cspice_latcyl, radius, lon, lat, r, clon, z
returns:
r the distance of the point from the Z-axis.
help, r
DOUBLE = Scalar
clon the angle of the point from the XZ plane in radians.
help, clon
DOUBLE = Scalar
`clon' is set equal to `lon'.
z the height of the point above the XY plane.
help, z
DOUBLE = Scalar
None.
Any numerical results shown for these examples may differ between
platforms as the results depend on the SPICE kernels used as input
and the machine specific arithmetic implementation.
1) Compute the latitudinal coordinates of the position of the Moon
as seen from the Earth, and convert them to cylindrical and
rectangular coordinates.
Use the meta-kernel shown below to load the required SPICE
kernels.
KPL/MK
File name: latcyl_ex1.tm
This meta-kernel is intended to support operation of SPICE
example programs. The kernels shown here should not be
assumed to contain adequate or correct versions of data
required by SPICE-based user applications.
In order for an application to use this meta-kernel, the
kernels referenced here must be present in the user's
current working directory.
The names and contents of the kernels referenced
by this meta-kernel are as follows:
File name Contents
--------- --------
de421.bsp Planetary ephemeris
naif0012.tls Leapseconds
\begindata
KERNELS_TO_LOAD = ( 'de421.bsp',
'naif0012.tls' )
\begintext
End of meta-kernel
Example code begins here.
PRO latcyl_ex1
;;
;; Load SPK and LSK kernels, use a meta kernel for
;; convenience.
;;
cspice_furnsh, 'latcyl_ex1.tm'
;;
;; Look up the geometric state of the Moon as seen from
;; the Earth at 2017 Mar 20, relative to the J2000
;; reference frame.
;;
cspice_str2et, '2017 Mar 20', et
cspice_spkpos, 'Moon', et, 'J2000', 'NONE', 'Earth', pos, ltime
;;
;; Convert the position vector `pos' to latitudinal
;; coordinates.
;;
cspice_reclat, pos, radius, lon, lat
;;
;; Convert the latitudinal coordinates to cylindrical.
;;
cspice_latcyl, radius, lon, lat, r, clon, z
;;
;; Convert the cylindrical coordinates to rectangular.
;;
cspice_cylrec, r, clon, z, rectan
print, ' '
print, 'Original rectangular coordinates:'
print, ' '
print, format='(A,F20.8)', ' X (km): ', pos[0]
print, format='(A,F20.8)', ' Y (km): ', pos[1]
print, format='(A,F20.8)', ' Z (km): ', pos[2]
print, ' '
print, 'Latitudinal coordinates:'
print, ' '
print, format='(A,F20.8)', ' Radius (km): ', radius
print, format='(A,F20.8)', ' Longitude (deg): ', lon*cspice_dpr( )
print, format='(A,F20.8)', ' Latitude (deg): ', lat*cspice_dpr( )
print, ' '
print, 'Cylindrical coordinates:'
print, ' '
print, format='(A,F20.8)', ' Radius (km): ', r
print, format='(A,F20.8)', ' Longitude (deg): ', clon*cspice_dpr( )
print, format='(A,F20.8)', ' Z (km): ', z
print, ' '
print, 'Rectangular coordinates from cspice_cylrec:'
print, ' '
print, format='(A,F20.8)', ' X (km): ', rectan[0]
print, format='(A,F20.8)', ' Y (km): ', rectan[1]
print, format='(A,F20.8)', ' Z (km): ', rectan[2]
print, ' '
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Original rectangular coordinates:
X (km): -55658.44323296
Y (km): -379226.32931475
Z (km): -126505.93063865
Latitudinal coordinates:
Radius (km): 403626.33912495
Longitude (deg): -98.34959789
Latitude (deg): -18.26566077
Cylindrical coordinates:
Radius (km): 383289.01777726
Longitude (deg): -98.34959789
Z (km): -126505.93063865
Rectangular coordinates from cspice_cylrec:
X (km): -55658.44323296
Y (km): -379226.32931475
Z (km): -126505.93063865
2) Create a table showing a variety of latitudinal coordinates
and the corresponding cylindrical coordinates.
Corresponding latitudinal and cylindrical coordinates are
listed to three decimal places. Input and output angles are
in degrees.
Example code begins here.
PRO latcyl_ex2
;;
;; Define six sets of cylindrical coordinates, `lon' and `lat'
;; expressed in degrees (convert in place to radians).
;;
rad = [ 1.d, 1.d, sqrt(2.d), sqrt(2.d), 1.d, 0.d ]
lon = [ 0.d, 90.d, 180.d, $
180.d, 180.d, 33.d ] * cspice_rpd()
lat = [ 0.d, 0.d, 45.d, $
-45.d, 90.d, 0.d ] * cspice_rpd()
;;
;; Print a header for the data output.
;;
print, ' r clon z ', $
' radius lon lat '
print, ' ------- ------- -------', $
' ------- ------- -------'
;;
;; Loop over each set of coordinates...
;;
for i=0, 5 do begin
;;
;; ..convert the cylindrical coordinates to latitudinal
;; coordinates
;;
cspice_latcyl, rad[i], lon[i], lat[i], r, clon, z
;;
;; ...convert the `clon', `lon' and `lat' values from
;; radians to degrees
;;
cspice_convrt, clon , 'RADIANS', 'DEGREES', clon_degs
cspice_convrt, lon[i], 'RADIANS', 'DEGREES', lon_degs
cspice_convrt, lat[i], 'RADIANS', 'DEGREES', lat_degs
;;
;; Print the input and corresponding output.
;;
print, FORMAT='(6D9.3)', r, clon_degs, z, $
rad[i], lon_degs, lat_degs
endfor
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
r clon z radius lon lat
------- ------- ------- ------- ------- -------
1.000 0.000 0.000 1.000 0.000 0.000
1.000 90.000 0.000 1.000 90.000 0.000
1.000 180.000 1.000 1.414 180.000 45.000
1.000 180.000 -1.000 1.414 180.000 -45.000
0.000 180.000 1.000 1.000 180.000 90.000
0.000 33.000 0.000 0.000 33.000 0.000
3) Other than the obvious conversion between coordinate systems
this routine could be used to obtain the axial projection
from a sphere to a cylinder about the z-axis that contains
the equator of the sphere.
Such a projection is valuable because it preserves the
areas between regions on the sphere and their projections to
the cylinder.
Example code begins here.
PRO latcyl_ex3
;;
;; Define the point whose projection is to be
;; computed.
;;
radius = 100.0
lon = 45.0 * cspice_rpd( )
lat = -12.5 * cspice_rpd( )
;;
;; Convert the latitudinal coordinates to cylindrical.
;;
cspice_latcyl, radius, lon, lat, r, clon, z
print, 'Coordinates of the projected point on cylinder:'
print, ' '
print, format='(A,F23.11)', ' Radius (km): ', r
print, format='(A,F23.11)', ' Longitude (deg): ', $
clon*cspice_dpr( )
print, format='(A,F23.11)', ' Z (km): ', z
END
When this program was executed on a Mac/Intel/IDL8.x/64-bit
platform, the output was:
Coordinates of the projected point on cylinder:
Radius (km): 97.62960071199
Longitude (deg): 45.00000000000
Z (km): -21.64396139381
This routine returns the cylindrical coordinates of a point
whose position is input in latitudinal coordinates.
Latitudinal coordinates are defined by a distance from a central
reference point, an angle from a reference meridian, and an angle
above the equator of a sphere centered at the central reference
point.
1) If any of the input arguments, `radius', `lon' or `lat', is
undefined, an error is signaled by the IDL error handling
system.
2) If any of the input arguments, `radius', `lon' or `lat', is
not of the expected type, or it does not have the expected
dimensions and size, an error is signaled by the Icy
interface.
3) If any of the output arguments, `r', `clon' or `z', is not a
named variable, an error is signaled by the Icy interface.
None.
None.
ICY.REQ
None.
J. Diaz del Rio (ODC Space)
E.D. Wright (JPL)
-Icy Version 1.1.0, 10-AUG-2021 (JDR)
Edited the header to comply with NAIF standard. Added complete code
examples.
Changed the output argument name "lonc" to "clon" for consistency
with other routines.
Added -Parameters, -Exceptions, -Files, -Restrictions,
-Literature_References and -Author_and_Institution sections, and
completed -Particulars section.
Removed reference to the routine's corresponding CSPICE header from
-Abstract section.
Added arguments' type and size information in the -I/O section.
-Icy Version 1.0.1, 09-DEC-2005 (EDW)
Added -Examples section.
-Icy Version 1.0.0, 16-JUN-2003 (EDW)
latitudinal to cylindrical coordinates
|