public class CoordsDegrees extends Object
Modifier and Type | Method and Description |
---|---|
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.
|
public static String degreesToDms(double deg)
deg
- angle in degreesdeg
public static String degreesToDms(double deg, int secFig)
deg
- angle in degreessecFig
- number of decimal places in the seconds fielddeg
public static String degreesToHms(double deg)
deg
- angle in degreesdeg
public static String degreesToHms(double deg, int secFig)
deg
- angle in degreessecFig
- number of decimal places in the seconds fielddeg
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 stringdms
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 stringhms
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 angleIllegalArgumentException
- 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 angleIllegalArgumentException
- 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 degreespublic 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 degreespublic 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 point2radius1
and radius2
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.