28 #ifndef astroDynamics_hpp
29 #define astroDynamics_hpp
35 #include "../math/constants.hpp"
36 #include "../math/geo.hpp"
53 template<
typename realT>
62 hr = (
day - (realT) Dy)*24.0;
63 min = (
day - (realT) Dy - ((realT)hr)/24.0) * 60.*24.0;
64 sec = (
day - (realT) Dy - ((realT)hr)/24.0 - ((realT) min)/(60.0*24.0)) * 3600.0*24.0;
75 template<
typename realT>
86 double utc0, utc1, tai0, tai1, tt0, tt1, ut10, ut11;
89 rv = sofa::iauDtf2d (
"UTC", Yr, Mo, Dy, hr, min,
static_cast<double>(sec), &utc0, &utc1);
97 rv = sofa::iauUtctai(utc0, utc1, &tai0, &tai1);
105 rv = sofa::iauTaitt (tai0, tai1, &tt0, &tt1);
113 rv = sofa::iauUtcut1(utc0, utc1, -.4, &ut10, &ut11);
120 GMST = sofa::iauGmst06(ut10, ut11, tt0, tt1)/(math::two_pi<realT>())*
static_cast<realT
>(24);
133 template<
typename realT>
143 hrMinSecFromDay<realT>(Dy, hr, min, sec,
day);
144 return getGMST(GMST, Yr, Mo, Dy, hr, min, sec);
153 template<
typename realT>
167 rv =
getGMST(GMST, Yr,Mo, Dy, hr, min, sec);
169 LMST = GMST + lon/
static_cast<realT
>(15);
171 LMST = fmod(LMST, 24);
172 if(LMST < 0.0) LMST += 24.;
184 template<
typename realT>
195 hrMinSecFromDay<realT>(Dy, hr, min, sec,
day);
197 return getLMST(LMST, Yr, Mo, Dy, hr, min, sec, lon);
211 template<
typename realT>
219 realT ha_rad, dec_rad, lat_rad, az_rad, el_rad;
221 ha_rad = ha*
static_cast<realT
>(15)*math::pi<realT>()/
static_cast<realT
>(180);
222 dec_rad = dec*math::pi<realT>()/
static_cast<realT
>(180);
223 lat_rad = lat*math::pi<realT>()/
static_cast<realT
>(180);
225 az_rad = atan2(sin(ha_rad), cos(ha_rad)*sin(lat_rad)-tan(dec_rad)*cos(lat_rad));
227 el_rad = asin(sin(lat_rad)*sin(dec_rad) + cos(lat_rad)*cos(dec_rad)*cos(ha_rad));
229 az = az_rad*
static_cast<realT
>(180)/math::pi<realT>() +
static_cast<realT
>(180);
230 el = el_rad*
static_cast<realT
>(180)/math::pi<realT>();
243 template<
typename realT>
251 return atan2( sinHA, cosDec*tanLat - sinDec*cosHA);
262 template<
typename realT>
281 template<
typename realT>
287 return parAngRad( sin(ha), cos(ha), sin(dec), cos(dec), tan(lat));
300 template<
typename realT>
307 static_cast<void>(newflag);
int getGMST(realT &GMST, int Yr, int Mo, int Dy, int hr, int min, realT sec)
Returns Greenwich Mean Sidereal Time for a given UTC time.
int hrMinSecFromDay(int &Dy, int &hr, int &min, realT &sec, realT day)
Breaks down a decimal day into hours, minutes and decimal point seconds.
int getLMST(realT &LMST, int Yr, int Mo, int Dy, int hr, int min, realT sec, realT lon)
Returns Local Mean Sidereal Time for a given UTC time and longitude.
constexpr units::realT day()
Length of day.
realT rtod(realT q)
Convert from radians to degrees.
realT dtor(realT q)
Convert from degrees to radians.
int calcAzEl(realT &az, realT &el, realT ha, realT dec, realT lat)
Calculates the Azimuth and Elevation for a given Hour-Angle, Declination, and Latitude.
realT parAngRad(realT ha, realT dec, realT lat)
Calculate the Parallactic Angle, with angles in radians.
realT parAngDeg(realT ha, realT dec, realT lat, bool newflag)
Calculate the Parallactic Angle, with angles in degrees.
Wrapper for the sofa library headers, adding a namespace.