Skip to content

File conversions.hpp

File List > astrea > astro > astro > utilities > conversions.hpp

Go to the documentation of this file

#pragma once

#include <mp-units/math.h>

#include <units/units.hpp>

#include <astro/astro.fwd.hpp>

namespace astrea {
namespace astro {

Angle convert_mean_anomaly_to_true_anomaly(const Angle& ma, const Unitless ecc);

Angle convert_true_anomaly_to_mean_anomaly(const Angle& ta, const Unitless ecc);

Angle convert_eccentric_anomaly_to_mean_anomaly(const Angle& ea, const Unitless ecc);

Angle convert_mean_anomaly_to_eccentric_anomaly(const Angle& ma, const Unitless ecc);

constexpr Angle wrap_angle(const Angle& angle)
{
    Angle ang = angle;
    while (ang < 0.0 * astrea::detail::angle_unit) {
        ang += TWO_PI;
    }
    return mp_units::fmod(ang, TWO_PI);
}

} // namespace astro
} // namespace astrea