CelestialCalendar 1.0.0 · unreleased development @ 67a7c4c79a4a4a6aa7e703c9e6f0039ae34bee82
Loading...
Searching...
No Matches
moon_phase.hpp File Reference
#include <cmath>
#include <vector>
#include <format>
#include <cstddef>
#include <cstdint>
#include <stdexcept>
#include <utility>
#include "toolbox.hpp"
#include "julian_day.hpp"
#include "coord_transform.hpp"
#include "illumination.hpp"
#include "sun.hpp"
#include "moon.hpp"

Classes

struct  astro::moon_phase::detail::RootGenerator< POLICY >
 Eager-by-one Moon-phase roots in JDE(TT); next refines the following root before returning. More...

Namespaces

namespace  astro
namespace  astro::moon_phase
namespace  astro::moon_phase::phase_moments
namespace  astro::moon_phase::detail
namespace  astro::moon_phase::new_moon
namespace  astro::moon_phase::illumination

Typedefs

using astro::moon_phase::new_moon::RootGenerator
 Conjunction (朔) roots: equal Moon-Sun apparent longitude.
using astro::moon_phase::phase_moments::RootGenerator
 A generator for one principal phase, using its signed-fold numerical convention.

Enumerations

enum class  astro::moon_phase::phase_moments::PhaseKind : uint8_t { astro::moon_phase::phase_moments::NEW_MOON , astro::moon_phase::phase_moments::FIRST_QUARTER , astro::moon_phase::phase_moments::FULL_MOON , astro::moon_phase::phase_moments::LAST_QUARTER }
 The four principal Moon phases. More...
enum class  astro::moon_phase::detail::NumericPolicy : uint8_t { astro::moon_phase::detail::CONJUNCTION , astro::moon_phase::detail::PHASE }
 The existing conjunction and principal-phase numerical conventions. More...

Functions

auto astro::moon_phase::longitude_diff (const double jde) -> double
 Calculate the difference between the apparent longitudes of the Moon and the Sun.
auto astro::moon_phase::phase_moments::target_angle_deg (const PhaseKind kind) -> double
 The target elongation for a given phase, in degrees.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::objective_at (const double diff, const double target_deg) -> double
 Map elongation to the Newton objective; conjunction uses its local near-360° unwrap.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::miss_at (const double diff, const double target_deg) -> double
 Signed mean-rate miss; conjunction keeps +180°, principal phases fold it to -180°.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::bracket_rejected (const double left_diff, const double right_diff, const double target_deg) -> bool
 Reject endpoints outside the policy's local branch.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::reject_bracket (const double left_jde, const double left_diff, const double right_jde, const double right_diff, const double target_deg) -> void
 Report rejected endpoints using the policy's raw or folded elongations.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::reject_estimate (const double jde, const double est_jde, const double miss_deg, const double elongation_deg, const double target_deg) -> void
 Report an estimate outside the refinement allowance without reevaluating positions.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::reject_seed (const double jde, const double target_deg) -> void
 Report a candidate root time whose elongation misses the target by more than one degree.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::newton_method (const double left_jde, const double right_jde, const double target_deg, const std::size_t iterations=toolbox::NEWTON_MAX_ITERATIONS) -> double
 Refine a root in [left_jde, right_jde), on the TT scale.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::first_root_range_after (const double jde, const double target_deg) -> std::pair< double, double >
 Approximate the range of the first root after the given JDE for a target elongation.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::next_root (const double jde, const double target_deg) -> double
 Find the next root after a known root for the same target elongation.
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::first_root_after (const double jde, const double target_deg) -> double
 Estimate, bracket and refine the first root after a JDE(TT).
template<NumericPolicy POLICY>
auto astro::moon_phase::detail::roots_before (RootGenerator< POLICY > gen, const double end_jde) -> std::vector< double >
 Collect roots strictly before end_jde, testing each root only after next() advances.
auto astro::moon_phase::new_moon::moments (const int32_t year) -> std::vector< double >
 Calculate conjunctions of the Sun and Moon in a Gregorian year.
auto astro::moon_phase::phase_moments::moments (const int32_t year, const PhaseKind kind) -> std::vector< double >
 Calculate the moments of a given Moon phase in a Gregorian year.
auto astro::moon_phase::illumination::phase_angle (const toolbox::SphericalCoordinate &sun_pos, const toolbox::SphericalCoordinate &moon_pos) -> toolbox::AngleDeg
 Compute the Moon's selenocentric phase angle i from two positions, Meeus (48.2)+(48.3).
auto astro::moon_phase::illumination::phase_angle (const double jde) -> toolbox::AngleDeg
 Compute the Moon's selenocentric phase angle i at a JDE, Meeus (48.2)+(48.3).
auto astro::moon_phase::illumination::position_angle (const astro::coords::EquatorialCoord &sun_eq, const astro::coords::EquatorialCoord &moon_eq) -> toolbox::AngleDeg
 Compute the position angle χ of the Moon's bright limb, Meeus (48.5).
auto astro::moon_phase::illumination::position_angle (const double jde) -> toolbox::AngleDeg
 Compute the position angle χ of the Moon's bright limb at a JDE, Meeus (48.5).
auto astro::moon_phase::illumination::fraction (const toolbox::AngleDeg &i) -> double
 Compute the illuminated fraction k of the Moon's disk from the phase angle, Meeus (48.1).
auto astro::moon_phase::illumination::fraction (const double jde) -> double
 Compute the illuminated fraction k of the Moon's disk at a JDE, Meeus (48.1).

Variables

constexpr double astro::moon_phase::detail::BRACKET_TOLERANCE_DEG
 How near the target elongation a bracket endpoint must sit before Newton's method accepts it, in degrees.
constexpr double astro::moon_phase::detail::ESTIMATE_TOLERANCE_DEG
 How far the mean-rate extrapolation may miss the root and still be worth refining, in degrees.
constexpr double astro::moon_phase::detail::BRACKET_HALF_WIDTH_DAYS
 Half the width of the bracket handed to Newton's method, in days.