angulardistance


This IDL facility computes the angular distance (in RADIANS) between pairs of vectors.

Location in HEALPix directory tree: src/idl/toolkit/angulardistance.pro 


FORMAT

IDL> distance=angulardistance(V, W, [/HELP])


QUALIFIERS

V
3D-vector (of shape (3) or (1,3)) or list of n 3D-vectors (of shape (n,3))
W
3D-vector (of shape (3) or (1,3)) or list of n 3D-vectors (of shape (n,3))
It is not necessary for V and W vectors to be normalised to 1 upon calling the function
If V (and/or W) has the form (n,3,4) (like the pixel corners returned by pix2vec_*), it should be preprocessed with V = reform( transpose(V, [0,2,1]), n_elements(V)/3, 3) before being passed to angulardistance.


KEYWORDS

/HELP
if set, prints out the help header and exits


DESCRIPTION

After renormalizing the vectors, angulardistance computes the angular distance using $\cos^{-1}(\ensuremath{\bf V}.\ensuremath{\bf W})$ in general, or $2 \sin^{-1}\left(\vert\vert\ensuremath{\bf V}-\ensuremath{\bf W}\vert\vert\right)/2$ when $\ensuremath{\bf V}$ and $\ensuremath{\bf W}$ are almost aligned.
If $\ensuremath{\bf V}$ (resp. $\ensuremath{\bf W}$) is a single vector, while $\ensuremath{\bf W}$ (resp. $\ensuremath{\bf W}$) is a list of vectors, then the result is a list of distances $d_i = {\rm dist}(\ensuremath{\bf V},{\ensuremath{\bf W}}_i)$ (resp. $d_i = {\rm dist}({\ensuremath{\bf V}}_i,{\ensuremath{\bf W}})$).
If both $\ensuremath{\bf V}$ and $\ensuremath{\bf W}$ are lists of vector of the same length, then the result is a list of distances $d_i = {\rm dist}({\ensuremath{\bf V}}_i,{\ensuremath{\bf W}}_i)$.


RELATED ROUTINES

This section lists the routines related to angulardistance

idl
version 6.4 or more is necessary to run angulardistance.


EXAMPLE:

nside=8
pix2vec_ring, nside, lindgen(nside2npix(nside)), vpix
mollview, angulardistance( vpix, [1,1,1])
will plot the angular distance between the Healpix pixels center for $N_{\rm side}=8$ , and the vector $(x,y,z) = (1,1,1)/\sqrt{3}$

Version 3.31, 2017-01-06