|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.starlink.ttools.func.CoordsDegrees
public class CoordsDegrees
Functions for angle transformations and manipulations, with angles generally in degrees. In particular, methods for translating between degrees and HH:MM:SS.S or DDD:MM:SS.S type sexagesimal representations are provided.
Method Summary | |
---|---|
static String |
degreesToDms(double deg)
Converts an angle in degrees to a formatted degrees:minutes:seconds string. |
static String |
degreesToDms(double deg,
int secFig)
Converts an angle in degrees to a formatted degrees:minutes:seconds string with a given number of decimal places in the seconds field. |
static String |
degreesToHms(double deg)
Converts an angle in degrees to a formatted hours:minutes:seconds string. |
static String |
degreesToHms(double deg,
int secFig)
Converts an angle in degrees to a formatted hours:minutes:seconds string with a given number of decimal places in the seconds field. |
static double |
dmsToDegrees(double deg,
double min,
double sec)
Converts degrees, minutes, seconds to an angle in degrees. |
static double |
dmsToDegrees(String dms)
Converts a formatted degrees:minutes:seconds string to an angle in degrees. |
static double |
hmsToDegrees(double hour,
double min,
double sec)
Converts hours, minutes, seconds to an angle in degrees. |
static double |
hmsToDegrees(String hms)
Converts a formatted hours:minutes:seconds string to an angle in degrees. |
static double |
polarDistanceDegrees(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 |
posAngDegrees(double ra1,
double dec1,
double ra2,
double dec2)
Calculates the position angle between two points on the sky in degrees. |
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 |
Method Detail |
---|
public static String degreesToDms(double deg)
deg
- angle in degrees
deg
public static String degreesToDms(double deg, int secFig)
deg
- angle in degreessecFig
- number of decimal places in the seconds field
deg
public static String degreesToHms(double deg)
deg
- angle in degrees
deg
public static String degreesToHms(double deg, int secFig)
deg
- angle in degreessecFig
- number of decimal places in the seconds field
deg
public static double dmsToDegrees(String dms)
dm[s]
, or some others.
Additional spaces and leading +/- are permitted.
The :seconds part is optional.
dms
- formatted DMS string
dms
NumberFormatException
- if dms
can't be parsed as
a degrees:minutes:seconds stringpublic static double hmsToDegrees(String hms)
hm[s]
, or some others.
Additional spaces and leading +/- are permitted.
The :seconds part is optional.
hms
- formatted HMS string
hms
NumberFormatException
- if dms
can't be parsed as
an hours:minutes:seconds stringpublic static double dmsToDegrees(double deg, double min, double sec)
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.
deg
- degrees part of anglemin
- minutes part of anglesec
- seconds part of angle
IllegalArgumentException
- if an argument after the first
non-zero one is negativepublic static double hmsToDegrees(double hour, double min, double sec)
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).
hour
- degrees part of anglemin
- minutes part of anglesec
- seconds part of angle
IllegalArgumentException
- if an argument after the first
non-zero one is negativepublic static double skyDistanceDegrees(double ra1, double dec1, double ra2, double dec2)
ra1
- right ascension of point 1 in degreesdec1
- declination of point 1 in degreesra2
- right ascension of point 2 in degreesdec2
- declination of point 2 in degrees
public static double posAngDegrees(double ra1, double dec1, double ra2, double dec2)
ra1
- right ascension of point 1 in degreesdec1
- declination of point 1 in degreesra2
- right ascension of point 2 in degreesdec2
- declination of point 2 in degrees
public static double polarDistanceDegrees(double ra1, double dec1, double radius1, double ra2, double dec2, double radius2)
ra1
- right ascension of point 1 in degreesdec1
- declination of point1 in degreesradius1
- distance from origin of point1ra2
- right ascension of point 2 in degreesdec2
- declination of point2 in degreesradius2
- distance from origin of point2
radius1
and radius2
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |