3#ifndef _TIME_SHIELD_ASTRONOMY_CONVERSIONS_HPP_INCLUDED
4#define _TIME_SHIELD_ASTRONOMY_CONVERSIONS_HPP_INCLUDED
24 constexpr MoonPhaseSineCosine(
double phase_sin_value,
double phase_cos_value,
double phase_angle_rad_value) noexcept
36 double temp = (
static_cast<double>(
fts_to_jd(
ts)) - 2451550.1) / 29.530588853;
37 temp = temp - std::floor(temp);
38 if (temp < 0.0) temp += 1.0;
55 const auto result = calculator.
compute(
static_cast<double>(
ts));
Geocentric Moon phase calculator and result helpers.
Moon phase calculator (geocentric approximation).
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_first_quarter_window(double unix_utc_s, double window_seconds=kDefaultQuarterWindow_s) const noexcept
Check whether timestamp is inside a window around first quarter.
MoonPhaseResult compute(double unix_utc_s) const noexcept
Compute full set of Moon phase parameters for given UTC timestamp.
MoonQuarterInstants quarter_instants_unix(double unix_utc_s) const noexcept
Quarter instants around the provided timestamp as a structured result (Unix UTC seconds).
static constexpr double kDefaultQuarterWindow_s
Default window around phase events (12h).
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.
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.
Configuration macros for the library.
TIME_SHIELD_CONSTEXPR ts_t ts(year_t year, int month, int day)
Alias for to_timestamp.
double fts_t
Floating-point timestamp (fractional seconds since epoch).
Julian Date / MJD / JDN helpers using the proleptic Gregorian calendar.
Main namespace for the Time Shield library.
double moon_age_days_jd_approx(fts_t ts) noexcept
Get lunar age in days (~0..29.53) using a simple Julian Day approximation.
bool is_new_moon_window(fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
Check if timestamp falls into the new moon window (default \pm12h).
jd_t fts_to_jd(fts_t ts) noexcept
Convert Unix timestamp (floating seconds) to Julian Date (JD).
bool is_last_quarter_window(fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
Check if timestamp falls into the last quarter window (default \pm12h).
double moon_age_days(fts_t ts) noexcept
Get lunar age in days (~0..29.53).
double moon_phase(fts_t ts) noexcept
Get lunar phase in range [0..1) using the geocentric MoonPhase calculator.
double moon_phase_jd_approx(fts_t ts) noexcept
Get lunar phase in range [0..1) using a simple Julian Day approximation.
bool is_full_moon_window(fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
Check if timestamp falls into the full moon window (default \pm12h).
astronomy::MoonQuarterInstants moon_quarters(fts_t ts) noexcept
Quarter instants around the provided timestamp.
double moon_illumination(fts_t ts) noexcept
Get illuminated fraction in range [0..1] using the geocentric MoonPhase calculator.
bool is_first_quarter_window(fts_t ts, double window_seconds=astronomy::MoonPhase::kDefaultQuarterWindow_s) noexcept
Check if timestamp falls into the first quarter window (default \pm12h).
MoonPhaseSineCosine moon_phase_sincos(fts_t ts) noexcept
Get sin/cos of the lunar phase angle (continuous signal without wrap-around).
sin/cos helper for the Moon phase angle.
double phase_sin
sin(phase angle), continuous around 0/2pi.
constexpr MoonPhaseSineCosine()=default
double phase_angle_rad
Phase angle in radians [0..2*pi).
double phase_cos
cos(phase angle), continuous around 0/2pi.
constexpr MoonPhaseSineCosine(double phase_sin_value, double phase_cos_value, double phase_angle_rad_value) noexcept
double phase
Phase fraction in [0..1). 0=new moon, 0.5=full moon.
double age_days
Age of the Moon in days since new moon (approx).
double illumination
Illuminated fraction in [0..1].
Lunar quarter instants (Unix UTC seconds, floating).