CalcSphAngle


The CalcSphAngle function calculates the angle between two points on a sphere.

Syntax

nAngle = CalcSphAngle( nLong1, nLat1, nLong2, nLat2 )

where

    nLong1, nLat1 are longitude and latitude of point 1, in degrees.

    nLong2, nLat2 are longitude and latitude of point 2, in degrees.

    nAngle is the spherical distance between points 1 and 2, in degrees.

  

All quantities are specified in units of decimal degrees, such as 45.2243. If computing the distance between two positions on the celestial sphere, in which the longitude is actually Right Ascension in units of Hours, be sure to first convert the Right Ascension of each point to units of degrees.

Example

The following script computes the angle between two points on a sphere:

nLong1 = 45.443

-- longitude of point 1

nLat1 = -21.5522

-- latitude of point 1

nLong2 = 60.66042

-- longitude of point 2

nLat2 = 25.1211

-- latitude of point 2

dA = CalcSphAngle( nLong1, nLat1, nLong2, nLat2 )

-- compute the angle

Printf("Angle = %.4lf", dA )

-- Result: Angle = 48.9566

Related Topics

CalcLST

CalcAirmass