summaryrefslogtreecommitdiffstats
path: root/kstars/kstars/ksnumbers.h
blob: 1da4de99d01611044d91efc1aadc3750742f3a25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/***************************************************************************
                          ksnumbers.h  -  description
                             -------------------
    begin                : Sun Jan 13 2002
    copyright            : (C) 2002-2005 by Jason Harris
    email                : kstars@30doradus.org
    copyright            : (C) 2004-2005 by Pablo de Vicente
    email                : p.devicente@wanadoo.es
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KSNUMBERS_H
#define KSNUMBERS_H

#define NUTTERMS 63

#include "dms.h"

/**@class KSNumbers
	*
	*There are several time-dependent values used in position calculations,
	*that are not specific to an object.  This class provides
	*storage for these values, and methods for calculating them for a given date.
	*The numbers include solar data like the true/mean solar anomalies
	*and longitudes, the longitude of the Earth's perihelion, the
	*eccentricity of Earth's orbit, the
	*constant of aberration, the obliquity of the Ecliptic, the effects of
	*Nutation (delta Obliquity and delta Ecliptic longitude),
	*the Julian Day/Century/Millenium, and arrays for computing the precession.
	*@short Store several time-dependent astronomical quantities.
	*@author Jason Harris
	*@version 1.0
	*/

class KSNumbers {
public: 
	/**Constructor. */
	KSNumbers( long double jd );
	/**Destructor (empty). */
	~KSNumbers();

	/**@return the current Obliquity (the angle of inclination between
		*the celestial equator and the ecliptic)
		*/
	const dms* obliquity() const { return &Obliquity; }

	/**@return the constant of aberration (20.49 arcsec). */
	dms constAberr() const { return K; }

	/**@return the mean solar anomaly. */
	dms sunMeanAnomaly() const { return M; }

	/**@return the mean solar longitude. */
	dms sunMeanLongitude() const { return L; }

	/**@return the true solar anomaly. */
	dms sunTrueAnomaly() const { return M0; }

	/**@return the true solar longitude. */
	dms sunTrueLongitude() const { return L0; }

	/**@return the longitude of the Earth's perihelion point. */
	dms earthPerihelionLongitude() const { return P; }

	/**@return eccentricity of Earth's orbit.*/
	double earthEccentricity() const { return e; }

	/**@return the change in obliquity due to the nutation of 
	 * Earth's orbit. Value is in degrees */
	double dObliq() const { return deltaObliquity; }

	/**@return the change in Ecliptic Longitude due to nutation.
	 * Value is in degrees. */
	double dEcLong() const { return deltaEcLong; }

	/**@return Julian centuries since J2000*/
	double julianCenturies() const { return T; }

	/**@return Julian Day*/
	long double julianDay() const { return days; }

	/**@return Julian Millenia since J2000*/
	double julianMillenia() const { return jm; }

	/**@return element of P1 precession array at position [i1][i2] */
	double p1( int i1, int i2 ) const { return P1[i1][i2]; }

	/**@return element of P2 precession array at position [i1][i2] */
	double p2( int i1, int i2 ) const { return P2[i1][i2]; }

	/**@return element of P1B precession array at position [i1][i2] */
	double p1b( int i1, int i2 ) const { return P1B[i1][i2]; }

	/**@return element of P2B precession array at position [i1][i2] */
	double p2b( int i1, int i2 ) const { return P2B[i1][i2]; }

	/**@short update all values for the date given as an argument. 
		*@param jd the Julian date for which to compute values
		*/
	void updateValues( long double jd );

	double vEarth(int i) const {return vearth[i];}

private:
	dms Obliquity, K, L, L0, LM, M, M0, O, P, D, MM, F;
	dms XP, YP, ZP, XB, YB, ZB;
	double CX, SX, CY, SY, CZ, SZ;
	double CXB, SXB, CYB, SYB, CZB, SZB;
	double P1[3][3], P2[3][3], P1B[3][3], P2B[3][3];
	double deltaObliquity, deltaEcLong;
	double e, T, TB;
	long double days;
	double jm;
	static const int arguments[NUTTERMS][5];
	static const int amp[NUTTERMS][4];
	double vearth[3];
};

#endif