mxlib
c++ tools for analyzing astronomical data and other tasks by Jared R. Males. [git repo]
astroDynamics.hpp File Reference

Various utilities for astrodynamics. More...

Various utilities for astrodynamics.

Author
Jared R. Males (jared.nosp@m.male.nosp@m.s@gma.nosp@m.il.c.nosp@m.om)

Definition in file astroDynamics.hpp.

Go to the source code of this file.

Namespaces

 mx
 The mxlib c++ namespace.
 

Functions

template<typename realT >
int mx::astro::hrMinSecFromDay (int &Dy, int &hr, int &min, realT &sec, realT day)
 Breaks down a decimal day into hours, minutes and decimal point seconds. More...
 
template<typename realT >
int mx::astro::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. More...
 
template<typename realT >
int mx::astro::getGMST (realT &GMST, int Yr, int Mo, realT day)
 Returns Greenwich Mean Sidereal Time for a given UTC time. More...
 
template<typename realT >
int mx::astro::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. More...
 
template<typename realT >
int mx::astro::getLMST (realT &LMST, int Yr, int Mo, realT day, realT lon)
 Returns Local Mean Sidereal Time for a given UTC time. More...
 
template<typename realT >
int mx::astro::calcAzEl (realT &az, realT &el, realT ha, realT dec, realT lat)
 Calculates the Azimuth and Elevation for a given Hour-Angle, Declination, and Latitude. More...
 
template<typename realT >
realT mx::astro::parAngRad (realT sinHA, realT cosHA, realT sinDec, realT cosDec, realT tanLat)
 Calculate the Parallactic Angle from the pre-calculated trig functions. Result in radians. More...
 
template<typename realT >
realT mx::astro::parAngDeg (realT sinHA, realT cosHA, realT sinDec, realT cosDec, realT tanLat)
 Calculate the Parallactic Angle from the pre-calculated trig functions. Result in degrees. More...
 
template<typename realT >
realT mx::astro::parAngRad (realT ha, realT dec, realT lat)
 Calculate the Parallactic Angle, with angles in radians. More...
 
template<typename realT >
realT mx::astro::parAngDeg (realT ha, realT dec, realT lat, bool newflag)
 Calculate the Parallactic Angle, with angles in degrees. More...
 

Function Documentation

◆ getGMST() [1/2]

template<typename realT >
int mx::astro::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.

Uses the SOFA 2006 GMST function, and a (for now) hardcoded value of dUT1

Return values
0on success
Todo:
handle SOFA error.
Todo:
handle SOFA error.
Todo:
handle SOFA error.
Todo:
handle SOFA error.
Parameters
[out]GMSTGMST in hours
[in]Yrinteger year
[in]Mointeger month (1-12)
[in]Dyinteger day (1-31)
[in]hrinteger hour (0-23)
[in]mininteger minute (0-59)
[in]secdecimal second (0-59)

Definition at line 76 of file astroDynamics.hpp.

References mx::astro::getGMST().

Referenced by mx::astro::getGMST(), and mx::astro::getLMST().

◆ getGMST() [2/2]

template<typename realT >
int mx::astro::getGMST ( realT &  GMST,
int  Yr,
int  Mo,
realT  day 
)

Returns Greenwich Mean Sidereal Time for a given UTC time.

Uses the SOFA 2006 GMST function, and a (for now) hardcoded value of dUT1

Parameters
GMST[output] GMST in hours
Yr[input] integer year
Mo[input] integer month (1-12)
day[input] decimal day (1-31)
Return values
0on sucess
Parameters
[out]GMSTGMST in hours
[in]Yrinteger year
[in]Mointeger month (1-12)
[in]daydecimal day (1-31)

Definition at line 134 of file astroDynamics.hpp.

References mx::astro::constants::day(), and mx::astro::getGMST().

◆ getLMST() [1/2]

template<typename realT >
int mx::astro::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.

Uses the SOFA 2006 GMST function, and a (for now) hardcoded value of dUT1

Return values
0on success
Parameters
[out]LMSTLMST in hours
[in]Yrinteger year
[in]Mointeger month (1-12)
[in]Dyinteger day (1-31)
[in]hrinteger hour (0-23)
[in]mininteger minute (0-59)
[in]secdecimal second (0-59)
[in]lonlongitude in degrees, E+, W-

Definition at line 154 of file astroDynamics.hpp.

References mx::astro::getGMST(), and mx::astro::getLMST().

Referenced by mx::astro::getLMST().

◆ getLMST() [2/2]

template<typename realT >
int mx::astro::getLMST ( realT &  LMST,
int  Yr,
int  Mo,
realT  day,
realT  lon 
)

Returns Local Mean Sidereal Time for a given UTC time.

Uses the SOFA 2006 GMST function, and a (for now) hardcoded value of dUT1

Template Parameters
realTthe floating point type for all calculations
Return values
0on sucess
Parameters
[out]LMSTLMST in hours
[in]Yrinteger year
[in]Mointeger month (1-12)
[in]daydecimal day (1-31)
[in]lonlongitude in degrees, E+, W-

Definition at line 185 of file astroDynamics.hpp.

References mx::astro::constants::day(), and mx::astro::getLMST().

◆ hrMinSecFromDay()

template<typename realT >
int mx::astro::hrMinSecFromDay ( int &  Dy,
int &  hr,
int &  min,
realT &  sec,
realT  day 
)

Breaks down a decimal day into hours, minutes and decimal point seconds.

Assumes 86400 seconds per day, ignoring leap seconds.

Template Parameters
realTthe floating point type for calculations
Return values
0on success
-1on failure.
Parameters
[out]Dythe integer day
[out]hrthe integer hour
[out]minthe integer minute
[out]secthe integer second
[in]daythe decimal day to be broken down

Definition at line 54 of file astroDynamics.hpp.

References mx::astro::constants::day(), and mx::astro::hrMinSecFromDay().

Referenced by mx::astro::hrMinSecFromDay().