When we need to handle both world and image coordinates in the same way we use a special class WorldOrImageCoords . This class represents either image pixel coordinates (class ImageCoords ) or World Coordinates (class WorldCoords ). The constructor takes an instance of either of these classes and sets a flag, isWcs , to note which kind it is:
// constructor - initialize null coordinates WorldOrImageCoords(); // constructor: initialize World Coordinates WorldOrImageCoords(WorldCoords); // constructor: initialize image pixel coords WorldOrImageCoords(ImageCoords);
WorldOrImageCoords ic1(ImageCoords(123.456, 654.321)); WorldOrImageCoords ic2(ImageCoords("123.456.", "654.321.")); cout << "these coords should be the same (or very close):" << endl << ic1 << endl << ic2 << endl; WorldOrImageCoords c1(WorldCoords(49.95096, 41.51173)); WorldOrImageCoords c2(WorldCoords(3, 19, 48.2304, 41, 30, 42.228)); WorldOrImageCoords c3(WorldCoords(HMS(3, 19, 48.2304), HMS(41, 30, 42.228))); WorldOrImageCoords c4(WorldCoords(HMS(c1.ra()), HMS(c1.dec()))); WorldOrImageCoords c5(WorldCoords("3 19 48.2304", "+41 30 42.228", 2000.0)); WorldOrImageCoords c6(WorldCoords("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 WorldOrImageCoords(3) for more details.
Please send questions or comments to abrighto@eso.org.
Copyright © 1998 ESO - European Southern Observatory