Go up one levelGo to Previous Go to Next

World Coordinates

World coordinates are managed by the WorldCoords class. Most of the work is done by the various constructors. You can pass in the coordinates as hh:mm:ss[+-]dd:mm:ss, in double degrees or in string format:

 
// constructor: initialize NULL coordinates

WorldCoords();

// constructor: ra is H:M:S and dec is D:M:S

WorldCoords(const HMS& ra, const HMS& dec, double equinox = 2000.0);

// constructor: ra and dec are both in degrees

WorldCoords(double ra, double dec, double equinox = 2000.0);

// constructor: r... is H:M:S, d... is D:M:S

WorldCoords(int rh, int rm, double rs, int dd, int dm, float ds,
            double equinox = 2000.0);

// constructor - parse ra and dec from strings

WorldCoords(const char* ra, const char* dec, double equinox = 2000.0);

The equinox for the coordinates can be specified as a floating point value, otherwise it defaults to 2000.0. Internally, the coordinates are always converted to J2000, so that there is no confusion when comparing coordinates from different sources. Methods are defined to get the coordinate values in degrees or H:M:S and in a given equinox. Other methods are available to compare coordinates and read and write them.

Example:

 
WorldCoords c1(49.95096, 41.51173); 
WorldCoords c2(3, 19, 48.2304, 41, 30, 42.228); 
WorldCoords c3(HMS(3, 19, 48.2304), HMS(41, 30, 42.228)); 
WorldCoords c4(HMS(c1.ra()), HMS(c1.dec())); 
WorldCoords c5("3 19 48.2304", "+41 30 42.228", 2000.0); 
WorldCoords c6("3:19:48.2304", "+41:30:42.228", 2000.0); 
cout << "these coords should all be the same (or very close):" << endl 
    << c1 << endl 
    << c2 << endl 
    << c3 << endl 
    << c4 << endl 
    << c5 << endl 
    << c6 << endl;

See WorldCoords(3) for more details.


Go up one levelGo to Previous Go to Next

Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory