2011-03-30 15:18:19 +00:00
|
|
|
#include "Observer.h"
|
|
|
|
|
2011-04-09 19:03:58 +00:00
|
|
|
/*
|
|
|
|
* calculate lookangle between the observer and the passed in Eci object
|
|
|
|
*/
|
2011-12-14 11:48:22 +00:00
|
|
|
CoordTopographic Observer::GetLookAngle(const Eci &eci)
|
|
|
|
{
|
2011-03-30 17:16:37 +00:00
|
|
|
/*
|
2011-04-09 19:03:58 +00:00
|
|
|
* update the observers Eci to match the time of the Eci passed in
|
2011-05-30 00:04:08 +00:00
|
|
|
* if necessary
|
2011-03-30 17:16:37 +00:00
|
|
|
*/
|
2011-04-09 19:03:58 +00:00
|
|
|
UpdateObserversEci(eci.GetDate());
|
2011-03-30 17:16:37 +00:00
|
|
|
|
2011-04-09 19:03:58 +00:00
|
|
|
/*
|
|
|
|
* calculate differences
|
|
|
|
*/
|
|
|
|
Vector range_rate = eci.GetVelocity().Subtract(observers_eci_.GetVelocity());
|
|
|
|
Vector range = eci.GetPosition().Subtract(observers_eci_.GetPosition());
|
2011-03-30 17:16:37 +00:00
|
|
|
|
2011-05-26 23:22:38 +00:00
|
|
|
range.w = range.GetMagnitude();
|
2011-03-30 17:16:37 +00:00
|
|
|
|
2011-04-09 19:03:58 +00:00
|
|
|
/*
|
|
|
|
* Calculate Local Mean Sidereal Time for observers longitude
|
|
|
|
*/
|
2011-05-26 23:10:31 +00:00
|
|
|
double theta = eci.GetDate().ToLocalMeanSiderealTime(geo_.longitude);
|
2011-03-30 17:16:37 +00:00
|
|
|
|
2011-05-26 23:10:31 +00:00
|
|
|
double sin_lat = sin(geo_.latitude);
|
|
|
|
double cos_lat = cos(geo_.latitude);
|
2011-03-30 17:16:37 +00:00
|
|
|
double sin_theta = sin(theta);
|
|
|
|
double cos_theta = cos(theta);
|
|
|
|
|
2011-12-14 11:48:22 +00:00
|
|
|
double top_s = sin_lat * cos_theta * range.x
|
|
|
|
+ sin_lat * sin_theta * range.y - cos_lat * range.z;
|
|
|
|
double top_e = -sin_theta * range.x
|
|
|
|
+ cos_theta * range.y;
|
|
|
|
double top_z = cos_lat * cos_theta * range.x
|
|
|
|
+ cos_lat * sin_theta * range.y + sin_lat * range.z;
|
2011-03-30 17:16:37 +00:00
|
|
|
double az = atan(-top_e / top_s);
|
|
|
|
|
|
|
|
if (top_s > 0.0)
|
2011-12-14 11:48:22 +00:00
|
|
|
{
|
2011-05-20 21:09:23 +00:00
|
|
|
az += kPI;
|
2011-12-14 11:48:22 +00:00
|
|
|
}
|
2011-03-30 17:16:37 +00:00
|
|
|
|
|
|
|
if (az < 0.0)
|
2011-12-14 11:48:22 +00:00
|
|
|
{
|
2011-05-20 21:09:23 +00:00
|
|
|
az += 2.0 * kPI;
|
2011-12-14 11:48:22 +00:00
|
|
|
}
|
2011-03-30 17:16:37 +00:00
|
|
|
|
2011-05-26 23:22:38 +00:00
|
|
|
double el = asin(top_z / range.w);
|
|
|
|
double rate = range.Dot(range_rate) / range.w;
|
2011-03-30 17:16:37 +00:00
|
|
|
|
2011-04-09 19:03:58 +00:00
|
|
|
/*
|
|
|
|
* azimuth in radians
|
|
|
|
* elevation in radians
|
|
|
|
* range in km
|
|
|
|
* range rate in km/s
|
|
|
|
*/
|
2011-12-14 13:03:23 +00:00
|
|
|
return CoordTopographic(az,
|
2011-04-09 19:03:58 +00:00
|
|
|
el,
|
2011-05-26 23:22:38 +00:00
|
|
|
range.w,
|
2011-04-09 19:03:58 +00:00
|
|
|
rate);
|
2011-03-30 17:16:37 +00:00
|
|
|
}
|