Learn R Programming

astrolibR (version 0.1)

gcirc: Computes rigorous great circle arc distances between points on the celestial sphere

Description

Computes rigorous great circle arc distances between points on the celestial sphere

Usage

gcirc(u,ra1,dc1,ra2,dc2)

Arguments

u
indicator integer describing units of inputs and outputs: 0: radians 1: Right Ascension in decimal hours, declination in decimal degrees, angular distance in arc seconds 2: Right Ascension and declination in decimal degrees, angular distance in arc seconds
ra1
Right Ascension or longitude of point 1
dc1
declination or latitude of point 1
ra2
Right Ascension or longitude of point 2
dc2
declination or latitude of point 2

Value

dis
angular distance on the sky between points 1 and 2

Details

Input position can be in radians, sexigesimal (R.A., Dec), or decimal degrees. The procedure uses the Haversine forumla http://en.wikipedia.org/wiki/Great-circle_distance. The haversine formula can give rounding errors for antipodal points.

If (ra1,dc1) are scalars and (ra2,dc2) are vectors, then dis is a vector giving the distance of each element of (ra2,dc2) to (ra1,dc1). Similarly, if (ra1,dc1) are vectors and (ra2,dc2) are scalars, then dis is a vector giving the distance of each element of (ra1,dc1) to (ra2,dc2). If both (ra1,dc1) and (ra2,dc2) are vectors then dis is a vector giving the distance of each element of (ra1,dc1) to the corresponding element of (ra2,dc2). If the input vectors are not the same length, then excess elements of the longer ones will be ignored.

The astrolib function sphdist provides an alternate method of computing a spherical distance.

See Also

sphdist

Examples

Run this code
gcirc(2, 100., -35., 180., +35)

Run the code above in your browser using DataLab