Moon phase calculator (geocentric approximation).
More...
#include <MoonPhase.hpp>
|
| using | quarters_unix_s_t = std::array<double, 8> |
| | Quarter instants as Unix UTC seconds ({new, firstQ, full, lastQ} for previous and next cycles).
|
| |
|
| 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 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:
- Input timestamps are assumed to be UTC Unix seconds (can be floating).
- Computation is geocentric (no observer latitude/longitude corrections).
Example usage:
double ts = 1704067200.0;
bool near_full = calculator.is_full_moon_window(
ts, 3600.0);
Moon phase calculator (geocentric approximation).
std::array< double, 8 > quarters_unix_s_t
Quarter instants as Unix UTC seconds ({new, firstQ, full, lastQ} for previous and next cycles).
ts_t ts() noexcept
Get the current UTC timestamp in seconds.
Main namespace for the Time Shield library.
Result of Moon phase computation (geocentric approximation).
Lunar quarter instants (Unix UTC seconds, floating).
Definition at line 68 of file MoonPhase.hpp.
◆ quarters_unix_s_t
Quarter instants as Unix UTC seconds ({new, firstQ, full, lastQ} for previous and next cycles).
Definition at line 70 of file MoonPhase.hpp.
◆ compute()
| MoonPhaseResult time_shield::astronomy::MoonPhase::compute |
( |
double | unix_utc_s | ) |
const |
|
inlinenoexcept |
Compute full set of Moon phase parameters for given UTC timestamp.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
- Returns
- Geocentric Moon phase parameters for the given instant.
Definition at line 76 of file MoonPhase.hpp.
◆ compute_phase()
| double time_shield::astronomy::MoonPhase::compute_phase |
( |
double | unix_utc_s | ) |
const |
|
inlinenoexcept |
Compute only phase fraction in [0..1) for given UTC timestamp.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
- Returns
- Phase fraction in the \([0, 1)\) interval where 0=new moon, 0.5=full moon.
Definition at line 138 of file MoonPhase.hpp.
◆ deg2rad()
| static double time_shield::astronomy::MoonPhase::deg2rad |
( |
double | deg | ) |
|
|
inlinestaticprivatenoexcept |
◆ fix_angle()
| static double time_shield::astronomy::MoonPhase::fix_angle |
( |
double | a | ) |
|
|
inlinestaticprivatenoexcept |
◆ is_first_quarter_window()
| bool time_shield::astronomy::MoonPhase::is_first_quarter_window |
( |
double | unix_utc_s, |
|
|
double | window_seconds = kDefaultQuarterWindow_s ) const |
|
inlinenoexcept |
Check whether timestamp is inside a window around first quarter.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
- Returns
- true if the timestamp lies within the window of the previous or next first quarter.
Definition at line 241 of file MoonPhase.hpp.
◆ is_full_moon_window()
| bool time_shield::astronomy::MoonPhase::is_full_moon_window |
( |
double | unix_utc_s, |
|
|
double | window_seconds = kDefaultQuarterWindow_s ) const |
|
inlinenoexcept |
Check whether timestamp is inside a window around full moon.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
- Returns
- true if the timestamp lies within the window of the previous or next full moon.
Definition at line 232 of file MoonPhase.hpp.
◆ is_last_quarter_window()
| bool time_shield::astronomy::MoonPhase::is_last_quarter_window |
( |
double | unix_utc_s, |
|
|
double | window_seconds = kDefaultQuarterWindow_s ) const |
|
inlinenoexcept |
Check whether timestamp is inside a window around last quarter.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
- Returns
- true if the timestamp lies within the window of the previous or next last quarter.
Definition at line 250 of file MoonPhase.hpp.
◆ is_new_moon_window()
| bool time_shield::astronomy::MoonPhase::is_new_moon_window |
( |
double | unix_utc_s, |
|
|
double | window_seconds = kDefaultQuarterWindow_s ) const |
|
inlinenoexcept |
Check whether timestamp is inside a window around new moon.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
| window_seconds | Symmetric window size in seconds around the event time. |
- Returns
- true if the timestamp lies within the window of the previous or next new moon.
Definition at line 223 of file MoonPhase.hpp.
◆ is_within_window()
| static bool time_shield::astronomy::MoonPhase::is_within_window |
( |
double | unix_utc_s, |
|
|
double | previous_instant, |
|
|
double | next_instant, |
|
|
double | window_seconds ) |
|
inlinestaticprivatenoexcept |
◆ jd_to_unix_seconds()
| static double time_shield::astronomy::MoonPhase::jd_to_unix_seconds |
( |
double | julian_day | ) |
|
|
inlinestaticprivatenoexcept |
◆ julian_day_from_unix_seconds()
| static double time_shield::astronomy::MoonPhase::julian_day_from_unix_seconds |
( |
double | unix_utc_s | ) |
|
|
inlinestaticprivatenoexcept |
◆ kepler()
| static double time_shield::astronomy::MoonPhase::kepler |
( |
double | m_deg, |
|
|
double | ecc ) |
|
inlinestaticprivatenoexcept |
◆ mean_phase_jd()
| double time_shield::astronomy::MoonPhase::mean_phase_jd |
( |
double | julian_day, |
|
|
double | lunation_index ) const |
|
inlineprivatenoexcept |
◆ month_from_unix_seconds()
| static int time_shield::astronomy::MoonPhase::month_from_unix_seconds |
( |
double | unix_utc_s | ) |
|
|
inlinestaticprivatenoexcept |
◆ quarter_instants_unix()
| MoonQuarterInstants time_shield::astronomy::MoonPhase::quarter_instants_unix |
( |
double | unix_utc_s | ) |
const |
|
inlinenoexcept |
Quarter instants around the provided timestamp as a structured result (Unix UTC seconds).
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
- Returns
- Previous/next quarter instants mapped into a structured result with Unix UTC seconds.
Definition at line 205 of file MoonPhase.hpp.
◆ quarter_times()
| quarters_unix_s_t time_shield::astronomy::MoonPhase::quarter_times |
( |
double | unix_utc_s | ) |
const |
|
inlinenoexcept |
Compatibility wrapper returning quarter instants as Unix UTC seconds.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
- Returns
- Same payload as quarter_times_unix() for compatibility.
Definition at line 198 of file MoonPhase.hpp.
◆ quarter_times_unix()
| quarters_unix_s_t time_shield::astronomy::MoonPhase::quarter_times_unix |
( |
double | unix_utc_s | ) |
const |
|
inlinenoexcept |
Compute quarter/new/full instants around given timestamp.
- Parameters
-
| unix_utc_s | Timestamp in Unix UTC seconds (can be fractional). |
- Returns
- Array of 8 instants (Unix UTC seconds as double): {prev new, prev firstQ, prev full, prev lastQ, next new, next firstQ, next full, next lastQ}.
Definition at line 145 of file MoonPhase.hpp.
◆ rad2deg()
| static double time_shield::astronomy::MoonPhase::rad2deg |
( |
double | rad | ) |
|
|
inlinestaticprivatenoexcept |
◆ true_phase_jd()
| double time_shield::astronomy::MoonPhase::true_phase_jd |
( |
double | lunation_index, |
|
|
double | phase_fraction ) const |
|
inlineprivatenoexcept |
◆ year_from_unix_seconds()
| static int time_shield::astronomy::MoonPhase::year_from_unix_seconds |
( |
double | unix_utc_s | ) |
|
|
inlinestaticprivatenoexcept |
◆ kDefaultQuarterWindow_s
| double time_shield::astronomy::MoonPhase::kDefaultQuarterWindow_s = 43200.0 |
|
staticconstexpr |
Default window around phase events (12h).
Definition at line 71 of file MoonPhase.hpp.
◆ kEccent
| double time_shield::astronomy::MoonPhase::kEccent = 0.016718 |
|
staticconstexprprivate |
◆ kElonge
| double time_shield::astronomy::MoonPhase::kElonge = 278.833540 |
|
staticconstexprprivate |
◆ kElongp
| double time_shield::astronomy::MoonPhase::kElongp = 282.596403 |
|
staticconstexprprivate |
◆ kEpochJd
| double time_shield::astronomy::MoonPhase::kEpochJd = 2444238.5 |
|
staticconstexprprivate |
◆ kMAngSiz
| double time_shield::astronomy::MoonPhase::kMAngSiz = 0.5181 |
|
staticconstexprprivate |
◆ kMecc
| double time_shield::astronomy::MoonPhase::kMecc = 0.054900 |
|
staticconstexprprivate |
◆ kMInc
| TIME_SHIELD_MAYBE_UNUSED constexpr double time_shield::astronomy::MoonPhase::kMInc = 5.145396 |
|
staticconstexprprivate |
◆ kMmLong
| double time_shield::astronomy::MoonPhase::kMmLong = 64.975464 |
|
staticconstexprprivate |
◆ kMmLongp
| double time_shield::astronomy::MoonPhase::kMmLongp = 349.383063 |
|
staticconstexprprivate |
◆ kMNode
| TIME_SHIELD_MAYBE_UNUSED constexpr double time_shield::astronomy::MoonPhase::kMNode = 151.950429 |
|
staticconstexprprivate |
◆ kMParallax
| TIME_SHIELD_MAYBE_UNUSED constexpr double time_shield::astronomy::MoonPhase::kMParallax = 0.9507 |
|
staticconstexprprivate |
◆ kMsMax
| double time_shield::astronomy::MoonPhase::kMsMax = 384401.0 |
|
staticconstexprprivate |
◆ kPi
| double time_shield::astronomy::MoonPhase::kPi = 3.14159265358979323846 |
|
staticconstexprprivate |
◆ kSunAngSiz
| double time_shield::astronomy::MoonPhase::kSunAngSiz = 0.533128 |
|
staticconstexprprivate |
◆ kSunSmax
| double time_shield::astronomy::MoonPhase::kSunSmax = 1.495985e8 |
|
staticconstexprprivate |
◆ kSynMonth
| double time_shield::astronomy::MoonPhase::kSynMonth = 29.53058868 |
|
staticconstexprprivate |
The documentation for this class was generated from the following file: