Kstars

ksnumbers.h
1/*
2 SPDX-FileCopyrightText: 2002-2005 Jason Harris <kstars@30doradus.org>
3 SPDX-FileCopyrightText: 2004-2005 Pablo de Vicente <p.devicente@wanadoo.es>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "cachingdms.h"
11
12#if __GNUC__ > 5
13#pragma GCC diagnostic push
14#pragma GCC diagnostic ignored "-Wignored-attributes"
15#endif
16#if __GNUC__ > 6
17#pragma GCC diagnostic ignored "-Wint-in-bool-context"
18#endif
19#include <Eigen/Core>
20#if __GNUC__ > 5
21#pragma GCC diagnostic pop
22#endif
23
24#define NUTTERMS 63
25
26/** @class KSNumbers
27 *
28 *There are several time-dependent values used in position calculations,
29 *that are not specific to an object. This class provides
30 *storage for these values, and methods for calculating them for a given date.
31 *The numbers include solar data like the true/mean solar anomalies
32 *and longitudes, the longitude of the Earth's perihelion, the
33 *eccentricity of Earth's orbit, the
34 *constant of aberration, the obliquity of the Ecliptic, the effects of
35 *Nutation (delta Obliquity and delta Ecliptic longitude),
36 *the Julian Day/Century/Millenium, and arrays for computing the precession.
37 *@short Store several time-dependent astronomical quantities.
38 *@author Jason Harris
39 *@version 1.0
40 */
41
43{
44 public:
45 /**
46 * Constructor.
47 * @param jd Julian Day for which the new instance is initialized
48 */
49 explicit KSNumbers(long double jd);
50 ~KSNumbers() = default;
51
52 /**
53 * @return the current Obliquity (the angle of inclination between
54 * the celestial equator and the ecliptic)
55 */
56 inline const CachingDms *obliquity() const { return &Obliquity; }
57
58 /** @return the constant of aberration (20.49 arcsec). */
59 inline dms constAberr() const { return K; }
60
61 /** @return the mean solar anomaly. */
62 inline dms sunMeanAnomaly() const { return M; }
63
64 /** @return the mean solar longitude. */
65 inline dms sunMeanLongitude() const { return L; }
66
67 /** @return the true solar anomaly. */
68 inline dms sunTrueAnomaly() const { return M0; }
69
70 /** @return the true solar longitude. */
71 inline CachingDms sunTrueLongitude() const { return L0; }
72
73 /** @return the longitude of the Earth's perihelion point. */
74 inline CachingDms earthPerihelionLongitude() const { return P; }
75
76 /** @return eccentricity of Earth's orbit.*/
77 inline double earthEccentricity() const { return e; }
78
79 /** @return the change in obliquity due to the nutation of
80 * Earth's orbit. Value is in degrees */
81 inline double dObliq() const { return deltaObliquity; }
82
83 /** @return the change in Ecliptic Longitude due to nutation.
84 * Value is in degrees. */
85 inline double dEcLong() const { return deltaEcLong; }
86
87 /** @return Julian centuries since J2000*/
88 inline double julianCenturies() const { return T; }
89
90 /** @return Julian Day*/
91 inline long double julianDay() const { return days; }
92
93 /** @return Julian Millenia since J2000*/
94 inline double julianMillenia() const { return jm; }
95
96 /** @return element of P1 precession array at position (i1, i2) */
97 inline double p1(int i1, int i2) const { return P1(i1, i2); }
98
99 /** @return element of P2 precession array at position (i1, i2) */
100 inline double p2(int i1, int i2) const { return P2(i1, i2); }
101
102 /** @return element of P1B precession array at position (i1, i2) */
103 inline double p1b(int i1, int i2) const { return P1B(i1, i2); }
104
105 /** @return element of P2B precession array at position (i1, i2) */
106 inline double p2b(int i1, int i2) const { return P2B(i1, i2); }
107
108 /** @return the precession matrix directly **/
109 inline const Eigen::Matrix3d &p2() const { return P1; }
110 inline const Eigen::Matrix3d &p1() const { return P2; }
111 inline const Eigen::Matrix3d &p1b() const { return P1B; }
112 inline const Eigen::Matrix3d &p2b() const { return P2B; }
113
114 /**
115 * @short compute constant values that need to be computed only once per instance of the application
116 */
118
119 /**
120 * @short update all values for the date given as an argument.
121 * @param jd the Julian date for which to compute values
122 */
123 void updateValues(long double jd);
124
125 /**
126 * @return the JD for which these values hold (i.e. the last updated JD)
127 */
128 inline long double getJD() const { return days; }
129
130 inline double vEarth(int i) const { return vearth[i]; }
131
132 private:
133 CachingDms Obliquity, L0, P;
134 dms K, L, LM, M, M0, O, D, MM, F;
135 dms XP, YP, ZP, XB, YB, ZB;
136 double CX, SX, CY, SY, CZ, SZ;
137 double CXB, SXB, CYB, SYB, CZB, SZB;
138 Eigen::Matrix3d P1, P2, P1B, P2B;
139 double deltaObliquity, deltaEcLong;
140 double e, T;
141 long double days; // JD for which the last update was called
142 double jm;
143 static const int arguments[NUTTERMS][5];
144 static const int amp[NUTTERMS][4];
145 double vearth[3];
146};
a dms subclass that caches its sine and cosine values every time the angle is changed.
Definition cachingdms.h:19
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
double p1(int i1, int i2) const
Definition ksnumbers.h:97
dms constAberr() const
Definition ksnumbers.h:59
dms sunTrueAnomaly() const
Definition ksnumbers.h:68
double p1b(int i1, int i2) const
Definition ksnumbers.h:103
CachingDms earthPerihelionLongitude() const
Definition ksnumbers.h:74
const Eigen::Matrix3d & p2() const
Definition ksnumbers.h:109
dms sunMeanLongitude() const
Definition ksnumbers.h:65
CachingDms sunTrueLongitude() const
Definition ksnumbers.h:71
void updateValues(long double jd)
update all values for the date given as an argument.
const CachingDms * obliquity() const
Definition ksnumbers.h:56
long double getJD() const
Definition ksnumbers.h:128
double dEcLong() const
Definition ksnumbers.h:85
double julianMillenia() const
Definition ksnumbers.h:94
double dObliq() const
Definition ksnumbers.h:81
KSNumbers(long double jd)
Constructor.
Definition ksnumbers.cpp:93
void computeConstantValues()
compute constant values that need to be computed only once per instance of the application
dms sunMeanAnomaly() const
Definition ksnumbers.h:62
double julianCenturies() const
Definition ksnumbers.h:88
double p2(int i1, int i2) const
Definition ksnumbers.h:100
double earthEccentricity() const
Definition ksnumbers.h:77
long double julianDay() const
Definition ksnumbers.h:91
double p2b(int i1, int i2) const
Definition ksnumbers.h:106
An angle, stored as degrees, but expressible in many ways.
Definition dms.h:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.