CelestialCalendar 1.0.0 · unreleased development @ 67a7c4c79a4a4a6aa7e703c9e6f0039ae34bee82
Loading...
Searching...
No Matches
astro::moon_phase::detail Namespace Reference

Classes

struct  RootGenerator
 Eager-by-one Moon-phase roots in JDE(TT); next refines the following root before returning. More...

Enumerations

enum class  NumericPolicy : uint8_t { CONJUNCTION , PHASE }
 The existing conjunction and principal-phase numerical conventions. More...

Functions

template<NumericPolicy POLICY>
auto 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 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 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 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 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 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 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 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 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 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 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.

Variables

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

Enumeration Type Documentation

◆ NumericPolicy

enum class astro::moon_phase::detail::NumericPolicy : uint8_t
strong

The existing conjunction and principal-phase numerical conventions.

Enumerator
CONJUNCTION 
PHASE 

Function Documentation

◆ bracket_rejected()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::bracket_rejected ( const double left_diff,
const double right_diff,
const double target_deg )->bool
inlinenodiscard

Reject endpoints outside the policy's local branch.

Note
Only conjunction accepts a right endpoint whose elongation is exactly +0.0°.

◆ first_root_after()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::first_root_after ( const double jde,
const double target_deg )->double
inlinenodiscard

Estimate, bracket and refine the first root after a JDE(TT).

◆ first_root_range_after()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::first_root_range_after ( const double jde,
const double target_deg )->std::pair< double, double >
inlinenodiscard

Approximate the range of the first root after the given JDE for a target elongation.

Parameters
jdeThe JDE on the TT scale.
target_degZero for conjunction, a principal elongation otherwise.
Returns
The bracket [left, right) containing the first root after jde.
Exceptions
std::invalid_argumentIf the mean-rate estimate lands too far from the target.

◆ miss_at()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::miss_at ( const double diff,
const double target_deg )->double
inlinenodiscard

Signed mean-rate miss; conjunction keeps +180°, principal phases fold it to -180°.

◆ newton_method()

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
inlinenodiscard

Refine a root in [left_jde, right_jde), on the TT scale.

Precondition
The endpoints bracket a root on the policy's continuous branch; conjunction has target 0°.
Parameters
iterationsThe Newton iteration cap; zero retains the bracket midpoint.
Exceptions
std::invalid_argumentIf the endpoints fail the policy's bracket check.

◆ next_root()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::next_root ( const double jde,
const double target_deg )->double
inlinenodiscard

Find the next root after a known root for the same target elongation.

Parameters
jdeThe known root JDE.
target_degThe target elongation, in degrees.
Returns
The next root JDE.
Exceptions
std::invalid_argumentIf jde is not a root for the target.

◆ objective_at()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::objective_at ( const double diff,
const double target_deg )->double
inlinenodiscard

Map elongation to the Newton objective; conjunction uses its local near-360° unwrap.

Note
Subtracting 360° only above 345° keeps the conjunction branch continuous near the root. It is not the principal phase's global [-180°, 180°) fold.
Precondition
diff is in [0°, 360°); target_deg is 0° for conjunction, a principal elongation otherwise.

◆ reject_bracket()

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
inline

Report rejected endpoints using the policy's raw or folded elongations.

◆ reject_estimate()

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
inline

Report an estimate outside the refinement allowance without reevaluating positions.

◆ reject_seed()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::reject_seed ( const double jde,
const double target_deg )->void
inline

Report a candidate root time whose elongation misses the target by more than one degree.

◆ roots_before()

template<NumericPolicy POLICY>
auto astro::moon_phase::detail::roots_before ( RootGenerator< POLICY > gen,
const double end_jde )->std::vector< double >
inlinenodiscard

Collect roots strictly before end_jde, testing each root only after next() advances.

Variable Documentation

◆ BRACKET_HALF_WIDTH_DAYS

double astro::moon_phase::detail::BRACKET_HALF_WIDTH_DAYS
inlineconstexpr

Half the width of the bracket handed to Newton's method, in days.

Note
A 14.5°/day rate is about 19% above the 12.19°/day mean: correcting a 30° miss can leave about 30 / 12.19 * 0.19 = 0.47 day of timing error, below this half-width. Including that error, endpoints lie within about 0.47 + 0.5 = 0.97 day of the root: 0.97 * 14.5 ≈ 14.1°, still below the 15° endpoint tolerance.

◆ BRACKET_TOLERANCE_DEG

double astro::moon_phase::detail::BRACKET_TOLERANCE_DEG
inlineconstexpr

How near the target elongation a bracket endpoint must sit before Newton's method accepts it, in degrees.

◆ ESTIMATE_TOLERANCE_DEG

double astro::moon_phase::detail::ESTIMATE_TOLERANCE_DEG
inlineconstexpr

How far the mean-rate extrapolation may miss the root and still be worth refining, in degrees.