|
Time Shield Library
C++ library for working with time
|
Moon phase calculator (geocentric approximation). More...
#include <MoonPhase.hpp>
Public Types | |
| using | quarters_unix_s_t = std::array<double, 8> |
| Quarter instants as Unix UTC seconds ({new, firstQ, full, lastQ} for previous and next cycles). | |
Public Member Functions | |
| MoonPhaseResult | compute (double unix_utc_s) const noexcept |
| Compute full set of Moon phase parameters for given UTC timestamp. | |
| double | compute_phase (double unix_utc_s) const noexcept |
| Compute only phase fraction in [0..1) for given UTC timestamp. | |
| quarters_unix_s_t | quarter_times_unix (double unix_utc_s) const noexcept |
| Compute quarter/new/full instants around given timestamp. | |
| quarters_unix_s_t | quarter_times (double unix_utc_s) const noexcept |
| Compatibility wrapper returning quarter instants as Unix UTC seconds. | |
| MoonQuarterInstants | quarter_instants_unix (double unix_utc_s) const noexcept |
| Quarter instants around the provided timestamp as a structured result (Unix UTC seconds). | |
| bool | is_new_moon_window (double unix_utc_s, double window_seconds=kDefaultQuarterWindow_s) const noexcept |
| Check whether timestamp is inside a window around new moon. | |
| bool | is_full_moon_window (double unix_utc_s, double window_seconds=kDefaultQuarterWindow_s) const noexcept |
| Check whether timestamp is inside a window around full moon. | |
| bool | is_first_quarter_window (double unix_utc_s, double window_seconds=kDefaultQuarterWindow_s) const noexcept |
| Check whether timestamp is inside a window around first quarter. | |
| bool | is_last_quarter_window (double unix_utc_s, double window_seconds=kDefaultQuarterWindow_s) const noexcept |
| Check whether timestamp is inside a window around last quarter. | |
Static Public Attributes | |
| static constexpr double | kDefaultQuarterWindow_s = 43200.0 |
| Default window around phase events (12h). | |
Private Member Functions | |
| double | mean_phase_jd (double julian_day, double lunation_index) const noexcept |
| double | true_phase_jd (double lunation_index, double phase_fraction) const noexcept |
Static Private Member Functions | |
| static double | julian_day_from_unix_seconds (double unix_utc_s) noexcept |
| static int | year_from_unix_seconds (double unix_utc_s) noexcept |
| static int | month_from_unix_seconds (double unix_utc_s) noexcept |
| static double | jd_to_unix_seconds (double julian_day) noexcept |
| static double | deg2rad (double deg) noexcept |
| static double | rad2deg (double rad) noexcept |
| static double | fix_angle (double a) noexcept |
| static double | kepler (double m_deg, double ecc) noexcept |
| static bool | is_within_window (double unix_utc_s, double previous_instant, double next_instant, double window_seconds) noexcept |
Static Private Attributes | |
| static constexpr double | kEpochJd = 2444238.5 |
| static constexpr double | kElonge = 278.833540 |
| static constexpr double | kElongp = 282.596403 |
| static constexpr double | kEccent = 0.016718 |
| static constexpr double | kSunSmax = 1.495985e8 |
| static constexpr double | kSunAngSiz = 0.533128 |
| static constexpr double | kMmLong = 64.975464 |
| static constexpr double | kMmLongp = 349.383063 |
| static TIME_SHIELD_MAYBE_UNUSED constexpr double | kMNode = 151.950429 |
| static TIME_SHIELD_MAYBE_UNUSED constexpr double | kMInc = 5.145396 |
| static constexpr double | kMecc = 0.054900 |
| static constexpr double | kMAngSiz = 0.5181 |
| static constexpr double | kMsMax = 384401.0 |
| static TIME_SHIELD_MAYBE_UNUSED constexpr double | kMParallax = 0.9507 |
| static constexpr double | kSynMonth = 29.53058868 |
| static constexpr double | kPi = 3.14159265358979323846 |
Moon phase calculator (geocentric approximation).
References:
Notes:
Example usage:
Definition at line 68 of file MoonPhase.hpp.
| using time_shield::astronomy::MoonPhase::quarters_unix_s_t = std::array<double, 8> |
Quarter instants as Unix UTC seconds ({new, firstQ, full, lastQ} for previous and next cycles).
Definition at line 70 of file MoonPhase.hpp.
|
inlinenoexcept |
Compute full set of Moon phase parameters for given UTC timestamp.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
Definition at line 76 of file MoonPhase.hpp.
|
inlinenoexcept |
Compute only phase fraction in [0..1) for given UTC timestamp.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
interval where 0=new moon, 0.5=full moon. Definition at line 138 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 293 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 296 of file MoonPhase.hpp.
|
inlinenoexcept |
Check whether timestamp is inside a window around first quarter.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
Definition at line 241 of file MoonPhase.hpp.
|
inlinenoexcept |
Check whether timestamp is inside a window around full moon.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
Definition at line 232 of file MoonPhase.hpp.
|
inlinenoexcept |
Check whether timestamp is inside a window around last quarter.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
Definition at line 250 of file MoonPhase.hpp.
|
inlinenoexcept |
Check whether timestamp is inside a window around new moon.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
Definition at line 223 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 389 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 268 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 256 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 302 of file MoonPhase.hpp.
|
inlineprivatenoexcept |
Definition at line 314 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 264 of file MoonPhase.hpp.
|
inlinenoexcept |
Quarter instants around the provided timestamp as a structured result (Unix UTC seconds).
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
Definition at line 205 of file MoonPhase.hpp.
|
inlinenoexcept |
Compatibility wrapper returning quarter instants as Unix UTC seconds.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
Definition at line 198 of file MoonPhase.hpp.
|
inlinenoexcept |
Compute quarter/new/full instants around given timestamp.
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
Definition at line 145 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 294 of file MoonPhase.hpp.
|
inlineprivatenoexcept |
Definition at line 325 of file MoonPhase.hpp.
|
inlinestaticprivatenoexcept |
Definition at line 260 of file MoonPhase.hpp.
|
staticconstexpr |
Default window around phase events (12h).
Definition at line 71 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 277 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 275 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 276 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 273 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 286 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 285 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 284 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 281 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 282 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 283 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 288 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 287 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 291 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 279 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 278 of file MoonPhase.hpp.
|
staticconstexprprivate |
Definition at line 289 of file MoonPhase.hpp.