ANGUNITVEC
Name
ANGUNITVEC
Author
Craig B. Markwardt, NASA/GSFC Code 662, Greenbelt, MD 20770
[email protected]
UPDATED VERSIONs can be found on my WEB PAGE:
http://cow.physics.wisc.edu/~craigm/idl/idl.html
Purpose
Convert longitude and (co)latitude (RA/Dec) to unit vector
Major Topics
Geometry
Calling Sequence
U = ANGUNITVEC(LON, LAT, [/DEC])
Description
The function ANGUNITVEC converts spherical polar angles into a
unit vector.
The inputs, LON and LAT, describes a point in spherical polar
coordinates on the unit sphere. The output is that point as a
unit 3-vector.
LON is the longitude angle, measured in degrees from +X, with
positive angles rotating through +Y. The range of LON is
0 (+X) through 90 (+Y) through 360.
If DEC=0, LAT represents a colatitude angle, measured in
degrees from +Z. The range of LAT is 0 (+Z) through
180 (-Z).
If DEC=1, LAT represents a latitude angle ("declination"
in astronomy), measured in degrees from the XY equator (positive
toward +Z). The range of LAT is -90 (-Z) through +90 (+Z).
ANGUNITVEC and UNITVECANG are functional inverses.
UNITVECANG(ANGUNITVEC(LON,LAT)) should produce the same LONLAT
pairs.
Inputs
LON - input longitude values, scalar or vector. See above.
LAT - input (co)latitude, scalar or vector. See above.
Returns
The resulting unit vector, either a 3-vector or a 3xN array for N
unit vectors.
Keyword Parameters
DEC - if set, then the input LONLAT(1,*) component is latitude;
if not set then LONLAT(1,*) is a colatitude.
Example
print, angunitvec([157.65924,80.052155])
==> [-9.1103345E-01,3.7439942E-01,1.7275169E-01]
(compare to example in UNITVECANG)
See Also
UNITVECANG, ANGUNITVEC, CROSSP, QTNORMALIZE
Modification History
Written, 1999, CM
Documented, 2012-10-02, CM
$Id: angunitvec.pro,v 1.2 2012/10/02 12:28:13 cmarkwar Exp $