CARMA C++
Coordinates.h
Go to the documentation of this file.
1 #ifndef SZA_UTIL_COORDINATES_H
2 #define SZA_UTIL_COORDINATES_H
3 
11 #include "carma/szautil/Angle.h"
12 #include "carma/szautil/DecAngle.h"
14 #include "carma/szautil/HourAngle.h"
15 #include "carma/szautil/Delay.h"
16 #include "carma/szautil/Vector.h"
17 
18 namespace sza {
19  namespace util {
20 
86  class Coordinates : public Vector<double> {
87  public:
88 
92  enum SrcDist {
93  ACTUAL, // Actual source distance
94  INF // Source at infinity
95  };
96 
100  Coordinates();
101 
109  Coordinates(Angle longitude, Angle latitude, double altitude);
110 
114  Coordinates(Coordinates& coord);
115 
119  virtual ~Coordinates();
120 
124  void setLla(Angle longitude, Angle latitude, double altitude);
125 
129  void setLongitude(Angle longitude);
130 
134  void setLatitude(Angle latitude);
135 
139  void setAltitude(double altitude);
140 
144  inline Angle& longitude() {
145  return longitude_;
146  }
147 
148  inline Angle& latitude() {
149  return latitude_;
150  }
151 
152  inline double& altitude() {
153  return altitude_;
154  }
155 
160  Vector<double> getAbsXyz(double east=0.0, double north=0.0, double up=0.0);
161 
166  Vector<double> getXyz(double east=0.0, double north=0.0, double up=0.0,
167  bool geocentric=true);
168 
173  Vector<double> getUen(Angle longitude, Angle latitude, double altitude);
174  Vector<double> getUen(Coordinates& coords);
175 
184  Vector<double> getUvw(HourAngle ha, DecAngle declination);
185 
190  Vector<double> getLla(double east=0.0, double north=0.0, double up=0.0);
191 
196  Vector<Angle> getAzEl(Angle longitude, Angle latitude, double altitude);
197  Vector<Angle> getAzEl(Coordinates& coords);
198 
202  void add(double up, double east, double north);
203 
204  //------------------------------------------------------------
205  // Static member functions
206  //------------------------------------------------------------
207 
212  static Vector<double>
213  lngLatAndAzElToLngLat(Angle& lng, Angle& lat,
214  Angle& az, Angle& el);
215 
220  static Vector<double> llaAndUenToLla(Angle longitude, Angle latitude,
221  double altitude,
222  double up, double east, double north);
223 
227  static Vector<double> llaAndLlaToUen(Angle fiducialLongitude,
228  Angle fiducialLatitude,
229  double fiducialAltitude,
230  Angle longitude, Angle latitude,
231  double altitude);
232 
237  static Vector<double> llaAndUenToAbsXyz(Angle longitude, Angle latitude,
238  double altitude,
239  double up, double east, double north, bool doTrans=true);
240 
245  static Vector<double> topoXYZToUen(double X, double Y, double Z,
246  Angle latitude);
247 
251  static Vector<double> absXyzToLla(double XA, double YA, double ZA);
252 
257  static Vector<double> absXyzAndUenToLla(double XA, double YA, double ZA,
258  double up=0.0, double east=0.0,
259  double north=0.0);
260 
274  static Vector<double> laAndUenToXyz(Angle latitude, double altitude,
275  double up=0.0, double east=0.0,
276  double north=0.0,
277  bool geocentric=true);
278 
284  static Vector<double> azElToUen(Angle az, Angle el, double r=1.0);
285 
289  static Vector<Angle> uenToAzEl(double U, double E, double N);
290  static Vector<Angle> uenToAzEl(Vector<double>& uen);
291 
301  static Vector<double> haDecAndXyzToUvw(HourAngle ha, DecAngle declination,
302  double X, double Y, double Z);
314  static Vector<double> haDecToXyz(HourAngle ha, DecAngle declination,
315  bool geocentric=true,
316  SrcDist type=INF, double r=0.0);
317 
318  //=======================================================================
319  // Given a delta HA and delta DEC, return the XYZ (direction
320  // cosines only) coordinate
321  //=======================================================================
322 
327  static Vector<double> dHaDdecToXyz(HourAngle dHa, Angle dDec);
328 
333  static void xyzToDhaDdec(double X, double Y, double Z,
334  HourAngle& dHa, Angle& dDec);
335 
340  static void xyzToDhaDdec(Vector<double>& xyzVals,
341  HourAngle& dHa, Angle& dDec);
342 
343  //=======================================================================
344  // Given polar offsets on the sky from a given dec position
345  // (assumed to be at HA=0h), theta (azimuthal) and rho (radial),
346  // return the XYZ direction cosines.
347  //=======================================================================
348 
349  static Vector<double> thetaRhoToXyz(Declination& dec, Angle& theta, Angle& rho);
350 
351  static Matrix<double> getThetaRhoToXyzDecRot(Declination& dec);
352  static Matrix<double> getThetaRhoToXyzThetaRot(Angle& theta);
353  static Matrix<double> getThetaRhoToXyzRhoRot(Angle& rho);
354 
361  static void raDecAndThetaRhoToRaDec(HourAngle& ra0, Declination& dec0,
362  Angle& theta, Angle& rho,
363  HourAngle& ra, Declination& dec);
364 
389  static Vector<Angle>
390  laAndHaDecToAzEl(Angle latitude, double altitude,
391  HourAngle ha, DecAngle declination,
392  bool geocentric=true,
393  SrcDist type=INF, double dist=1.0);
394 
404  static Delay getGeometricDelay(HourAngle ha, DecAngle declination,
405  double X, double Y, double Z,
406  double X0, double Y0, double Z0,
407  bool doMotionCorrection);
408 
415  static Delay getGeometricDelay(Angle latitude,
416  Angle az, Angle el,
417  double X, double Y, double Z);
418 
419  //------------------------------------------------------------
420  // Some utility methods which it may be convenient to leave
421  // public
422  //------------------------------------------------------------
423 
427  static Vector<double> getdUvw(HourAngle ha, DecAngle declination,
428  double X, double Y, double Z);
429 
433  static Vector<double> getd2Uvw(HourAngle ha, DecAngle declination,
434  double X, double Y, double Z);
438  friend std::ostream& operator<<(std::ostream& os, Coordinates& coords);
439 
440  public:
441 
442  /*
443  * Radius of the earth (meters)
444  */
445  static const double earthEqRadiusMeters_;
446 
450  static const double earthFlattening_;
451 
452  /*o
453  * Speed of light (meters/sec)
454  */
455  static const double lightSpeed_;
456 
460  static const double auToMeters_;
461 
466  static const double earthRotVelRadPerSec_;
467 
468  private:
469 
473  Angle longitude_;
474  Angle latitude_;
475  double altitude_;
476 
480  static Matrix<double> getUenToXyzLonRot(Angle longitude);
481 
485  static Matrix<double> getUenToXyzLatRot(Angle latitude);
486 
490  static Matrix<double> getXyzToUvwDecRot(DecAngle declination);
491 
495  static Matrix<double> getXyzToUvwHaRot(HourAngle ha);
496 
501  static Matrix<double> getdXyzToUvwHaRot(HourAngle ha);
502 
507  static Matrix<double> getd2XyzToUvwHaRot(HourAngle ha);
508 
509  }; // End class Coordinates
510 
511  } // End namespace util
512 } // End namespace sza
513 
514 
515 #endif // End #ifndef SZA_UTIL_COORDINATES_H
static Vector< double > absXyzToLla(double XA, double YA, double ZA)
Given absolute XYZ, convert to LLA.
Vector< Angle > getAzEl(Angle longitude, Angle latitude, double altitude)
Given a LLA coordinate, return its Az, El relative to the position of this object.
static void raDecAndThetaRhoToRaDec(HourAngle &ra0, Declination &dec0, Angle &theta, Angle &rho, HourAngle &ra, Declination &dec)
......................................................................
static Vector< double > haDecAndXyzToUvw(HourAngle ha, DecAngle declination, double X, double Y, double Z)
Return the UVW coordinates, relative to a given XYZ coordinate, for the requested source position...
static Vector< double > absXyzAndUenToLla(double XA, double YA, double ZA, double up=0.0, double east=0.0, double north=0.0)
Return the LLA of the point given by the specified absolute XYZ and UEN offset.
static Vector< double > llaAndLlaToUen(Angle fiducialLongitude, Angle fiducialLatitude, double fiducialAltitude, Angle longitude, Angle latitude, double altitude)
Return the UEN of an LLA point relative to a fiducial LLA point.
Tagged: Fri Jun 15 16:44:12 PDT 2007.
static Vector< double > llaAndUenToAbsXyz(Angle longitude, Angle latitude, double altitude, double up, double east, double north, bool doTrans=true)
Return absolute XYZ of the point offset by UEN from a given LLA point.
Angle & longitude()
Position return methods.
Definition: Coordinates.h:144
void setLatitude(Angle latitude)
Set just the latitude.
void setAltitude(double altitude)
Set just the altitude.
void setLla(Angle longitude, Angle latitude, double altitude)
Set methods.
static Vector< double > topoXYZToUen(double X, double Y, double Z, Angle latitude)
Given a topocentric XYZ, return the UEN coordinates at a given latitude.
static Vector< double > lngLatAndAzElToLngLat(Angle &lng, Angle &lat, Angle &az, Angle &el)
Return the LL of the point given by an az/el offset relative to a fiducial LL.
This class performs conversions between several different coordinate systems.
Definition: Coordinates.h:86
static Vector< double > getd2Uvw(HourAngle ha, DecAngle declination, double X, double Y, double Z)
Second derivatives of the UVW coordinates wrt time.
Vector< double > getLla(double east=0.0, double north=0.0, double up=0.0)
Return LLA of the passed UEN offset point, relative to the LLA coordinates stored in this object...
void add(double up, double east, double north)
Increment the LLA of this object by the specified UEN offset.
static Vector< Angle > uenToAzEl(double U, double E, double N)
Given UEN, return the Azimuth and Elevation.
friend std::ostream & operator<<(std::ostream &os, Coordinates &coords)
Allows cout &lt;&lt; coords.
static const double earthRotVelRadPerSec_
Rotational angular velocity of the earth, in radians per second.
Definition: Coordinates.h:466
static Vector< double > getdUvw(HourAngle ha, DecAngle declination, double X, double Y, double Z)
First derivatives of the UVW coordinates wrt time.
static Vector< double > laAndUenToXyz(Angle latitude, double altitude, double up=0.0, double east=0.0, double north=0.0, bool geocentric=true)
Return the XYZ coordinates of an UEN point relative to a fiducial LA.
virtual ~Coordinates()
Destructor.
static void xyzToDhaDdec(double X, double Y, double Z, HourAngle &dHa, Angle &dDec)
Return the dHa and dDec corresponding to the specified (X, Y, Z) coordinate.
Vector< double > getXyz(double east=0.0, double north=0.0, double up=0.0, bool geocentric=true)
Return XYZ coordinates of the given UEN point, relative to the LLA point of this object.
SrcDist
Enumerate types of distances we might pass to methods.
Definition: Coordinates.h:92
static Vector< double > haDecToXyz(HourAngle ha, DecAngle declination, bool geocentric=true, SrcDist type=INF, double r=0.0)
Return the XYZ coordinate of a vector at requested (Ha, Dec) direction and of length r...
Vector< double > getUvw(HourAngle ha, DecAngle declination)
Return the UVW coordinates for the current LLA location, of a source at the requested declination and...
void setLongitude(Angle longitude)
Set just the longitude.
static const double earthFlattening_
Flattening of the earth.
Definition: Coordinates.h:450
static Vector< double > azElToUen(Angle az, Angle el, double r=1.0)
Given Azimuth and Elevation, return the UEN coordinates.
static Vector< double > dHaDdecToXyz(HourAngle dHa, Angle dDec)
Return the (X, Y, Z) coordinates of the specified (Ha, Dec) coordinate.
static Delay getGeometricDelay(HourAngle ha, DecAngle declination, double X, double Y, double Z, double X0, double Y0, double Z0, bool doMotionCorrection)
Get the delay for the Ha and Dec of a source, given XYZ coordinates of a baseline.
Vector< double > getAbsXyz(double east=0.0, double north=0.0, double up=0.0)
Return absolute XYZ coordinates of the given UEN point, relative to the LLA point of this object...
static const double auToMeters_
Conversion between AU and meters.
Definition: Coordinates.h:460
static Vector< double > llaAndUenToLla(Angle longitude, Angle latitude, double altitude, double up, double east, double north)
Return the LLA of the point given by an UEN offset relative to a fiducial LLA.
static Vector< Angle > laAndHaDecToAzEl(Angle latitude, double altitude, HourAngle ha, DecAngle declination, bool geocentric=true, SrcDist type=INF, double dist=1.0)
Return the Az El of a source at a given HA and Dec.
Vector< double > getUen(Angle longitude, Angle latitude, double altitude)
Return UEN coordinates of the specified LLA point, relative to the coordinates stored in this object...
Coordinates()
Constructor.