Class CoordsRadians

java.lang.Object
uk.ac.starlink.ttools.func.CoordsRadians

public class CoordsRadians extends Object
Functions for angle transformations and manipulations, based on radians rather than degrees. 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

    Fields
    Modifier and Type
    Field
    Description
    static final double
    The size of one arcminute in radians.
    static final double
    The size of one arcsecond in radians.
    static final double
    The size of one degree in radians.
    static final double
    The size of one hour of right ascension in radians.
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    decFK4toFK5radians(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
    decFK4toFK5Radians(double raFK4, double decFK4, double bepoch)
    Converts a B1950.0 FK4 position to J2000.0 FK5 yielding Declination.
    static double
    decFK5toFK4radians(double raFK5, double decFK5)
    Converts a J2000.0 FK5 position to B1950.0 FK4 at an epoch of B1950.0 yielding Declination.
    static double
    decFK5toFK4Radians(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
    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
    Converts a formatted hours:minutes:seconds string to an angle in radians.
    static double
    hoursToRadians(double hours)
    Converts hours to radians.
    static double
    polarDistanceRadians(double ra1, double dec1, double radius1, double ra2, double dec2, double radius2)
    Calculates the distance in three dimensional space between two points specified in spherical polar coordinates.
    static double
    posAngRadians(double ra1, double dec1, double ra2, double dec2)
    Calculates the position angle between two points on the sky in 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
    raFK4toFK5radians(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
    raFK4toFK5Radians(double raFK4, double decFK4, double bepoch)
    Converts a B1950.0 FK4 position to J2000.0 FK5 yielding Right Ascension.
    static double
    raFK5toFK4radians(double raFK5, double decFK5)
    Converts a J2000.0 FK5 position to B1950.0 FK4 at an epoch of B1950.0 yielding Declination.
    static double
    raFK5toFK4Radians(double raFK5, double decFK5, double bepoch)
    Converts a J2000.0 FK5 position to B1950.0 FK4 yielding Declination.
    static double
    skyDistanceRadians(double ra1, double dec1, double ra2, double dec2)
    Calculates the separation (distance around a great circle) of two points on the sky in radians.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • DEGREE_RADIANS

      public static final double DEGREE_RADIANS
      The size of one degree in radians.
      See Also:
    • HOUR_RADIANS

      public static final double HOUR_RADIANS
      The size of one hour of right ascension in radians.
      See Also:
    • ARC_MINUTE_RADIANS

      public static final double ARC_MINUTE_RADIANS
      The size of one arcminute in radians.
      See Also:
    • ARC_SECOND_RADIANS

      public static final double ARC_SECOND_RADIANS
      The size of one arcsecond in radians.
      See Also:
  • Method Details

    • 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:
      DMS-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. The :seconds part is optional.
      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. The :seconds part is optional.
      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
    • skyDistanceRadians

      public static double skyDistanceRadians(double ra1, double dec1, double ra2, double dec2)
      Calculates the separation (distance around a great circle) of two points on the sky in radians.
      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
    • posAngRadians

      public static double posAngRadians(double ra1, double dec1, double ra2, double dec2)
      Calculates the position angle between two points on the sky in radians. The result is in the range +/-pi. If point 2 is due east of point 1, the result is +pi/2. Zero is returned if the points are coincident.
      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:
      bearing in radians of point 2 from point 1
    • polarDistanceRadians

      public static double polarDistanceRadians(double ra1, double dec1, double radius1, double ra2, double dec2, double radius2)
      Calculates the distance in three dimensional space between two points specified in spherical polar coordinates.
      Parameters:
      ra1 - right ascension of point 1 in radians
      dec1 - declination of point1 in radians
      radius1 - distance from origin of point1
      ra2 - right ascension of point 2 in radians
      dec2 - declination of point2 in radians
      radius2 - distance from origin of point2
      Returns:
      the linear distance between point1 and point2; units are as for radius1 and radius2
    • 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
    • raFK4toFK5radians

      public static double raFK4toFK5radians(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)
    • decFK4toFK5radians

      public static double decFK4toFK5radians(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)
    • raFK5toFK4radians

      public static double raFK5toFK4radians(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)
    • decFK5toFK4radians

      public static double decFK5toFK4radians(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)
    • raFK4toFK5Radians

      public static double raFK4toFK5Radians(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)
    • decFK4toFK5Radians

      public static double decFK4toFK5Radians(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)
    • raFK5toFK4Radians

      public static double raFK5toFK4Radians(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)
    • decFK5toFK4Radians

      public static double decFK5toFK4Radians(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)