1 /***************************************************************************
2 ksplanet.h - K Desktop Planetarium
4 begin : Sun Jul 22 2001
5 copyright : (C) 2001 by Jason Harris
6 email : jharris@30doradus.org
7 ***************************************************************************/
9 /***************************************************************************
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
16 ***************************************************************************/
19 #include <qptrvector.h>
22 #include "ksplanetbase.h"
29 *A subclass of KSPlanetBase for seven of the major planets in the solar system
30 *(Earth and Pluto have their own specialized classes derived from KSPlanetBase).
31 *@note The Sun is subclassed from KSPlanet.
33 *KSPlanet contains internal classes to manage the computations of a planet's position.
34 *The position is computed as a series of sinusoidal sums, similar to a Fourier
35 *transform. See "Astronomical Algorithms" by Jean Meeus or the file README.planetmath
37 *@short Provides necessary information about objects in the solar system.
44 class KSPlanet
: public KSPlanetBase
{
48 *@param s Name of planet
49 *@param image_file filename of the planet's image
50 *@param pSize physical diameter of the planet, in km
52 KSPlanet( KStarsData
*kd
, QString s
="unnamed", QString image_file
="", double pSize
=0 );
56 virtual ~KSPlanet() {}
58 /**@short Preload the data used by findPosition.
60 virtual bool loadData();
62 /**Calculate the ecliptic longitude and latitude of the planet for
63 *the given date (expressed in Julian Millenia since J2000). A reference
64 *to the ecliptic coordinates is returned as the second object.
65 *@param jm Julian Millenia (=jd/1000)
66 *@param ret The ecliptic coordinates are returned by reference through this argument.
68 virtual void calcEcliptic(double jm
, EclipticPosition
&ret
) const;
74 /**Calculate the geocentric RA, Dec coordinates of the Planet.
75 *@note reimplemented from KSPlanetBase
76 *@param num pointer to object with time-dependent values for the desired date
77 *@param Earth pointer to the planet Earth (needed to calculate geocentric coords)
78 *@return true if position was successfully calculated.
80 virtual bool findGeocentricPosition( const KSNumbers
*num
, const KSPlanetBase
*Earth
=NULL
);
83 *This class contains doubles A,B,C which represent a single term in a planet's
84 *positional expansion sums (each sum-term is A*COS(B+C*T)).
85 *@author Mark Hollomon
95 OrbitData(double a
, double b
, double c
) :
101 typedef QPtrVector
<OrbitData
> OBArray
[6];
103 /**OrbitDataColl contains three groups of six QPtrVectors. Each QPtrVector is a
104 *list of OrbitData objects, representing a single sum used in computing
105 *the planet's position. A set of six of these vectors comprises the large
106 *"meta-sum" which yields the planet's Longitude, Latitude, or Distance value.
107 *@author Mark Hollomon
110 class OrbitDataColl
{
121 /**OrbitDataManager places the OrbitDataColl objects for all planets in a QDict
122 *indexed by the planets' names. It also loads the positional data of each planet
124 *@author Mark Hollomon
127 class OrbitDataManager
{
132 /**Load orbital data for a planet from disk.
133 *The data is stored on disk in a series of files named
134 *"name.[LBR][0...5].vsop", where "L"=Longitude data, "B"=Latitude data,
136 *@p n the name of the planet whose data is to be loaded from disk.
137 *@return pointer to the OrbitDataColl containing the planet's orbital data.
139 OrbitDataColl
*loadData(QString n
);
142 /**Read a single orbital data file from disk into an OrbitData vector.
143 *The data files are named "name.[LBR][0...5].vsop", where
144 *"L"=Longitude data, "B"=Latitude data, and R=Radius data.
145 *@p fname the filename to be read.
146 *@p vector pointer to the OrbitData vector to be filled with these data.
148 bool readOrbitData(QString fname
, QPtrVector
<KSPlanet::OrbitData
> *vector
);
150 QDict
<OrbitDataColl
> dict
;
153 static OrbitDataManager odm
;