WorldCoordinates.java
2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
* ESO Archive
*
* $Id: WorldCoordinates.java,v 1.2 2009/02/20 23:10:11 abrighto Exp $
*
* who when what
* -------------- ---------- ----------------------------------------
* Allan Brighton 1999/05/03 Created, based on C++ version
*/
package jsky.coords;
/**
* Interface for representing world coordinates (right-ascension, declination,
* stored as J2000 internally).
*/
public abstract interface WorldCoordinates extends Coordinates {
/** return the RA value in J2000 */
public HMS getRA();
/** return the DEC value in J2000 */
public DMS getDec();
/** return the RA value in deg J2000 */
public double getRaDeg();
/** return the DEC value in deg J2000 */
public double getDecDeg();
/**
* Return the coordinates as a string in h:m:s [+-]d:m:s format
*/
public String toString();
/**
* 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.
*/
public String[] format(double equinox);
/**
* Format RA and DEC in h:m:s [+-]d:m:s format in J2000
* and return them as a 2 element String array.
*/
public String[] format();
/**
* Return RA and DEC in degrees as an array of 2 doubles {ra, dec} in the given equinox.
*/
public double[] getRaDec(double equinox);
/**
* return the distance between this position and the given one in arcmin
* and also set the position angle
*
* @param pos The other point.
*
* @return An array of 2 doubles ar[2], where ar[0] is the distance in arcmin and
* ar[1] is the position angle in degrees (East of North).
*/
public double[] dispos(WorldCoordinates pos);
/**
* Given a radius in arcmin, return an array {pos1, pos2} with the 2 endpoints
* that form a box with center at "this" position.
*
* @param radius The radius in arcmin.
*
* @return Array of 2 WorldCoordinates objects that are the endpoints of a box
* with the given radius and centered at "this" position.
*/
public WorldCoordinates[] box(double radius);
/**
* 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.
*
* @param pos1 The first endpoint of the box.
* @param pos2 The second endpoint of the box.
*
* @return An array of 5 doubles: {ra, dec, width, height, radius}
* where (ra, dec) gives the center position in deg,
* width and height are the size of the box in arcmin,
* and radius is the distance from the center to a corner in arcmin.
*/
public double[] center(WorldCoordinates pos1, WorldCoordinates pos2);
}