|
CelestialCalendar 1.0.0 · unreleased development @ 67a7c4c79a4a4a6aa7e703c9e6f0039ae34bee82
|
#include <cmath>#include <format>#include <limits>#include <cstddef>#include <numbers>#include <numeric>#include <cstdint>#include <concepts>#include <algorithm>#include <stdexcept>#include <type_traits>Classes | |
| struct | astro::toolbox::Angle< Unit > |
| Represents an angle. More... | |
| struct | astro::toolbox::Distance< Unit > |
| Represents a distance. More... | |
| struct | astro::toolbox::SphericalCoordinate |
| Represents a position in a spherical coordinate system. More... | |
| struct | astro::toolbox::GoldenSectionRules< LowerProbe, MoveLower, Finished > |
| Arithmetic, comparison and stopping rules supplied by an extremum-search caller. More... | |
| struct | astro::toolbox::GoldenSectionBracket |
| The final bracket; converged is false when the update budget runs out. More... | |
Namespaces | |
| namespace | astro |
| namespace | astro::toolbox |
| namespace | astro::toolbox::literals |
Typedefs | |
| using | astro::toolbox::AngleDeg |
| An angle measured in degrees. | |
| using | astro::toolbox::AngleRad |
| using | astro::toolbox::DistanceAu |
| A distance measured in astronomical units; see AngleDeg for the alias convention. | |
| using | astro::toolbox::DistanceKm |
Enumerations | |
| enum class | astro::toolbox::AngleUnit : uint8_t { astro::toolbox::RAD , astro::toolbox::DEG } |
| enum class | astro::toolbox::DistanceUnit : uint8_t { astro::toolbox::AU , astro::toolbox::KM } |
| The unit of distance, either AU or KM. More... | |
Functions | |
| constexpr auto | astro::toolbox::normalize_deg (const double deg) -> double |
| Normalize degree to [0, 360). | |
| constexpr auto | astro::toolbox::normalize_rad (const double rad) -> double |
| Normalize radian to [0, 2π). | |
| constexpr auto | astro::toolbox::normalize_pm180 (const double deg) -> double |
| Normalize degree to [-180, 180). Useful for hour angles, where sign carries meaning. | |
| auto | astro::toolbox::remainder_deg (const double difference_deg) -> double |
| Return the IEEE remainder in [-180°, 180°], retaining signed zero and either sign at 180°. | |
| auto | astro::toolbox::unwrap_near (const double wrapped_deg, const double reference_deg) -> double |
| Shift an angle by whole turns toward a reference, without normalizing either input. | |
| constexpr auto | astro::toolbox::deg_to_rad (const double deg) -> double |
| Convert degree to radian. | |
| constexpr auto | astro::toolbox::rad_to_deg (const double rad) -> double |
| Convert radian to degree. | |
| constexpr auto | astro::toolbox::arcmin_to_deg (const double arcmin) -> double |
| Convert minutes to degrees. | |
| constexpr auto | astro::toolbox::arcsec_to_deg (const double arcsec) -> double |
| Convert seconds to degrees. | |
| auto | astro::toolbox::canonical_longitude_difference (const AngleDeg difference) -> AngleDeg |
| Canonicalize a finite directed longitude difference to (-180, 180] degrees. | |
| constexpr auto | astro::toolbox::literals::operator""_deg (const long double value) -> AngleDeg |
| constexpr auto | astro::toolbox::literals::operator""_arcmin (const long double value) -> AngleDeg |
| constexpr auto | astro::toolbox::literals::operator""_arcsec (const long double value) -> AngleDeg |
| constexpr auto | astro::toolbox::literals::operator""_rad (const long double value) -> AngleRad |
| constexpr auto | astro::toolbox::au_to_km (const double au) -> double |
| Convert from AU to KM. | |
| constexpr auto | astro::toolbox::km_to_au (const double km) -> double |
| Convert from KM to AU. | |
| auto | astro::toolbox::ulp (const double x) -> double |
| The gap between x and the next representable double — one unit in the last place. | |
| template<typename Func> requires std::invocable<const Func&, double> and std::convertible_to<std::invoke_result_t<const Func&, double>, double> | |
| auto | astro::toolbox::newton_method (const Func &f, const double start_jde, const double end_jde, const double mean_rate_deg_per_day, const std::size_t max_iterations=NEWTON_MAX_ITERATIONS) -> double |
| Apply Newton's method to find the JDE at which f crosses zero. | |
| template<typename Func, typename Rules> requires std::invocable<const Func&, double> and std::convertible_to<std::invoke_result_t<const Func&, double>, double> | |
| auto | astro::toolbox::golden_section_bracket (const Func &f, const double lower, const double upper, const double tolerance, const std::size_t maximum_updates, const Rules &rules) -> GoldenSectionBracket |
| Contract a unimodal bracket using the caller's numerical rules. | |
Variables | |
| constexpr double | astro::toolbox::DEG_PER_RAD |
| The number of degrees in a radian. | |
| constexpr double | astro::toolbox::LONGITUDE_PERIOD_DEG |
| The angular period of an ecliptic longitude, in degrees. | |
| constexpr double | astro::toolbox::SIDEREAL_RATE_DEG_PER_DAY |
| The mean angular rate of Earth's rotation relative to the stars, in degrees per day. Used to convert between time offsets and hour angle offsets. | |
| constexpr double | astro::toolbox::SOLAR_MEAN_MOTION_DEG_PER_DAY |
| The Sun's mean apparent motion along the ecliptic, in degrees per day. A tropical year of 365.2422 days carries it through a full 360°. | |
| constexpr double | astro::toolbox::MOON_ELONGATION_RATE_DEG_PER_DAY |
| The mean rate at which the Moon's apparent longitude pulls away from the Sun's, in degrees per day. A synodic month of 29.530588853 days closes a full 360°. | |
| constexpr uint32_t | astro::toolbox::MIN_PER_DEG |
| The number of minutes in a degree. | |
| constexpr uint32_t | astro::toolbox::SEC_PER_MIN |
| The number of seconds in a minute. | |
| constexpr uint32_t | astro::toolbox::SEC_PER_DEG |
| The number of seconds in a degree. | |
| constexpr double | astro::toolbox::AU_KM_SCALE |
| The scaling factor from AU to KM. | |
| constexpr double | astro::toolbox::NEWTON_INITIAL_STEP_DAYS |
| The initial half-width of the central difference approximating f', in days. | |
| constexpr double | astro::toolbox::NEWTON_MIN_STEP_ULP |
| The floor on that half-width, as a multiple of ulp(jde). | |
| constexpr double | astro::toolbox::NEWTON_RESIDUAL_TOL_ULP |
| The residual tolerance, as a multiple of the angle swept during one ulp(jde). | |
| constexpr std::size_t | astro::toolbox::NEWTON_MAX_ITERATIONS |
| The Newton iteration budget. | |
| constexpr double | astro::toolbox::INV_PHI |
| (√5 − 1)/2, rounded directly to binary64. | |
| constexpr double | astro::toolbox::INV_PHI_SQ |
| (3 − √5)/2, rounded independently of INV_PHI. | |