uk.ac.starlink.ttools.func
Class Coords

java.lang.Object
  extended by uk.ac.starlink.ttools.func.Coords

public class Coords
extends Object

Functions for angle transformations and manipulations. In particular, methods for translating between radians and HH:MM:SS.S or DDD:MM:SS.S type sexagesimal representations are provided.

Since:
30 Apr 2004
Author:
Mark Taylor (Starlink)

Field Summary
static double ARC_MINUTE
          The size of one arcminute in radians.
static double ARC_SECOND
          The size of one arcsecond in radians.
static double DEGREE
          The size of one degree in radians.
static double HOUR
          The size of one hour of right ascension in radians.
 
Method Summary
static double decFK4toFK5(double raFK4, double decFK4)
          Converts a B1950.0 FK4 position to J2000.0 FK5 at an epoch of B1950.0 yielding Declination This assumes zero proper motion in the FK5 frame.
static double decFK4toFK5(double raFK4, double decFK4, double bepoch)
          Converts a B1950.0 FK4 position to J2000.0 FK5 yielding Declination.
static double decFK5toFK4(double raFK5, double decFK5)
          Converts a J2000.0 FK5 position to B1950.0 FK4 at an epoch of B1950.0 yielding Declination.
static double decFK5toFK4(double raFK5, double decFK5, double bepoch)
          Converts a J2000.0 FK5 position to B1950.0 FK4 yielding Declination.
static double degreesToRadians(double deg)
          Converts degrees to radians.
static double dmsToRadians(double deg, double min, double sec)
          Converts degrees, minutes, seconds to an angle in radians.
static double dmsToRadians(String dms)
          Converts a formatted degrees:minutes:seconds string to an angle in radians.
static double hmsToRadians(double hour, double min, double sec)
          Converts hours, minutes, seconds to an angle in radians.
static double hmsToRadians(String hms)
          Converts a formatted hours:minutes:seconds string to an angle in radians.
static double hoursToRadians(double hours)
          Converts hours to radians.
static double radiansToDegrees(double rad)
          Converts radians to degrees.
static String radiansToDms(double rad)
          Converts an angle in radians to a formatted degrees:minutes:seconds string.
static String radiansToDms(double rad, int secFig)
          Converts an angle in radians to a formatted degrees:minutes:seconds string with a given number of decimal places in the seconds field.
static String radiansToHms(double rad)
          Converts an angle in radians to a formatted hours:minutes:seconds string.
static String radiansToHms(double rad, int secFig)
          Converts an angle in radians to a formatted hours:minutes:seconds string with a given number of decimal places in the seconds field.
static double raFK4toFK5(double raFK4, double decFK4)
          Converts a B1950.0 FK4 position to J2000.0 FK5 at an epoch of B1950.0 yielding Right Ascension.
static double raFK4toFK5(double raFK4, double decFK4, double bepoch)
          Converts a B1950.0 FK4 position to J2000.0 FK5 yielding Right Ascension.
static double raFK5toFK4(double raFK5, double decFK5)
          Converts a J2000.0 FK5 position to B1950.0 FK4 at an epoch of B1950.0 yielding Declination.
static double raFK5toFK4(double raFK5, double decFK5, double bepoch)
          Converts a J2000.0 FK5 position to B1950.0 FK4 yielding Declination.
static double skyDistance(double ra1, double dec1, double ra2, double dec2)
          Calculates the separation (distance around a great circle) of two points on the sky.
static double skyDistanceDegrees(double ra1, double dec1, double ra2, double dec2)
          Calculates the separation (distance around a great circle) of two points on the sky in degrees.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEGREE

public static final double DEGREE
The size of one degree in radians.

See Also:
Constant Field Values

HOUR

public static final double HOUR
The size of one hour of right ascension in radians.

See Also:
Constant Field Values

ARC_MINUTE

public static final double ARC_MINUTE
The size of one arcminute in radians.

See Also:
Constant Field Values

ARC_SECOND

public static final double ARC_SECOND
The size of one arcsecond in radians.

See Also:
Constant Field Values
Method Detail

radiansToDms

public static String radiansToDms(double rad)
Converts an angle in radians to a formatted degrees:minutes:seconds string. No fractional part of the seconds field is given.

Parameters:
rad - angle in radians
Returns:
DMS-format string representing rad

radiansToDms

public static String radiansToDms(double rad,
                                  int secFig)
Converts an angle in radians to a formatted degrees:minutes:seconds string with a given number of decimal places in the seconds field.

Parameters:
rad - angle in radians
secFig - number of decimal places in the seconds field
Returns:
HMS-format string representing rad

radiansToHms

public static String radiansToHms(double rad)
Converts an angle in radians to a formatted hours:minutes:seconds string. No fractional part of the seconds field is given.

Parameters:
rad - angle in radians
Returns:
HMS-format string representing rad

radiansToHms

public static String radiansToHms(double rad,
                                  int secFig)
Converts an angle in radians to a formatted hours:minutes:seconds string with a given number of decimal places in the seconds field.

Parameters:
rad - angle in radians
secFig - number of decimal places in the seconds field
Returns:
HMS-format string representing rad

dmsToRadians

public static double dmsToRadians(String dms)
Converts a formatted degrees:minutes:seconds string to an angle in radians. Delimiters may be colon, space, characters dm[s], or some others. Additional spaces and leading +/- are permitted.

Parameters:
dms - formatted DMS string
Returns:
angle in radians specified by dms
Throws:
NumberFormatException - if dms can't be parsed as a degrees:minutes:seconds string

hmsToRadians

public static double hmsToRadians(String hms)
Converts a formatted hours:minutes:seconds string to an angle in radians. Delimiters may be colon, space, characters hm[s], or some others. Additional spaces and leading +/- are permitted.

Parameters:
hms - formatted HMS string
Returns:
angle in radians specified by hms
Throws:
NumberFormatException - if dms can't be parsed as an hours:minutes:seconds string

dmsToRadians

public static double dmsToRadians(double deg,
                                  double min,
                                  double sec)
Converts degrees, minutes, seconds to an angle in radians.

In conversions of this type, one has to be careful to get the sign right in converting angles which are between 0 and -1 degrees. This routine uses the sign bit of the deg argument, taking care to distinguish between +0 and -0 (their internal representations are different for floating point values). It is illegal for the min or sec arguments to be negative.

Parameters:
deg - degrees part of angle
min - minutes part of angle
sec - seconds part of angle
Returns:
specified angle in radians
Throws:
IllegalArgumentException - if an argument after the first non-zero one is negative

hmsToRadians

public static double hmsToRadians(double hour,
                                  double min,
                                  double sec)
Converts hours, minutes, seconds to an angle in radians.

In conversions of this type, one has to be careful to get the sign right in converting angles which are between 0 and -1 hours. This routine uses the sign bit of the hour argument, taking care to distinguish between +0 and -0 (their internal representations are different for floating point values).

Parameters:
hour - degrees part of angle
min - minutes part of angle
sec - seconds part of angle
Returns:
specified angle in radians
Throws:
IllegalArgumentException - if an argument after the first non-zero one is negative

skyDistance

public static double skyDistance(double ra1,
                                 double dec1,
                                 double ra2,
                                 double dec2)
Calculates the separation (distance around a great circle) of two points on the sky.

Parameters:
ra1 - right ascension of point 1 in radians
dec1 - declination of point 1 in radians
ra2 - right ascension of point 2 in radians
dec2 - declination of point 2 in radians
Returns:
angular distance between point 1 and point 2 in radians

skyDistanceDegrees

public static double skyDistanceDegrees(double ra1,
                                        double dec1,
                                        double ra2,
                                        double dec2)
Calculates the separation (distance around a great circle) of two points on the sky in degrees.

Parameters:
ra1 - right ascension of point 1 in degrees
dec1 - declination of point 1 in degrees
ra2 - right ascension of point 2 in degrees
dec2 - declination of point 2 in degrees
Returns:
angular distance between point 1 and point 2 in degrees

hoursToRadians

public static double hoursToRadians(double hours)
Converts hours to radians.

Parameters:
hours - angle in hours
Returns:
angle in radians

degreesToRadians

public static double degreesToRadians(double deg)
Converts degrees to radians.

Parameters:
deg - angle in degrees
Returns:
angle in radians

radiansToDegrees

public static double radiansToDegrees(double rad)
Converts radians to degrees.

Parameters:
rad - angle in radians
Returns:
angle in degrees

raFK4toFK5

public static double raFK4toFK5(double raFK4,
                                double decFK4)
Converts a B1950.0 FK4 position to J2000.0 FK5 at an epoch of B1950.0 yielding Right Ascension. This assumes zero proper motion in the FK5 frame.

Parameters:
raFK4 - right ascension in B1950.0 FK4 system (radians)
decFK4 - declination in B1950.0 FK4 system (radians)
Returns:
right ascension in J2000.0 FK5 system (radians)
See Also:
Pal.Fk45z(uk.ac.starlink.pal.AngleDR, double)

decFK4toFK5

public static double decFK4toFK5(double raFK4,
                                 double decFK4)
Converts a B1950.0 FK4 position to J2000.0 FK5 at an epoch of B1950.0 yielding Declination This assumes zero proper motion in the FK5 frame.

Parameters:
raFK4 - right ascension in B1950.0 FK4 system (radians)
decFK4 - declination in B1950.0 FK4 system (radians)
Returns:
declination in J2000.0 FK5 system (radians)
See Also:
Pal.Fk45z(uk.ac.starlink.pal.AngleDR, double)

raFK5toFK4

public static double raFK5toFK4(double raFK5,
                                double decFK5)
Converts a J2000.0 FK5 position to B1950.0 FK4 at an epoch of B1950.0 yielding Declination. This assumes zero proper motion, parallax and radial velocity in the FK5 frame.

Parameters:
raFK5 - right ascension in J2000.0 FK5 system (radians)
decFK5 - declination in J2000.0 FK5 system (radians)
Returns:
right ascension in the FK4 system (radians)
See Also:
Pal.Fk54z(uk.ac.starlink.pal.AngleDR, double)

decFK5toFK4

public static double decFK5toFK4(double raFK5,
                                 double decFK5)
Converts a J2000.0 FK5 position to B1950.0 FK4 at an epoch of B1950.0 yielding Declination. This assumes zero proper motion, parallax and radial velocity in the FK5 frame.

Parameters:
raFK5 - right ascension in J2000.0 FK5 system (radians)
decFK5 - declination in J2000.0 FK5 system (radians)
Returns:
right ascension in the FK4 system (radians)
See Also:
Pal.Fk54z(uk.ac.starlink.pal.AngleDR, double)

raFK4toFK5

public static double raFK4toFK5(double raFK4,
                                double decFK4,
                                double bepoch)
Converts a B1950.0 FK4 position to J2000.0 FK5 yielding Right Ascension. This assumes zero proper motion in the FK5 frame. The bepoch parameter is the epoch at which the position in the FK4 frame was determined.

Parameters:
raFK4 - right ascension in B1950.0 FK4 system (radians)
decFK4 - declination in B1950.0 FK4 system (radians)
bepoch - Besselian epoch
Returns:
right ascension in J2000.0 FK5 system (radians)
See Also:
Pal.Fk45z(uk.ac.starlink.pal.AngleDR, double)

decFK4toFK5

public static double decFK4toFK5(double raFK4,
                                 double decFK4,
                                 double bepoch)
Converts a B1950.0 FK4 position to J2000.0 FK5 yielding Declination. This assumes zero proper motion in the FK5 frame. The bepoch parameter is the epoch at which the position in the FK4 frame was determined.

Parameters:
raFK4 - right ascension in B1950.0 FK4 system (radians)
decFK4 - declination in B1950.0 FK4 system (radians)
bepoch - Besselian epoch
Returns:
declination in J2000.0 FK5 system (radians)
See Also:
Pal.Fk45z(uk.ac.starlink.pal.AngleDR, double)

raFK5toFK4

public static double raFK5toFK4(double raFK5,
                                double decFK5,
                                double bepoch)
Converts a J2000.0 FK5 position to B1950.0 FK4 yielding Declination. This assumes zero proper motion, parallax and radial velocity in the FK5 frame.

Parameters:
raFK5 - right ascension in J2000.0 FK5 system (radians)
decFK5 - declination in J2000.0 FK5 system (radians)
bepoch - Besselian epoch
Returns:
right ascension in the FK4 system (radians)
See Also:
Pal.Fk54z(uk.ac.starlink.pal.AngleDR, double)

decFK5toFK4

public static double decFK5toFK4(double raFK5,
                                 double decFK5,
                                 double bepoch)
Converts a J2000.0 FK5 position to B1950.0 FK4 yielding Declination. This assumes zero proper motion, parallax and radial velocity in the FK5 frame.

Parameters:
raFK5 - right ascension in J2000.0 FK5 system (radians)
decFK5 - declination in J2000.0 FK5 system (radians)
bepoch - Besselian epoch
Returns:
right ascension in the FK4 system (radians)
See Also:
Pal.Fk54z(uk.ac.starlink.pal.AngleDR, double)


Copyright © 2009 Central Laboratory of the Research Councils. All Rights Reserved.