public class WorldCoords extends Object implements WorldCoordinates, Serializable
Modifier and Type | Field and Description |
---|---|
protected DMS |
dec
The DEC coordinate
|
protected HMS |
ra
The RA coordinate
|
Constructor and Description |
---|
WorldCoords()
Default constructor: initialize null coordinates.
|
WorldCoords(double ra,
double dec)
Initialize from ra and dec (in degrees J2000).
|
WorldCoords(Double ra,
Double dec)
Initialize from ra and dec (in degrees J2000).
|
WorldCoords(double ra,
double dec,
double equinox)
Initialize from ra and dec (in degrees).
|
WorldCoords(Double ra,
Double dec,
double equinox)
Initialize from ra and dec (in degrees).
|
WorldCoords(double rh,
int rm,
double rs,
double dd,
int dm,
double ds)
Initialize from RA hours, minutes, seconds and and DEC degress, minutes, seconds
in J2000.
|
WorldCoords(double rh,
int rm,
double rs,
double dd,
int dm,
double ds,
double equinox)
Initialize from RA hours, minutes, seconds and and DEC degress, minutes, seconds.
|
WorldCoords(HMS ra,
DMS dec)
Initialize from ra (hours) and dec (degrees) in J2000.
|
WorldCoords(HMS ra,
DMS dec,
double equinox)
Initialize from ra (hours) and dec (degrees).
|
WorldCoords(Point2D.Double p)
Initialize from an ra, dec point (in degrees J2000).
|
WorldCoords(Point2D.Double p,
double equinox)
Initialize from an ra, dec point in the given equinox.
|
WorldCoords(String ra,
String dec)
Parse RA and DEC in string format (assume J2000).
|
WorldCoords(String ra,
String dec,
boolean hflag)
Parse RA and DEC in string format (assume J2000).
|
WorldCoords(String ra,
String dec,
double equinox)
Parse RA and DEC in string format.
|
WorldCoords(String ra,
String dec,
double equinox,
boolean hflag)
Parse RA and DEC in string format.
|
Modifier and Type | Method and Description |
---|---|
WorldCoordinates[] |
box(double radius)
Given a radius in arcmin, return an array {pos1, pos2} with the 2 endpoints
that form a box with center at "this" position.
|
double[] |
center(WorldCoordinates pos1,
WorldCoordinates pos2)
Given the endpoints of a box (pos1, pos2), return an array containing the
center ra, dec in degrees, as well as the width, height, and radius of the
box in arcmin.
|
static double[] |
dispos(double dra0,
double decd0,
double dra,
double decd)
Computes distance and position angle solving a spherical
triangle (no approximations).
|
double[] |
dispos(WorldCoordinates pos)
return the distance between this position and the given one in arcmin
and also set the position angle
|
double |
dist(Coordinates pos)
Return the distance between this position and the given one in arcmin.
|
static double |
dist(double ra0,
double dec0,
double ra1,
double dec1)
static member to get the distance between 2 points in arcmin
|
double |
dist(WorldCoords pos)
Return the distance between this position and the given one in arcmin.
|
String[] |
format()
Format RA and DEC in h:m:s [+-]d:m:s format in J2000
and return them as a 2 element String array.
|
String[] |
format(double equinox)
Format RA and DEC in h:m:s [+-]d:m:s format in the given equinox
and return them as a 2 element String array.
|
String |
getCoordinateSystemName()
Returns the name of the coordinate system as a string.
|
DMS |
getDec()
return the DEC value
|
double |
getDecDeg()
return the DEC value in deg
|
HMS |
getRA()
return the RA value
|
double[] |
getRaDec(double equinox)
Return RA and DEC in degrees as an array of 2 doubles {ra, dec} in the given equinox.
|
double |
getRaDeg()
return the RA value in deg
|
double |
getX()
return the X (ra) coordinate in deg
|
double |
getY()
return the Y *dec) coordinate in deg
|
static void |
main(String[] args)
Test cases
|
String |
toString()
Return the coordinates as a string in h:m:s [+-]d:m:s format
|
static double |
wcsdist(double x1,
double y1,
double x2,
double y2)
Compute the distance in degrees between the two given coordinates.
|
public WorldCoords()
public WorldCoords(HMS ra, DMS dec, double equinox)
ra
- The RA value in hoursdec
- The DEC value in degreesequinox
- The equinox of the input coordinates.public WorldCoords(HMS ra, DMS dec)
ra
- The RA value in hoursdec
- The DEC value in degreespublic WorldCoords(double ra, double dec, double equinox)
ra
- The RA value in degreesdec
- The DEC value in degreesequinox
- The equinox of the input coordinates.public WorldCoords(Double ra, Double dec, double equinox)
ra
- The RA value in degreesdec
- The DEC value in degreesequinox
- The equinox of the input coordinates.public WorldCoords(double ra, double dec)
ra
- The RA value in degreesdec
- The DEC value in degreespublic WorldCoords(Point2D.Double p, double equinox)
p
- The RA,Dec point in degreespublic WorldCoords(Point2D.Double p)
p
- The RA,Dec point in degreespublic WorldCoords(Double ra, Double dec)
ra
- The RA value in degreesdec
- The DEC value in degreespublic WorldCoords(double rh, int rm, double rs, double dd, int dm, double ds, double equinox)
rh
- RA hoursrm
- RA minutesrs
- RA secondsdd
- DEC degreesdm
- DEC minutesds
- DEC secondsequinox
- The equinox of the input coordinates.public WorldCoords(double rh, int rm, double rs, double dd, int dm, double ds)
rh
- RA hoursrm
- RA minutesrs
- RA secondsdd
- DEC degreesdm
- DEC minutesds
- DEC secondspublic WorldCoords(String ra, String dec, double equinox)
ra
- The RA value in the form "hh mm ss.s", "hh:mm:ss.s",
or just "hh.hhh".dec
- The DEC value in the form "[+/-]dd mm ss.s", "[+/-]dd:mm:ss.s"
or just "[+/-]dd.ddd".equinox
- The equinox of the input coordinates.public WorldCoords(String ra, String dec, double equinox, boolean hflag)
ra
- The RA value in the form "hh mm ss.s", "hh:mm:ss.s",
or just "hh.hhh".dec
- The DEC value in the form "[+/-]dd mm ss.s", "[+/-]dd:mm:ss.s"
or just "[+/-]dd.ddd".equinox
- The equinox of the input coordinates.hflag
- if true, always assume ra is in hours, otherwise, assume deg if
ra is a decimal value.public WorldCoords(String ra, String dec)
ra
- The RA value in the form "hh mm ss.s", "hh:mm:ss.s",
or just "hh.hhh".dec
- The DEC value in the form "[+/-]dd mm ss.s", "[+/-]dd:mm:ss.s"
or just "[+/-]dd.ddd".public WorldCoords(String ra, String dec, boolean hflag)
ra
- The RA value in the form "hh mm ss.s", "hh:mm:ss.s",
or just "hh.hhh".dec
- The DEC value in the form "[+/-]dd mm ss.s", "[+/-]dd:mm:ss.s"
or just "[+/-]dd.ddd".hflag
- if true, always assume ra is in hours, otherwise, assume deg if
ra is a decimal value.public HMS getRA()
getRA
in interface WorldCoordinates
public DMS getDec()
getDec
in interface WorldCoordinates
public double getRaDeg()
getRaDeg
in interface WorldCoordinates
public double getDecDeg()
getDecDeg
in interface WorldCoordinates
public double getX()
getX
in interface Coordinates
public double getY()
getY
in interface Coordinates
public String toString()
toString
in interface Coordinates
toString
in interface WorldCoordinates
toString
in class Object
public String[] format(double equinox)
format
in interface WorldCoordinates
public String[] format()
format
in interface WorldCoordinates
public double[] getRaDec(double equinox)
getRaDec
in interface WorldCoordinates
public static double[] dispos(double dra0, double decd0, double dra, double decd)
dra0
- center RAdecd0
- center DECdra
- point RAdecd
- point DECpublic double[] dispos(WorldCoordinates pos)
dispos
in interface WorldCoordinates
pos
- The other point.public static double wcsdist(double x1, double y1, double x2, double y2)
public double dist(WorldCoords pos)
pos
- The other point.public double dist(Coordinates pos)
dist
in interface Coordinates
pos
- The other point.public static double dist(double ra0, double dec0, double ra1, double dec1)
ra0
- The first RA valuedec0
- The first DEC valuera1
- The second RA valuedec1
- The second DEC valuepublic WorldCoordinates[] box(double radius)
box
in interface WorldCoordinates
radius
- The radius in arcmin.public double[] center(WorldCoordinates pos1, WorldCoordinates pos2)
center
in interface WorldCoordinates
pos1
- The first endpoint of the box.pos1
- The second endpoint of the box.public String getCoordinateSystemName()
getCoordinateSystemName
in interface Coordinates
public static void main(String[] args)
Copyright © 2023 Central Laboratory of the Research Councils. All Rights Reserved.