12
#include <celcompat/numbers.h>
16
namespace celestia::astro
21
getLengthScale(LengthUnit unit)
25
case LengthUnit::Kilometer: return 1.0;
26
case LengthUnit::Meter: return 1e-3;
27
case LengthUnit::EarthRadius: return EARTH_RADIUS<double>;
28
case LengthUnit::JupiterRadius: return JUPITER_RADIUS<double>;
29
case LengthUnit::SolarRadius: return SOLAR_RADIUS<double>;
30
case LengthUnit::AstronomicalUnit: return KM_PER_AU<double>;
31
case LengthUnit::LightYear: return KM_PER_LY<double>;
32
case LengthUnit::Parsec: return KM_PER_PARSEC<double>;
33
case LengthUnit::Kiloparsec: return 1e3 * KM_PER_PARSEC<double>;
34
case LengthUnit::Megaparsec: return 1e6 * KM_PER_PARSEC<double>;
35
default: return std::nullopt;
42
getTimeScale(TimeUnit unit)
46
case TimeUnit::Second: return 1.0 / SECONDS_PER_DAY;
47
case TimeUnit::Minute: return 1.0 / MINUTES_PER_DAY;
48
case TimeUnit::Hour: return 1.0 / HOURS_PER_DAY;
49
case TimeUnit::Day: return 1.0;
50
case TimeUnit::JulianYear: return DAYS_PER_YEAR;
51
default: return std::nullopt;
58
getAngleScale(AngleUnit unit)
62
case AngleUnit::Milliarcsecond: return 1e-3 / SECONDS_PER_DEG;
63
case AngleUnit::Arcsecond: return 1.0 / SECONDS_PER_DEG;
64
case AngleUnit::Arcminute: return 1.0 / MINUTES_PER_DEG;
65
case AngleUnit::Degree: return 1.0;
66
case AngleUnit::Hour: return DEG_PER_HRA;
67
case AngleUnit::Radian: return 180.0 / celestia::numbers::pi;
68
default: return std::nullopt;
73
getMassScale(MassUnit unit)
77
case MassUnit::Kilogram: return 1.0 / EarthMass;
78
case MassUnit::EarthMass: return 1.0;
79
case MassUnit::JupiterMass: return JupiterMass / EarthMass;
80
default: return std::nullopt;