![]() |
QP
0.7-SNAPSHOT
Control software for the ??SRT telescope
|
The Position class allows us to represent positions on the celestial sphere (or on Earth, at a push). More...
#include <position.h>
Public Types | |
| enum | System { _Natural, TopoPolar, AzAlt, EqPolar, HADec, RADec, Geog, Velocity, _Null } |
| The known coordinate systems. More... | |
Public Member Functions | |
| Position (double lon, double lat, System system, System into_system=_Natural) | |
| Create a new pair of angles. More... | |
| double | lon (void) const |
| The azimuthal coordinate. More... | |
| double | lat (void) const |
| The latitudinal coordinate. | |
| System | system (void) const |
| The coordinate system in which this position is expressed. | |
| bool | is_null_p (void) const |
| Test if the Position is a 'null' one. | |
| void | set_observatory (const Position &) |
| Set the observatory position, for a subsequent call to to_system. More... | |
| void | set_reftime (const AstroTime &) |
| Set the reference time, for a subsequent call to to_system. More... | |
| Position | to_system (System into_system) const |
| Return another Position, in the given system. More... | |
Static Public Member Functions | |
| static Position | get_null (void) |
| Return a 'null' Position, which can be used as a sentinel value. | |
The Position class allows us to represent positions on the celestial sphere (or on Earth, at a push).
We're able to support a subset of coordinate conversions.
| enum Position::System |
The known coordinate systems.
| enum | explanation |
|---|---|
| TopoPolar | horizontal coordinate system: longitude is azimuthal coordinate of spherical polar coordinates (east of south, in range [0,2pi]); latitude is north of horizontal |
| AzAlt | horizontal coordinate system: azimuth (azimuth is east of north, in range [0,2pi]) and altitude (north of horizontal) |
| HADec | equatorial: LHA (west-positive) and Declination |
| EqPolar | equatorial: same as HADec, but longitude is negative HA, thus the azimuthal coordinate of spherical polars, but in a right-handed equatorial frame with zero longitude on the meridian |
| RADec | equatorial: Right Ascension and Declination |
| Geog | geographic: latitude and east longitude |
| Velocity | the coordinates are velocities in a right-handed system, in rad/sec |
(the _Natural and _Null systems are placemarkers, and should not be used externally to this class implementation).
Create a new pair of angles.
The lon and lat attributes are a pair of angles giving longitude and latitude, in radians.
There is limited support for converting between systems, the set of possible 'conversions' is rather ad-hoc, and any impermissible ones call fatal().
The system argument to this constructor indicates the coordinate system in which the two angle arguments are expressed, and the into_system argument indicates the system of the resulting object. If the into_system argument is not provided, then both TopoPolar and AzAlt coordinates are turned into TopoPolar, and both HADec and EqPolar arguments into HADec. If the fourth argument is present, then TopoPolar and AzAlt coordinates are interconvertible, as are HADec and EqPolar. For conversions between those pairs, see to_system.
After these conversions, the .lon and .lat values are initialised in their appropriately adjusted form. Thus (writing degrees instead of radians, for convenience): after Position(10, 30, AzAlt), the .lon is +170 and .lat is +30; after Position(200, 30, AzAlt), the .lon is +340; after Position(-10, 30), the .lon is +350; after Position(10, 30, HADec), the .lon is +350 and .lat is +30.
In all cases, the longitude is normalised into [0,2pi), and the latitude is forced to be in [-pi/2,pi/2].
FIXME: Tidyups/refactoring: the Position class is now over-complicated, with far too much fiddly branching. Or is it? Things like TrackingSchedule need specific documentation concerning which coordinate system the arguments are in, with the result that rotation-by-colatitude happens in multiple places (and I always get the signs wrong first time). I can't help feeling these should be in a single place, but every time I conclude that single place is 'in the Position class', I end up with a mess in here.
| lon | the longitudinal angle in the specified system |
| lat | the latitudinal angle in the specified system |
| system | the system in which the above two arguments are expressed |
| into_system | the system in which the resulting Position object holds its coordinates |
|
inline |
The azimuthal coordinate.
This is east-positive, from the reference position, which has zero degrees at south.
| void Position::set_observatory | ( | const Position & | obs | ) |
Set the observatory position, for a subsequent call to to_system.
It is a fatal error if this is not set before a subsequent conversion to AzAlt coordinates.
The position must be in the Geog system.
| void Position::set_reftime | ( | const AstroTime & | t | ) |
Set the reference time, for a subsequent call to to_system.
It is a fatal error if this is not set before a subsequent conversion from RA-Dec coordinates.
| Position Position::to_system | ( | Position::System | into_system | ) | const |
Return another Position, in the given system.
Depending on the conversion, it may be necessary to have called set_reftime (for conversions involving the RADec system) or set_observatory (for conversion to equatorial systems). If such required information is needed but has not been set, this results in a fatal error.
1.8.8