/**
 @file angle.h
 @brief Compute the fundamental frequencies in the earth-moon-sun motion.
 @author CLS
 */
#ifndef _ANGLE_H
#define _ANGLE_H

/**
 @def JULIAN_CENTURY
 @brief Number of seconds in one Julian century
 */
#define JULIAN_CENTURY 3155760000.0

/**
 @fn s_speed()

 @brief Compute the speed in degree by hour for the moon's mean
 longitude (s)
 */
inline double s_speed()
{
    return (((1336.0 * 360.0 + 307.892) / JULIAN_CENTURY)) * 3600.0;
}

/**
 @fn h_speed()

 @brief Compute the speed in degree by hour for the sun's mean
 longitude (h)
 */
inline double h_speed()
{

    return (((100.0 * 360.0 + 0.769) / JULIAN_CENTURY)) * 3600.0;
}

/**
 @fn p_speed()

 @brief Compute the speed in degree by hour for the longitude of
 moon's perigee (p)
 */
inline double p_speed()
{
    return (((11.0 * 360.0 + 109.032) / JULIAN_CENTURY)) * 3600.0;
}

/**
 @fn n_speed()

 @brief Compute the speed in degree by hour for the longitude of
 moon's ascending node (N′)
 */
inline double n_speed()
{
    return (((-5.0 * 360.0 - 134.142) / JULIAN_CENTURY))  * 3600.0;
}

/**
 @fn p1_speed()

 @brief Compute the speed in degree by hour for the longitude of
 sun's perigee (p₁)
 */
inline double p1_speed()
{
    return ((1.719 / JULIAN_CENTURY)) * 3600;
}

/**
 @fn tau_speed()

 @brief Compute the speed in degree by hour for the local mean
 lunar time (τ)
 */
inline double tau_speed()
{
    return 15.0 - s_speed() + h_speed();
}

/**
 @fn s_frequency()

 @brief Compute the frequency in degree by hour for the moon's mean
 longitude (s)
 */
inline double s_frequency()
{
    return 1.0 / ((15.0 / s_speed()) * 24.0);
}

/**
 @fn h_frequency()

 @brief Compute the frequency in degree by hour for the sun's mean
 longitude (h)
 */
inline double h_frequency()
{

    return 1.0 / ((15.0 / h_speed()) * 24.0);
}

/**
 @fn p_frequency()

 @brief Compute the frequency in degree by hour for the longitude of
 moon's perigee (p)
 */
inline double p_frequency()
{
    return 1.0 / ((15.0 / p_speed()) * 24.0);
}

/**
 @fn n_frequency()

 @brief Compute the frequency in degree by hour for the longitude of
 moon's ascending node (N′)
 */
inline double n_frequency()
{
    return 1.0 / ((15.0 / n_speed()) * 24.0);
}

/**
 @fn p1_frequency()

 @brief Compute the frequency in degree by hour for the longitude of
 sun's perigee (p₁)
 */
inline double p1_frequency()
{
    return 1.0 / ((15.0 / p1_speed()) * 24.0);
}

/**
 @fn tau_frequency()

 @brief Compute the frequency in degree by hour for the local mean
 lunar time (τ)
 */
inline double tau_frequency()
{
    return 1.0 / ((15.0 / tau_speed()) * 24.0);
}

#endif
